Commit 8ed4d1ce authored by Jan Kara's avatar Jan Kara Committed by Greg Kroah-Hartman

reiserfs: Protect reiserfs_quota_on() with write lock

commit b9e06ef2 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: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 394cbbc4
...@@ -2170,8 +2170,11 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, ...@@ -2170,8 +2170,11 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
struct reiserfs_transaction_handle th; struct reiserfs_transaction_handle th;
int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA; int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA;
if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) reiserfs_write_lock(sb);
return -EINVAL; if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) {
err = -EINVAL;
goto out;
}
/* Quotafile not on the same filesystem? */ /* Quotafile not on the same filesystem? */
if (path->dentry->d_sb != sb) { if (path->dentry->d_sb != sb) {
...@@ -2213,8 +2216,10 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, ...@@ -2213,8 +2216,10 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
if (err) if (err)
goto out; 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: out:
reiserfs_write_unlock(sb);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment