aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-11-13 10:34:17 -0500
committerJan Kara <jack@suse.cz>2012-11-19 15:34:32 -0500
commitb9e06ef2e8706fe669b51f4364e3aeed58639eb2 (patch)
treed415275434d661a1ba8152736f2788617b77d198
parent3bb3e1fc47aca554e7e2cc4deeddc24750987ac2 (diff)
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>
-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 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,
2216 struct reiserfs_transaction_handle th; 2216 struct reiserfs_transaction_handle th;
2217 int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA; 2217 int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA;
2218 2218
2219 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) 2219 reiserfs_write_lock(sb);
2220 return -EINVAL; 2220 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) {
2221 err = -EINVAL;
2222 goto out;
2223 }
2221 2224
2222 /* Quotafile not on the same filesystem? */ 2225 /* Quotafile not on the same filesystem? */
2223 if (path->dentry->d_sb != sb) { 2226 if (path->dentry->d_sb != sb) {
@@ -2259,8 +2262,10 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2259 if (err) 2262 if (err)
2260 goto out; 2263 goto out;
2261 } 2264 }
2262 err = dquot_quota_on(sb, type, format_id, path); 2265 reiserfs_write_unlock(sb);
2266 return dquot_quota_on(sb, type, format_id, path);
2263out: 2267out:
2268 reiserfs_write_unlock(sb);
2264 return err; 2269 return err;
2265} 2270}
2266 2271