提交 e2a3fde7 编写于 作者: J Jan Kara

ext2: Remove i_mutex use from ext2_quota_write()

We don't need i_mutex in ext2_quota_write() because writes to quota file
are serialized by dqio_mutex anyway. Changes to quota files outside of quota
code are forbidded and enforced by NOATIME and IMMUTABLE bits.
Signed-off-by: NJan Kara <jack@suse.cz>
上级 67f1648d
...@@ -1434,7 +1434,6 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type, ...@@ -1434,7 +1434,6 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
struct buffer_head tmp_bh; struct buffer_head tmp_bh;
struct buffer_head *bh; struct buffer_head *bh;
mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
while (towrite > 0) { while (towrite > 0) {
tocopy = sb->s_blocksize - offset < towrite ? tocopy = sb->s_blocksize - offset < towrite ?
sb->s_blocksize - offset : towrite; sb->s_blocksize - offset : towrite;
...@@ -1464,16 +1463,13 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type, ...@@ -1464,16 +1463,13 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
blk++; blk++;
} }
out: out:
if (len == towrite) { if (len == towrite)
mutex_unlock(&inode->i_mutex);
return err; return err;
}
if (inode->i_size < off+len-towrite) if (inode->i_size < off+len-towrite)
i_size_write(inode, off+len-towrite); i_size_write(inode, off+len-towrite);
inode->i_version++; inode->i_version++;
inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_ctime = CURRENT_TIME;
mark_inode_dirty(inode); mark_inode_dirty(inode);
mutex_unlock(&inode->i_mutex);
return len - towrite; return len - towrite;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册