From: Frederic Weisbecker <fweisbec@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Markus Gapp <markus.gapp@gmx.net>, Jan Kara <jack@suse.cz>,
Al Viro <viro@ZenIV.linux.org.uk>
Subject: [PATCH] reiserfs: Fix inode mutex - reiserfs lock misordering
Date: Tue, 9 Nov 2010 23:35:27 +0100 [thread overview]
Message-ID: <1289342127-11410-1-git-send-regression-fweisbec@gmail.com> (raw)
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.
Reported-by: Markus Gapp <markus.gapp@gmx.net>
Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
fs/reiserfs/ioctl.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index adf22b4..d2a7955 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -184,12 +184,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp)
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);
+ /* 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);
/* if we are on a block boundary, we are already unpacked. */
if (write_from == 0) {
--
1.6.2.3
next reply other threads:[~2010-11-09 22:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-09 22:35 Frederic Weisbecker [this message]
2010-11-09 22:40 ` [PATCH v2] " Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289342127-11410-1-git-send-regression-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.gapp@gmx.net \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®