[Linux-cachefs] [PATCH] Cachefs recursive locking problem.
Srinivasa Ds
srinivasa at in.ibm.com
Thu Oct 26 04:28:22 UTC 2006
When I tried to run cachefilesd command, I found out below messages on
dmesg.
=========================================================
=============================================
[ INFO: possible recursive locking detected ]
2.6.18-1.2702.el5 #1
---------------------------------------------
cachefilesd/22494 is trying to acquire lock:
(&inode->i_mutex){--..}, at: [<0000000000248c1e>] mutex_lock+0x3e/0x4c
but task is already holding lock:
(&inode->i_mutex){--..}, at: [<0000000000248c1e>] mutex_lock+0x3e/0x4c
other info that might help us debug this:
1 lock held by cachefilesd/22494:
#0: (&inode->i_mutex){--..}, at: [<0000000000248c1e>] mutex_lock+0x3e/0x4c
stack backtrace:
000000000577f8f0 000000000577f980 0000000000000002 0000000000000000
000000000577fa20 000000000577f998 000000000577f998 000000000001663a
0000000000000000 0000000000000000 000000000000000a 000000000000000a
0000000000000000 000000000577f980 000000000577f980 000000000577f9f8
0000000000259d10 000000000001663a 000000000577f980 000000000577f9d8
Call Trace:
([<0000000000016586>] show_trace+0x122/0x13c)
[<0000000000016658>] show_stack+0xb8/0xc8
[<0000000000016696>] dump_stack+0x2e/0x3c
[<000000000005dc3c>] __lock_acquire+0xb3c/0xba0
[<000000000005e434>] lock_acquire+0x88/0xac
[<00000000002489f4>] __mutex_lock_slowpath+0x130/0x31c
[<0000000000248c1e>] mutex_lock+0x3e/0x4c
[<0000000020ec34ec>] cachefiles_get_directory+0x198/0x600 [cachefiles]
[<0000000020ebecac>] cachefiles_proc_bind+0x3f0/0x57c [cachefiles]
[<0000000020ec5270>] cachefiles_proc_write+0x290/0x2fc [cachefiles]
[<00000000000a9206>] vfs_write+0xd6/0x1b0
[<00000000000a98ea>] sys_write+0x56/0x84
[<000000000001fcec>] sysc_tracego+0xe/0x14
[<0000004efa6dd1f4>] 0x4efa6dd1f4
FS-Cache: Cache "mycache" added (type cachefiles)
CacheFiles: File cache on 5e:01 registered
=======================================================
Cause for this problem is 2 different inodes are getting locked recursively.
One is /proc/fs/cachefiles and other is /var/fscache.
cachefiles_proc_write() locks /proc/fs/cachefiles before writing and
cachefiles_proc_bind() locks /var/fscache directory to get dentry object
for cache and graveyard directories.
Another bug I could able to find out was in cachefiles_check_object_type()
where mutex being unlocked twice.
===================================================================
mutex_lock(&dentry->d_inode->i_mutex);
/* attempt to install a type label directly */
ret = dentry->d_inode->i_op->setxattr(dentry,
cachefiles_xattr_cache,
type, 2, XATTR_CREATE);
if (ret == 0) {
_debug("SET");
fsnotify_xattr(dentry);
mutex_unlock(&dentry->d_inode->i_mutex); ====> bug here
goto error;
}
.................................
....................................
error:
mutex_unlock(&dentry->d_inode->i_mutex); =======> happening
twice
_leave(" = %d", ret);
return ret;
=======================================================
I have developed the patch which solves these problem. Please let me
know your
comments on this patch.
Thanks
Srinivasa DS
IBM-LTC
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cachefs.fix
URL: <http://listman.redhat.com/archives/linux-cachefs/attachments/20061026/15880bd6/attachment.ksh>
More information about the Linux-cachefs
mailing list