summaryrefslogtreecommitdiff
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-11-13 16:34:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-26 11:38:02 -0800
commit8ed4d1ceb26e7f1011314a4f2db93897fb8949e2 (patch)
treec1f7c66bd0196d88284dfb86a0fd0a83618c5ab5 /fs/reiserfs
parent394cbbc4417c009f2831122e9d64c975c8249123 (diff)
downloadlinux-3.10-8ed4d1ceb26e7f1011314a4f2db93897fb8949e2.tar.gz
linux-3.10-8ed4d1ceb26e7f1011314a4f2db93897fb8949e2.tar.bz2
linux-3.10-8ed4d1ceb26e7f1011314a4f2db93897fb8949e2.zip
reiserfs: Protect reiserfs_quota_on() with write lock
commit b9e06ef2e8706fe669b51f4364e3aeed58639eb2 upstream. 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. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/super.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index f4f83bfc571..107f7bd75e9 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2170,8 +2170,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) {
@@ -2213,8 +2216,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;
}