linux-kernel-test/fs/nilfs2
Ryusuke Konishi 027d6404eb nilfs2: use semaphore to protect pointer to a writable FS-instance
will get rid of nilfs_get_writer() and nilfs_put_writer() pair used to
retain a writable FS-instance for a period.

The pair functions were making up some kind of recursive lock with a
mutex, but they became overkill since the commit
201913ed74.  Furthermore, they caused
the following lockdep warning because the mutex can be released by a
task which didn't lock it:

 =====================================
 [ BUG: bad unlock balance detected! ]
 -------------------------------------
 kswapd0/422 is trying to release lock (&nilfs->ns_writer_mutex) at:
 [<c1359ff5>] mutex_unlock+0x8/0xa
 but there are no more locks to release!

 other info that might help us debug this:
 no locks held by kswapd0/422.

 stack backtrace:
 Pid: 422, comm: kswapd0 Not tainted 2.6.31-rc4-nilfs #51
 Call Trace:
  [<c1358f97>] ? printk+0xf/0x18
  [<c104fea7>] print_unlock_inbalance_bug+0xcc/0xd7
  [<c11578de>] ? prop_put_global+0x3/0x35
  [<c1050195>] lock_release+0xed/0x1dc
  [<c1359ff5>] ? mutex_unlock+0x8/0xa
  [<c1359f83>] __mutex_unlock_slowpath+0xaf/0x119
  [<c1359ff5>] mutex_unlock+0x8/0xa
  [<d1284add>] nilfs_mdt_write_page+0xd8/0xe1 [nilfs2]
  [<c1092653>] shrink_page_list+0x379/0x68d
  [<c109171b>] ? isolate_pages_global+0xb4/0x18c
  [<c1092bd2>] shrink_list+0x26b/0x54b
  [<c10930be>] shrink_zone+0x20c/0x2a2
  [<c10936b7>] kswapd+0x407/0x591
  [<c1091667>] ? isolate_pages_global+0x0/0x18c
  [<c1040603>] ? autoremove_wake_function+0x0/0x33
  [<c10932b0>] ? kswapd+0x0/0x591
  [<c104033b>] kthread+0x69/0x6e
  [<c10402d2>] ? kthread+0x0/0x6e
  [<c1003e33>] kernel_thread_helper+0x7/0x1a

This patch uses a reader/writer semaphore instead of the own lock and
kills this warning.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2009-09-14 18:27:13 +09:00
..
alloc.c nilfs2: persistent object allocator 2009-04-07 08:31:13 -07:00
alloc.h nilfs2: persistent object allocator 2009-04-07 08:31:13 -07:00
bmap_union.h
bmap.c nilfs2: fix lockdep warning between regular file and inode file 2009-07-05 10:44:20 +09:00
bmap.h nilfs2: support contiguous lookup of blocks 2009-06-10 23:41:12 +09:00
btnode.c nilfs2: fix preempt count underflow in nilfs_btnode_prepare_change_key 2009-08-31 12:03:06 +09:00
btnode.h nilfs2: use device's backing_dev_info for btree node caches 2009-06-10 23:41:12 +09:00
btree.c nilfs2: support contiguous lookup of blocks 2009-06-10 23:41:12 +09:00
btree.h nilfs2: remove nilfs_btree_operations from btree mapping 2009-06-10 23:41:11 +09:00
cpfile.c nilfs2: fix disorder in cp count on error during deleting checkpoints 2009-07-05 10:44:20 +09:00
cpfile.h nilfs2: allow future expansion of metadata read out via get info ioctl 2009-06-10 23:41:11 +09:00
dat.c nilfs2: fix incorrect KERN_CRIT messages in case of write failures 2009-07-05 10:44:20 +09:00
dat.h nilfs2: allow future expansion of metadata read out via get info ioctl 2009-06-10 23:41:11 +09:00
dir.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
direct.c nilfs2: support contiguous lookup of blocks 2009-06-10 23:41:12 +09:00
direct.h nilfs2: remove nilfs_direct_operations from direct mapping 2009-06-10 23:41:11 +09:00
file.c nilfs2: use unlocked_ioctl 2009-04-07 08:31:19 -07:00
gcdat.c nilfs2: another dat for garbage collection 2009-04-07 08:31:16 -07:00
gcinode.c nilfs2: add sync_page method to page caches of meta data 2009-06-10 23:41:12 +09:00
ifile.c nilfs2: inode map file 2009-04-07 08:31:14 -07:00
ifile.h nilfs2: inode map file 2009-04-07 08:31:14 -07:00
inode.c nilfs2: fix ignored error code in __nilfs_read_inode() 2009-09-14 18:27:12 +09:00
ioctl.c nilfs2: allow future expansion of metadata read out via get info ioctl 2009-06-10 23:41:11 +09:00
Kconfig fs/Kconfig: move nilfs2 out 2009-07-14 12:34:17 +09:00
Makefile nilfs2: update makefile and Kconfig 2009-04-07 08:31:16 -07:00
mdt.c nilfs2: use semaphore to protect pointer to a writable FS-instance 2009-09-14 18:27:13 +09:00
mdt.h nilfs2: meta data file 2009-04-07 08:31:13 -07:00
namei.c nilfs2: avoid double error caused by nilfs_transaction_end 2009-04-07 08:31:17 -07:00
nilfs.h switch nilfs2 to inode->i_acl 2009-06-24 08:17:05 -04:00
page.c nilfs2: ensure to clear dirty state when deleting metadata file block 2009-05-10 17:04:42 +09:00
page.h nilfs2: buffer and page operations 2009-04-07 08:31:13 -07:00
recovery.c nilfs2: fix format string compile warning (ino_t) 2009-09-14 18:27:13 +09:00
sb.h nilfs2: simplify remaining sget() use 2009-06-11 21:36:18 -04:00
segbuf.c nilfs2: set bio unplug flag for the last bio in segment 2009-06-10 23:41:11 +09:00
segbuf.h nilfs2: simplify handling of active state of segments 2009-04-07 08:31:20 -07:00
segment.c nilfs2: fix oops due to inconsistent state in page with discrete b-tree nodes 2009-08-01 22:48:32 +09:00
segment.h nilfs2: remove header file for segment list operations 2009-06-10 23:41:09 +09:00
sufile.c nilfs2: allow future expansion of metadata read out via get info ioctl 2009-06-10 23:41:11 +09:00
sufile.h nilfs2: allow future expansion of metadata read out via get info ioctl 2009-06-10 23:41:11 +09:00
super.c nilfs2: missing a read lock for segment writer in nilfs_attach_checkpoint() 2009-08-18 17:32:27 +09:00
the_nilfs.c nilfs2: use semaphore to protect pointer to a writable FS-instance 2009-09-14 18:27:13 +09:00
the_nilfs.h nilfs2: use semaphore to protect pointer to a writable FS-instance 2009-09-14 18:27:13 +09:00