]>
Commit | Line | Data |
---|---|---|
2ef4d74f GKH |
1 | From b9e06ef2e8706fe669b51f4364e3aeed58639eb2 Mon Sep 17 00:00:00 2001 |
2 | From: Jan Kara <jack@suse.cz> | |
3 | Date: Tue, 13 Nov 2012 16:34:17 +0100 | |
4 | Subject: reiserfs: Protect reiserfs_quota_on() with write lock | |
5 | ||
6 | From: Jan Kara <jack@suse.cz> | |
7 | ||
8 | commit b9e06ef2e8706fe669b51f4364e3aeed58639eb2 upstream. | |
9 | ||
10 | In reiserfs_quota_on() we do quite some work - for example unpacking | |
11 | tail of a quota file. Thus we have to hold write lock until a moment | |
12 | we call back into the quota code. | |
13 | ||
14 | Signed-off-by: Jan Kara <jack@suse.cz> | |
15 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
16 | ||
17 | --- | |
18 | fs/reiserfs/super.c | 11 ++++++++--- | |
19 | 1 file changed, 8 insertions(+), 3 deletions(-) | |
20 | ||
21 | --- a/fs/reiserfs/super.c | |
22 | +++ b/fs/reiserfs/super.c | |
23 | @@ -2211,8 +2211,11 @@ static int reiserfs_quota_on(struct supe | |
24 | struct reiserfs_transaction_handle th; | |
25 | int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA; | |
26 | ||
27 | - if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) | |
28 | - return -EINVAL; | |
29 | + reiserfs_write_lock(sb); | |
30 | + if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) { | |
31 | + err = -EINVAL; | |
32 | + goto out; | |
33 | + } | |
34 | ||
35 | /* Quotafile not on the same filesystem? */ | |
36 | if (path->dentry->d_sb != sb) { | |
37 | @@ -2254,8 +2257,10 @@ static int reiserfs_quota_on(struct supe | |
38 | if (err) | |
39 | goto out; | |
40 | } | |
41 | - err = dquot_quota_on(sb, type, format_id, path); | |
42 | + reiserfs_write_unlock(sb); | |
43 | + return dquot_quota_on(sb, type, format_id, path); | |
44 | out: | |
45 | + reiserfs_write_unlock(sb); | |
46 | return err; | |
47 | } | |
48 |