nilfs2: fix circular locking dependency of writer mutex
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Tue, 28 Apr 2009 12:04:59 +0000 (21:04 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Sat, 9 May 2009 04:36:57 +0000 (13:36 +0900)
commit201913ed746c7724a40d33ee5a0b6a1fd2ef3193
tree149cd7552a854055a2ed278234649a77914aaf96
parent85c2a74fabadfc561b75fbd7decc6bcbfe873d57
nilfs2: fix circular locking dependency of writer mutex

This fixes the following circular locking dependency problem:

 =======================================================
 [ INFO: possible circular locking dependency detected ]
 2.6.30-rc3 #5
 -------------------------------------------------------
 segctord/3895 is trying to acquire lock:
  (&nilfs->ns_writer_mutex){+.+...}, at: [<d0d02172>]
   nilfs_mdt_get_block+0x89/0x20f [nilfs2]

 but task is already holding lock:
  (&bmap->b_sem){++++..}, at: [<d0d02d99>]
   nilfs_bmap_propagate+0x14/0x2e [nilfs2]

 which lock already depends on the new lock.

The bugfix is done by replacing call sites of nilfs_get_writer() which
are never called from read-only context with direct dereferencing of
pointer to a writable FS-instance.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
fs/nilfs2/ioctl.c
fs/nilfs2/mdt.c