提交 da905873 编写于 作者: F Frederic Weisbecker 提交者: Linus Torvalds

reiserfs: fix inode mutex - reiserfs lock misordering

reiserfs_unpack() locks the inode mutex with reiserfs_mutex_lock_safe()
to protect against reiserfs lock dependency.  However this protection
requires to have the reiserfs lock to be locked.

This is the case if reiserfs_unpack() is called by reiserfs_ioctl but
not from reiserfs_quota_on() when it tries to unpack tails of quota
files.

Fix the ordering of the two locks in reiserfs_unpack() to fix this
issue.
Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
Reported-by: NMarkus Gapp <markus.gapp@gmx.net>
Reported-by: NJan Kara <jack@suse.cz>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: <stable@kernel.org>		[2.6.36.x]
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d1d73578
...@@ -183,12 +183,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) ...@@ -183,12 +183,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
return 0; return 0;
} }
/* we need to make sure nobody is changing the file size beneath
** us
*/
reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb);
depth = reiserfs_write_lock_once(inode->i_sb); depth = reiserfs_write_lock_once(inode->i_sb);
/* we need to make sure nobody is changing the file size beneath us */
reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb);
write_from = inode->i_size & (blocksize - 1); write_from = inode->i_size & (blocksize - 1);
/* if we are on a block boundary, we are already unpacked. */ /* if we are on a block boundary, we are already unpacked. */
if (write_from == 0) { if (write_from == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册