Commit dee86565 authored by Jan Kara's avatar Jan Kara

quota: Silence lockdep on quota_on

Commit d01730d7 didn't completely fix
the problem since we still take dqio_mutex and i_mutex in the wrong
order. Move taking of i_mutex further down (luckily it's needed only
for updating inode flags) below where dqio_mutex is taken.
Tested-by: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 658874f0
...@@ -2043,7 +2043,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, ...@@ -2043,7 +2043,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
invalidate_bdev(sb->s_bdev); invalidate_bdev(sb->s_bdev);
} }
mutex_lock(&dqopt->dqonoff_mutex); mutex_lock(&dqopt->dqonoff_mutex);
mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
if (sb_has_quota_loaded(sb, type)) { if (sb_has_quota_loaded(sb, type)) {
error = -EBUSY; error = -EBUSY;
goto out_lock; goto out_lock;
...@@ -2054,9 +2053,11 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, ...@@ -2054,9 +2053,11 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
* possible) Also nobody should write to the file - we use * possible) Also nobody should write to the file - we use
* special IO operations which ignore the immutable bit. */ * special IO operations which ignore the immutable bit. */
down_write(&dqopt->dqptr_sem); down_write(&dqopt->dqptr_sem);
mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE |
S_NOQUOTA); S_NOQUOTA);
inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
mutex_unlock(&inode->i_mutex);
up_write(&dqopt->dqptr_sem); up_write(&dqopt->dqptr_sem);
sb->dq_op->drop(inode); sb->dq_op->drop(inode);
} }
...@@ -2080,7 +2081,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, ...@@ -2080,7 +2081,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
goto out_file_init; goto out_file_init;
} }
mutex_unlock(&dqopt->dqio_mutex); mutex_unlock(&dqopt->dqio_mutex);
mutex_unlock(&inode->i_mutex);
spin_lock(&dq_state_lock); spin_lock(&dq_state_lock);
dqopt->flags |= dquot_state_flag(flags, type); dqopt->flags |= dquot_state_flag(flags, type);
spin_unlock(&dq_state_lock); spin_unlock(&dq_state_lock);
...@@ -2096,13 +2096,14 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, ...@@ -2096,13 +2096,14 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
out_lock: out_lock:
if (oldflags != -1) { if (oldflags != -1) {
down_write(&dqopt->dqptr_sem); down_write(&dqopt->dqptr_sem);
mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
/* Set the flags back (in the case of accidental quotaon() /* Set the flags back (in the case of accidental quotaon()
* on a wrong file we don't want to mess up the flags) */ * on a wrong file we don't want to mess up the flags) */
inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE); inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE);
inode->i_flags |= oldflags; inode->i_flags |= oldflags;
mutex_unlock(&inode->i_mutex);
up_write(&dqopt->dqptr_sem); up_write(&dqopt->dqptr_sem);
} }
mutex_unlock(&inode->i_mutex);
mutex_unlock(&dqopt->dqonoff_mutex); mutex_unlock(&dqopt->dqonoff_mutex);
out_fmt: out_fmt:
put_quota_format(fmt); put_quota_format(fmt);
......
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