diff options
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 607c579e5eca..38f7bd559f35 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -2042,7 +2042,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, | |||
2042 | * changes */ | 2042 | * changes */ |
2043 | invalidate_bdev(sb->s_bdev); | 2043 | invalidate_bdev(sb->s_bdev); |
2044 | } | 2044 | } |
2045 | mutex_lock(&inode->i_mutex); | ||
2046 | mutex_lock(&dqopt->dqonoff_mutex); | 2045 | mutex_lock(&dqopt->dqonoff_mutex); |
2047 | if (sb_has_quota_loaded(sb, type)) { | 2046 | if (sb_has_quota_loaded(sb, type)) { |
2048 | error = -EBUSY; | 2047 | error = -EBUSY; |
@@ -2054,9 +2053,11 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, | |||
2054 | * possible) Also nobody should write to the file - we use | 2053 | * possible) Also nobody should write to the file - we use |
2055 | * special IO operations which ignore the immutable bit. */ | 2054 | * special IO operations which ignore the immutable bit. */ |
2056 | down_write(&dqopt->dqptr_sem); | 2055 | down_write(&dqopt->dqptr_sem); |
2056 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA); | ||
2057 | oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | | 2057 | oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | |
2058 | S_NOQUOTA); | 2058 | S_NOQUOTA); |
2059 | inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; | 2059 | inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; |
2060 | mutex_unlock(&inode->i_mutex); | ||
2060 | up_write(&dqopt->dqptr_sem); | 2061 | up_write(&dqopt->dqptr_sem); |
2061 | sb->dq_op->drop(inode); | 2062 | sb->dq_op->drop(inode); |
2062 | } | 2063 | } |
@@ -2080,7 +2081,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, | |||
2080 | goto out_file_init; | 2081 | goto out_file_init; |
2081 | } | 2082 | } |
2082 | mutex_unlock(&dqopt->dqio_mutex); | 2083 | mutex_unlock(&dqopt->dqio_mutex); |
2083 | mutex_unlock(&inode->i_mutex); | ||
2084 | spin_lock(&dq_state_lock); | 2084 | spin_lock(&dq_state_lock); |
2085 | dqopt->flags |= dquot_state_flag(flags, type); | 2085 | dqopt->flags |= dquot_state_flag(flags, type); |
2086 | spin_unlock(&dq_state_lock); | 2086 | spin_unlock(&dq_state_lock); |
@@ -2094,16 +2094,17 @@ out_file_init: | |||
2094 | dqopt->files[type] = NULL; | 2094 | dqopt->files[type] = NULL; |
2095 | iput(inode); | 2095 | iput(inode); |
2096 | out_lock: | 2096 | out_lock: |
2097 | mutex_unlock(&dqopt->dqonoff_mutex); | ||
2098 | if (oldflags != -1) { | 2097 | if (oldflags != -1) { |
2099 | down_write(&dqopt->dqptr_sem); | 2098 | down_write(&dqopt->dqptr_sem); |
2099 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA); | ||
2100 | /* Set the flags back (in the case of accidental quotaon() | 2100 | /* Set the flags back (in the case of accidental quotaon() |
2101 | * on a wrong file we don't want to mess up the flags) */ | 2101 | * on a wrong file we don't want to mess up the flags) */ |
2102 | inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE); | 2102 | inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE); |
2103 | inode->i_flags |= oldflags; | 2103 | inode->i_flags |= oldflags; |
2104 | mutex_unlock(&inode->i_mutex); | ||
2104 | up_write(&dqopt->dqptr_sem); | 2105 | up_write(&dqopt->dqptr_sem); |
2105 | } | 2106 | } |
2106 | mutex_unlock(&inode->i_mutex); | 2107 | mutex_unlock(&dqopt->dqonoff_mutex); |
2107 | out_fmt: | 2108 | out_fmt: |
2108 | put_quota_format(fmt); | 2109 | put_quota_format(fmt); |
2109 | 2110 | ||