提交 361d94a3 编写于 作者: J Jan Kara

reiserfs: Protect reiserfs_quota_write() with write lock

Calls into reiserfs journalling code and reiserfs_get_block() need to
be protected with write lock. We remove write lock around calls to high
level quota code in the next patch so these paths would suddently become
unprotected.

CC: stable@vger.kernel.org # >= 3.0
Signed-off-by: NJan Kara <jack@suse.cz>
上级 b9e06ef2
...@@ -2338,7 +2338,9 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type, ...@@ -2338,7 +2338,9 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
tocopy = sb->s_blocksize - offset < towrite ? tocopy = sb->s_blocksize - offset < towrite ?
sb->s_blocksize - offset : towrite; sb->s_blocksize - offset : towrite;
tmp_bh.b_state = 0; tmp_bh.b_state = 0;
reiserfs_write_lock(sb);
err = reiserfs_get_block(inode, blk, &tmp_bh, GET_BLOCK_CREATE); err = reiserfs_get_block(inode, blk, &tmp_bh, GET_BLOCK_CREATE);
reiserfs_write_unlock(sb);
if (err) if (err)
goto out; goto out;
if (offset || tocopy != sb->s_blocksize) if (offset || tocopy != sb->s_blocksize)
...@@ -2354,10 +2356,12 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type, ...@@ -2354,10 +2356,12 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
flush_dcache_page(bh->b_page); flush_dcache_page(bh->b_page);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
unlock_buffer(bh); unlock_buffer(bh);
reiserfs_write_lock(sb);
reiserfs_prepare_for_journal(sb, bh, 1); reiserfs_prepare_for_journal(sb, bh, 1);
journal_mark_dirty(current->journal_info, sb, bh); journal_mark_dirty(current->journal_info, sb, bh);
if (!journal_quota) if (!journal_quota)
reiserfs_add_ordered_list(inode, bh); reiserfs_add_ordered_list(inode, bh);
reiserfs_write_unlock(sb);
brelse(bh); brelse(bh);
offset = 0; offset = 0;
towrite -= tocopy; towrite -= tocopy;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册