Re: 2.5.54 - quota support

Jan Kara
2003-01-07T16:31:53Z

[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]

> On Mon, Jan 06, 2003 at 03:48:43PM +0100, Jan Kara wrote:
> > I seems like quotaon (or better quotactl()) waits on some lock
> > forever... I'll try to reproduce it but in the mean time can you print
> > list of processes, write down a few addresses from the top of the stack
> > of quotaon and try to match it in the system.map to function in which
> > is process stuck?
>
> according to strace quotaon freezes at
> quotactl(0xff800002, "/dev/hda1", 2
>
> call trace is: (sysrq-t)
> vfs_permission
> __rwsem_do_wake
> rwsem_down_read_failed
> module_put
> dqinit_needed
> vfs_quota_off
> resolve_dev
> d_free
> deny_write_access
> check_quotactl_valid
> d_free
> scheduling_functions_start_here
> do_quotactl
> system_call
>
>
> Btw, freeze on quotaon is not regular. After some time that system is up,
> quotaon reports only no such device and terminates.
>
> so looks like
> 1) freeze on quotactl
> 2) reports no such device
>
> in both cases not working.
Reporting 'No such device' was actually bug which was introduced some
time ago but nobody probably noticed it... It was introduce when quota
code was converted from device numbers to 'bdev' structures.
I also fixed one bug in quotaon() call however I'm not sure wheter it
could cause the freeze. Anyway patch is attached, try it and tell me
about the changes.

Honza

--
Jan Kara <jack@suse.cz>
SuSE CR Labs

[-- Attachment #2: quota-2.5.54-1-fix.diff --]
[-- Type: text/plain, Size: 1723 bytes --]

diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54/fs/dquot.c linux-2.5.54-1-lockfix/fs/dquot.c
--- linux-2.5.54/fs/dquot.c Mon Jan 6 21:54:10 2003
+++ linux-2.5.54-1-lockfix/fs/dquot.c Mon Jan 6 23:49:43 2003
@@ -1157,6 +1157,7 @@
struct quota_info *dqopt = sb_dqopt(sb);
struct quota_format_type *fmt = find_quota_format(format_id);
int error;
+ unsigned int oldflags;

if (!fmt)
return -ESRCH;
@@ -1181,10 +1182,11 @@
error = -EBUSY;
goto out_lock;
}
+ oldflags = inode->i_flags;
dqopt->files[type] = f;
error = -EINVAL;
if (!fmt->qf_ops->check_quota_file(sb, type))
- goto out_lock;
+ goto out_file_init;
/* We don't want quota on quota files */
dquot_drop_nolock(inode);
inode->i_flags |= S_NOQUOTA;
@@ -1194,7 +1196,7 @@
down(&dqopt->dqio_sem);
if ((error = dqopt->ops[type]->read_file_info(sb, type)) < 0) {
up(&dqopt->dqio_sem);
- goto out_lock;
+ goto out_file_init;
}
up(&dqopt->dqio_sem);
set_enable_flags(dqopt, type);
@@ -1204,9 +1206,10 @@
up_write(&dqopt->dqoff_sem);
return 0;

-out_lock:
- inode->i_flags &= ~S_NOQUOTA;
+out_file_init:
+ inode->i_flags = oldflags;
dqopt->files[type] = NULL;
+out_lock:
up_write(&dqopt->dqoff_sem);
out_f:
filp_close(f, NULL);
diff -ruNX /home/jack/.kerndiffexclude linux-2.5.54/fs/quota.c linux-2.5.54-1-lockfix/fs/quota.c
--- linux-2.5.54/fs/quota.c Tue Jan 7 00:47:58 2003
+++ linux-2.5.54-1-lockfix/fs/quota.c Tue Jan 7 00:49:23 2003
@@ -114,7 +114,11 @@
ret = user_path_walk(path, &nd);
if (ret)
goto out;
-
+ ret = bd_acquire(nd.dentry->d_inode);
+ if (ret) {
+ path_release(&nd);
+ goto out;
+ }
bdev = nd.dentry->d_inode->i_bdev;
mode = nd.dentry->d_inode->i_mode;
path_release(&nd);