https://github.com/torvalds/linux
Revision 7ef55b8a05c02db7c07d81827c69fe8f124e8654 authored by Srinivasa Ds on 03 November 2006, 06:07:12 UTC, committed by Linus Torvalds on 03 November 2006, 20:27:57 UTC
When I was performing some operations on NFS, I got below error on server
side.

  =============================================
  [ INFO: possible recursive locking detected ]
  2.6.19-prep #1
  ---------------------------------------------
  nfsd4/3525 is trying to acquire lock:
   (&inode->i_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24

  but task is already holding lock:
   (&inode->i_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24

  other info that might help us debug this:
  2 locks held by nfsd4/3525:
   #0:  (client_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24
   #1:  (&inode->i_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24

  stack backtrace:
   [<c04051ed>] show_trace_log_lvl+0x58/0x16a
   [<c04057fa>] show_trace+0xd/0x10
   [<c0405913>] dump_stack+0x19/0x1b
   [<c043b6f1>] __lock_acquire+0x778/0x99c
   [<c043be86>] lock_acquire+0x4b/0x6d
   [<c0611ceb>] __mutex_lock_slowpath+0xbc/0x20a
   [<c0611e5a>] mutex_lock+0x21/0x24
   [<c047fd7e>] vfs_rmdir+0x76/0xf8
   [<f94b7ce9>] nfsd4_clear_clid_dir+0x2c/0x41 [nfsd]
   [<f94b7de9>] nfsd4_remove_clid_dir+0xb1/0xe8 [nfsd]
   [<f94b307b>] laundromat_main+0x9b/0x1c3 [nfsd]
   [<c04333d6>] run_workqueue+0x7a/0xbb
   [<c0433d0b>] worker_thread+0xd2/0x107
   [<c0436285>] kthread+0xc3/0xf2
   [<c0402005>] kernel_thread_helper+0x5/0xb
  ===================================================================

Cause for this problem was,2 successive mutex_lock calls on 2 diffrent inodes ,as shown below

	static int
	nfsd4_clear_clid_dir(struct dentry *dir, struct dentry *dentry)
	{
	        int status;

	        /* For now this directory should already be empty, but we empty it of
        	 * any regular files anyway, just in case the directory was created by
	         * a kernel from the future.... */
        	nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
	        mutex_lock(&dir->d_inode->i_mutex);
	        status = vfs_rmdir(dir->d_inode, dentry);
	...

	int vfs_rmdir(struct inode *dir, struct dentry *dentry)
	{
	        int error = may_delete(dir, dentry, 1);

	        if (error)
	                return error;

	        if (!dir->i_op || !dir->i_op->rmdir)
        	        return -EPERM;

	        DQUOT_INIT(dir);

	        mutex_lock(&dentry->d_inode->i_mutex);
	...

So I have developed the patch to overcome this problem.

Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 77d6e13
History
Tip revision: 7ef55b8a05c02db7c07d81827c69fe8f124e8654 authored by Srinivasa Ds on 03 November 2006, 06:07:12 UTC
[PATCH] NFS4: fix for recursive locking problem
Tip revision: 7ef55b8
File Mode Size
reed_solomon
zlib_deflate
zlib_inflate
.gitignore -rw-r--r-- 51 bytes
Kconfig -rw-r--r-- 1.9 KB
Kconfig.debug -rw-r--r-- 14.2 KB
Makefile -rw-r--r-- 1.9 KB
audit.c -rw-r--r-- 1020 bytes
bitmap.c -rw-r--r-- 24.0 KB
bust_spinlocks.c -rw-r--r-- 905 bytes
cmdline.c -rw-r--r-- 2.7 KB
cpumask.c -rw-r--r-- 972 bytes
crc-ccitt.c -rw-r--r-- 3.0 KB
crc16.c -rw-r--r-- 2.8 KB
crc32.c -rw-r--r-- 15.5 KB
crc32defs.h -rw-r--r-- 1.0 KB
ctype.c -rw-r--r-- 1.3 KB
debug_locks.c -rw-r--r-- 1.1 KB
dec_and_lock.c -rw-r--r-- 806 bytes
div64.c -rw-r--r-- 1.3 KB
dump_stack.c -rw-r--r-- 290 bytes
extable.c -rw-r--r-- 1.9 KB
find_next_bit.c -rw-r--r-- 4.3 KB
gen_crc32table.c -rw-r--r-- 1.8 KB
genalloc.c -rw-r--r-- 5.3 KB
halfmd4.c -rw-r--r-- 2.0 KB
hweight.c -rw-r--r-- 1.6 KB
idr.c -rw-r--r-- 10.9 KB
inflate.c -rw-r--r-- 37.0 KB
int_sqrt.c -rw-r--r-- 533 bytes
iomap.c -rw-r--r-- 6.2 KB
iomap_copy.c -rw-r--r-- 2.1 KB
ioremap.c -rw-r--r-- 2.1 KB
irq_regs.c -rw-r--r-- 578 bytes
kernel_lock.c -rw-r--r-- 4.6 KB
klist.c -rw-r--r-- 6.8 KB
kobject.c -rw-r--r-- 12.3 KB
kobject_uevent.c -rw-r--r-- 6.8 KB
kref.c -rw-r--r-- 1.8 KB
libcrc32c.c -rw-r--r-- 6.5 KB
list_debug.c -rw-r--r-- 1.9 KB
locking-selftest-hardirq.h -rw-r--r-- 207 bytes
locking-selftest-mutex.h -rw-r--r-- 120 bytes
locking-selftest-rlock-hardirq.h -rw-r--r-- 74 bytes
locking-selftest-rlock-softirq.h -rw-r--r-- 74 bytes
locking-selftest-rlock.h -rw-r--r-- 158 bytes
locking-selftest-rsem.h -rw-r--r-- 163 bytes
locking-selftest-softirq.h -rw-r--r-- 207 bytes
locking-selftest-spin-hardirq.h -rw-r--r-- 73 bytes
locking-selftest-spin-softirq.h -rw-r--r-- 73 bytes
locking-selftest-spin.h -rw-r--r-- 118 bytes
locking-selftest-wlock-hardirq.h -rw-r--r-- 74 bytes
locking-selftest-wlock-softirq.h -rw-r--r-- 74 bytes
locking-selftest-wlock.h -rw-r--r-- 158 bytes
locking-selftest-wsem.h -rw-r--r-- 163 bytes
locking-selftest.c -rw-r--r-- 28.6 KB
parser.c -rw-r--r-- 5.8 KB
percpu_counter.c -rw-r--r-- 964 bytes
plist.c -rw-r--r-- 2.8 KB
prio_tree.c -rw-r--r-- 12.2 KB
radix-tree.c -rw-r--r-- 21.6 KB
random32.c -rw-r--r-- 3.6 KB
rbtree.c -rw-r--r-- 8.6 KB
rwsem-spinlock.c -rw-r--r-- 6.9 KB
rwsem.c -rw-r--r-- 6.4 KB
semaphore-sleepers.c -rw-r--r-- 4.7 KB
sha1.c -rw-r--r-- 2.4 KB
smp_processor_id.c -rw-r--r-- 1.1 KB
sort.c -rw-r--r-- 2.5 KB
spinlock_debug.c -rw-r--r-- 6.7 KB
string.c -rw-r--r-- 12.4 KB
swiotlb.c -rw-r--r-- 22.7 KB
textsearch.c -rw-r--r-- 9.2 KB
ts_bm.c -rw-r--r-- 4.9 KB
ts_fsm.c -rw-r--r-- 10.5 KB
ts_kmp.c -rw-r--r-- 3.8 KB
vsprintf.c -rw-r--r-- 18.8 KB

back to top