kernel-fxtec-pro1x/fs/nilfs2
Ryusuke Konishi a924586036 nilfs2: fix oopses with doubly mounted snapshots
will fix kernel oopses like the following:

 # mount -t nilfs2 -r -o cp=20 /dev/sdb1 /test1
 # mount -t nilfs2 -r -o cp=20 /dev/sdb1 /test2
 # umount /test1
 # umount /test2

BUG: sleeping function called from invalid context at arch/x86/mm/fault.c:1069
in_atomic(): 0, irqs_disabled(): 1, pid: 3886, name: umount.nilfs2
1 lock held by umount.nilfs2/3886:
 #0:  (&type->s_umount_key#31){+.+...}, at: [<c10b398a>] deactivate_super+0x52/0x6c
irq event stamp: 1219
hardirqs last  enabled at (1219): [<c135c774>] __mutex_unlock_slowpath+0xf8/0x119
hardirqs last disabled at (1218): [<c135c6d5>] __mutex_unlock_slowpath+0x59/0x119
softirqs last  enabled at (1214): [<c1033316>] __do_softirq+0x1a5/0x1ad
softirqs last disabled at (1205): [<c1033354>] do_softirq+0x36/0x5a
Pid: 3886, comm: umount.nilfs2 Not tainted 2.6.31-rc6 #55
Call Trace:
 [<c1023549>] __might_sleep+0x107/0x10e
 [<c13603c0>] do_page_fault+0x246/0x397
 [<c136017a>] ? do_page_fault+0x0/0x397
 [<c135e753>] error_code+0x6b/0x70
 [<c136017a>] ? do_page_fault+0x0/0x397
 [<c104f805>] ? __lock_acquire+0x91/0x12fd
 [<c1050a62>] ? __lock_acquire+0x12ee/0x12fd
 [<c1050a62>] ? __lock_acquire+0x12ee/0x12fd
 [<c1050b2b>] lock_acquire+0xba/0xdd
 [<d0d17d3f>] ? nilfs_detach_segment_constructor+0x2f/0x2fa [nilfs2]
 [<c135d4fe>] down_write+0x2a/0x46
 [<d0d17d3f>] ? nilfs_detach_segment_constructor+0x2f/0x2fa [nilfs2]
 [<d0d17d3f>] nilfs_detach_segment_constructor+0x2f/0x2fa [nilfs2]
 [<c104ea2c>] ? mark_held_locks+0x43/0x5b
 [<c104ecb1>] ? trace_hardirqs_on_caller+0x10b/0x133
 [<c104ece4>] ? trace_hardirqs_on+0xb/0xd
 [<d0d09ac1>] nilfs_put_super+0x2f/0xca [nilfs2]
 [<c10b3352>] generic_shutdown_super+0x49/0xb8
 [<c10b33de>] kill_block_super+0x1d/0x31
 [<c10e6599>] ? vfs_quota_off+0x0/0x12
 [<c10b398f>] deactivate_super+0x57/0x6c
 [<c10c4bc3>] mntput_no_expire+0x8c/0xb4
 [<c10c5094>] sys_umount+0x27f/0x2a4
 [<c10c50c6>] sys_oldumount+0xd/0xf
 [<c10031a4>] sysenter_do_call+0x12/0x38
 ...

This turns out to be a bug brought by an -rc1 patch ("nilfs2: simplify
remaining sget() use").

In the patch, a new "put resource" function, nilfs_put_sbinfo()
was introduced to delay freeing nilfs_sb_info struct.

But the nilfs_put_sbinfo() mistakenly used atomic_dec_and_test()
function to check the reference count, and it caused the nilfs_sb_info
was freed when user mounted a snapshot twice.

This bug also suggests there was unseen memory leak in usual mount
/umount operations for nilfs.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2009-08-19 02:10: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.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
bmap_union.h
btnode.c nilfs2: add sync_page method to page caches of meta data 2009-06-10 23:41:12 +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 switch nilfs2 to inode->i_acl 2009-06-24 08:17:05 -04: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: fix missing unlock in error path of nilfs_mdt_write_page 2009-08-02 22:24:15 +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: remove header file for segment list operations 2009-06-10 23:41:09 +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 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2 2009-06-15 09:13:49 -07:00
the_nilfs.h nilfs2: fix oopses with doubly mounted snapshots 2009-08-19 02:10:13 +09:00