diff options
author | Jan Kara <jack@suse.cz> | 2012-11-13 16:34:17 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-11-19 21:34:32 +0100 |
commit | b9e06ef2e8706fe669b51f4364e3aeed58639eb2 (patch) | |
tree | d415275434d661a1ba8152736f2788617b77d198 /fs/reiserfs | |
parent | reiserfs: Fix lock ordering during remount (diff) | |
download | linux-b9e06ef2e8706fe669b51f4364e3aeed58639eb2.tar.xz linux-b9e06ef2e8706fe669b51f4364e3aeed58639eb2.zip |
reiserfs: Protect reiserfs_quota_on() with write lock
In reiserfs_quota_on() we do quite some work - for example unpacking
tail of a quota file. Thus we have to hold write lock until a moment
we call back into the quota code.
CC: stable@vger.kernel.org # >= 3.0
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/super.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 5372980ec458..e59d6ddcc69f 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -2216,8 +2216,11 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, struct reiserfs_transaction_handle th; int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA; - if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) - return -EINVAL; + reiserfs_write_lock(sb); + if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) { + err = -EINVAL; + goto out; + } /* Quotafile not on the same filesystem? */ if (path->dentry->d_sb != sb) { @@ -2259,8 +2262,10 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, if (err) goto out; } - err = dquot_quota_on(sb, type, format_id, path); + reiserfs_write_unlock(sb); + return dquot_quota_on(sb, type, format_id, path); out: + reiserfs_write_unlock(sb); return err; } |