Commit d84f59d5 authored by Jan Kara's avatar Jan Kara Committed by Ben Hutchings

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>
[bwh: Backported to 3.2: there is no distinction between USRQUOTA and
 GRPQUOTA mount options here]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent aa9e0832
......@@ -2073,8 +2073,11 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
struct inode *inode;
struct reiserfs_transaction_handle th;
if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA)))
return -EINVAL;
reiserfs_write_lock(sb);
if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) {
err = -EINVAL;
goto out;
}
/* Quotafile not on the same filesystem? */
if (path->mnt->mnt_sb != sb) {
......@@ -2116,8 +2119,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;
}
......
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