From: Chris Mason <mason@suse.com>
To: linux-fsdevel@vger.kernel.org, akpm@osdl.org, reiserfs-dev@namesys.com
Subject: [PATCH] fix reiserfs lock inversion of bkl vs inode semaphore
Date: Fri, 4 Aug 2006 10:00:15 -0400 [thread overview]
Message-ID: <20060804140015.GD1134@watt.suse.com> (raw)
From: Chris Mason <mason@suse.com>
Subject: fix reiserfs lock inversion of bkl vs inode semaphore
The correct lock ordering is inode lock -> BKL
Signed-off-by: Chris Mason <mason@suse.com>
--- a/fs/reiserfs/file.c Thu Aug 03 16:18:18 2006 -0400
+++ b/fs/reiserfs/file.c Thu Aug 03 16:18:18 2006 -0400
@@ -48,8 +48,8 @@ static int reiserfs_file_release(struct
return 0;
}
+ mutex_lock(&inode->i_mutex);
reiserfs_write_lock(inode->i_sb);
- mutex_lock(&inode->i_mutex);
/* freeing preallocation only involves relogging blocks that
* are already in the current transaction. preallocation gets
* freed at the end of each transaction, so it is impossible for
--- a/fs/reiserfs/inode.c Thu Aug 03 16:18:18 2006 -0400
+++ b/fs/reiserfs/inode.c Thu Aug 03 16:18:28 2006 -0400
@@ -35,11 +35,11 @@ void reiserfs_delete_inode(struct inode
truncate_inode_pages(&inode->i_data, 0);
- reiserfs_write_lock(inode->i_sb);
/* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
mutex_lock(&inode->i_mutex);
+ reiserfs_write_lock(inode->i_sb);
reiserfs_delete_xattrs(inode);
@@ -75,7 +75,7 @@ void reiserfs_delete_inode(struct inode
* about an error here */
} else {
/* no object items are in the tree */
- ;
+ reiserfs_write_lock(inode->i_sb);
}
out:
clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */
--- a/fs/reiserfs/ioctl.c Thu Aug 03 16:18:18 2006 -0400
+++ b/fs/reiserfs/ioctl.c Thu Aug 03 16:18:18 2006 -0400
@@ -116,12 +116,12 @@ static int reiserfs_unpack(struct inode
if (REISERFS_I(inode)->i_flags & i_nopack_mask) {
return 0;
}
- reiserfs_write_lock(inode->i_sb);
/* we need to make sure nobody is changing the file size beneath
** us
*/
mutex_lock(&inode->i_mutex);
+ reiserfs_write_lock(inode->i_sb);
write_from = inode->i_size & (blocksize - 1);
/* if we are on a block boundary, we are already unpacked. */
--
next reply other threads:[~2006-08-04 14:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-04 14:00 Chris Mason [this message]
2006-08-04 22:51 ` [PATCH] fix reiserfs lock inversion of bkl vs inode semaphore Andrew Morton
2006-08-05 16:21 ` Arjan van de Ven
2006-08-04 22:56 ` Andrew Morton
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=20060804140015.GD1134@watt.suse.com \
--to=mason@suse.com \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=reiserfs-dev@namesys.com \
/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;
as well as URLs for NNTP newsgroup(s).