reiserfs: Move quota calls out of write lock
Calls into highlevel quota code cannot happen under the write lock. These calls take dqio_mutex which ranks above write lock. So drop write lock before calling back into quota code. CC: stable@vger.kernel.org # >= 3.0 Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
@@ -1782,8 +1782,9 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
|
||||
|
||||
BUG_ON(!th->t_trans_id);
|
||||
|
||||
dquot_initialize(inode);
|
||||
reiserfs_write_unlock(inode->i_sb);
|
||||
err = dquot_alloc_inode(inode);
|
||||
reiserfs_write_lock(inode->i_sb);
|
||||
if (err)
|
||||
goto out_end_trans;
|
||||
if (!dir->i_nlink) {
|
||||
@@ -1979,8 +1980,10 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
|
||||
|
||||
out_end_trans:
|
||||
journal_end(th, th->t_super, th->t_blocks_allocated);
|
||||
reiserfs_write_unlock(inode->i_sb);
|
||||
/* Drop can be outside and it needs more credits so it's better to have it outside */
|
||||
dquot_drop(inode);
|
||||
reiserfs_write_lock(inode->i_sb);
|
||||
inode->i_flags |= S_NOQUOTA;
|
||||
make_bad_inode(inode);
|
||||
|
||||
@@ -3103,10 +3106,9 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
/* must be turned off for recursive notify_change calls */
|
||||
ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
|
||||
|
||||
depth = reiserfs_write_lock_once(inode->i_sb);
|
||||
if (is_quota_modification(inode, attr))
|
||||
dquot_initialize(inode);
|
||||
|
||||
depth = reiserfs_write_lock_once(inode->i_sb);
|
||||
if (attr->ia_valid & ATTR_SIZE) {
|
||||
/* version 2 items will be caught by the s_maxbytes check
|
||||
** done for us in vmtruncate
|
||||
@@ -3170,7 +3172,9 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
error = journal_begin(&th, inode->i_sb, jbegin_count);
|
||||
if (error)
|
||||
goto out;
|
||||
reiserfs_write_unlock_once(inode->i_sb, depth);
|
||||
error = dquot_transfer(inode, attr);
|
||||
depth = reiserfs_write_lock_once(inode->i_sb);
|
||||
if (error) {
|
||||
journal_end(&th, inode->i_sb, jbegin_count);
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user