Messages in this thread Patch in this message |  | | | Date | Tue, 09 Jan 2007 15:02:47 +0530 | | From | Srinivasa Ds <> | | Subject | Re: JFS: possible recursive locking detected | |
Tomasz Kvarsin wrote:
> This I got during boot with 2.6.20-rc4:
> =============================================
> [ INFO: possible recursive locking detected ]
> 2.6.20-rc4 #3
> ---------------------------------------------
> mount/5819 is trying to acquire lock:
> (&jfs_ip->commit_mutex){--..}, at: [<c03395e1>] mutex_lock+0x21/0x30
>
> but task is already holding lock:
> (&jfs_ip->commit_mutex){--..}, at: [<c03395e1>] mutex_lock+0x21/0x30
>
> other info that might help us debug this:
> 2 locks held by mount/5819:
> #0: (&inode->i_mutex){--..}, at: [<c03395e1>] mutex_lock+0x21/0x30
> #1: (&jfs_ip->commit_mutex){--..}, at: [<c03395e1>] mutex_lock+0x21/0x30
>
Problem was in jfs_create(), it was calling 2 mutex_calls.
=============================================
static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
struct nameidata *nd)
{
int rc = 0;
tid_t tid; /* transaction id */
struct inode *ip = NULL; /* child directory inode */
ino_t ino;
struct component_name dname; /* child directory name */
struct btstack btstack;
struct inode *iplist[2];
struct tblock *tblk;
jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name);
.....................................
tid = txBegin(dip->i_sb, 0);
mutex_lock(&JFS_IP(dip)->commit_mutex);
mutex_lock(&JFS_IP(ip)->commit_mutex);
rc = jfs_init_acl(tid, ip, dip);
if (rc)
goto out3;
=======================================
So below patch should fix this problem,please test this. Let me know
your comments on this.
Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
namei.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.20-rc4/fs/jfs/namei.c
===================================================================
--- linux-2.6.20-rc4.orig/fs/jfs/namei.c
+++ linux-2.6.20-rc4/fs/jfs/namei.c
@@ -104,8 +104,8 @@ static int jfs_create(struct inode *dip,
tid = txBegin(dip->i_sb, 0);
- mutex_lock(&JFS_IP(dip)->commit_mutex);
- mutex_lock(&JFS_IP(ip)->commit_mutex);
+ mutex_lock_nested(&JFS_IP(dip)->commit_mutex, I_MUTEX_PARENT);
+ mutex_lock_nested(&JFS_IP(ip)->commit_mutex, I_MUTEX_CHILD);
rc = jfs_init_acl(tid, ip, dip);
if (rc) |  |