Skip to content

Commit

Permalink
reiserfs: Protect reiserfs_quota_on() with write lock
Browse files Browse the repository at this point in the history
commit b9e06ef 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>
  • Loading branch information
Jan Kara authored and Greg Kroah-Hartman committed Nov 26, 2012
1 parent daa88cb commit a7b8408
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/reiserfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2072,8 +2072,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) {
Expand Down Expand Up @@ -2115,8 +2118,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;
}

Expand Down

0 comments on commit a7b8408

Please sign in to comment.