Commit 0c69f9e6 authored by Jan Kara's avatar Jan Kara Committed by Linus Torvalds

[PATCH] Fix reiserfs quota SMP locks

From: Vladimir Saveliev <vs@namesys.com>, Jan Kara <jack@suse.cz>

Add missing SMP locking and one lock_buffer() to the reiserfs quota code.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ef2cda6f
......@@ -1835,9 +1835,11 @@ static int reiserfs_dquot_initialize(struct inode *inode, int type)
int ret;
/* We may create quota structure so we need to reserve enough blocks */
reiserfs_write_lock(inode->i_sb);
journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
ret = dquot_initialize(inode, type);
journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
reiserfs_write_unlock(inode->i_sb);
return ret;
}
......@@ -1847,9 +1849,11 @@ static int reiserfs_dquot_drop(struct inode *inode)
int ret;
/* We may delete quota structure so we need to reserve enough blocks */
reiserfs_write_lock(inode->i_sb);
journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
ret = dquot_drop(inode);
journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
reiserfs_write_unlock(inode->i_sb);
return ret;
}
......@@ -1858,9 +1862,11 @@ static int reiserfs_write_dquot(struct dquot *dquot)
struct reiserfs_transaction_handle th;
int ret;
reiserfs_write_lock(dquot->dq_sb);
journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
ret = dquot_commit(dquot);
journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
......@@ -1869,9 +1875,11 @@ static int reiserfs_acquire_dquot(struct dquot *dquot)
struct reiserfs_transaction_handle th;
int ret;
reiserfs_write_lock(dquot->dq_sb);
journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
ret = dquot_acquire(dquot);
journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
......@@ -1880,9 +1888,11 @@ static int reiserfs_release_dquot(struct dquot *dquot)
struct reiserfs_transaction_handle th;
int ret;
reiserfs_write_lock(dquot->dq_sb);
journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
ret = dquot_release(dquot);
journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
......@@ -1904,9 +1914,11 @@ static int reiserfs_write_info(struct super_block *sb, int type)
int ret;
/* Data block + inode block */
reiserfs_write_lock(sb);
journal_begin(&th, sb, 2);
ret = dquot_commit_info(sb, type);
journal_end(&th, sb, 2);
reiserfs_write_unlock(sb);
return ret;
}
......@@ -1993,7 +2005,9 @@ static ssize_t reiserfs_quota_read(struct super_block *sb, int type, char *data,
tocopy = sb->s_blocksize - offset < toread ? sb->s_blocksize - offset : toread;
tmp_bh.b_state = 0;
/* Quota files are without tails so we can safely use this function */
reiserfs_write_lock(sb);
err = reiserfs_get_block(inode, blk, &tmp_bh, 0);
reiserfs_write_unlock(sb);
if (err)
return err;
if (!buffer_mapped(&tmp_bh)) /* A hole? */
......@@ -2041,8 +2055,11 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
err = -EIO;
goto out;
}
lock_buffer(bh);
memcpy(bh->b_data+offset, data, tocopy);
flush_dcache_page(bh->b_page);
set_buffer_uptodate(bh);
unlock_buffer(bh);
reiserfs_prepare_for_journal(sb, bh, 1);
journal_mark_dirty(current->journal_info, sb, bh);
if (!journal_quota)
......
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