android_kernel_motorola_sm6225/fs
Jiri Kosina c949d4eb40 [PATCH] autofs: fix error code path in autofs_fill_sb()
When kernel is compiled with old version of autofs (CONFIG_AUTOFS_FS), and
new (observed at least with 5.x.x) automount deamon is started, kernel
correctly reports incompatible version of kernel and userland daemon, but
then screws things up instead of correct handling of the error:

 autofs: kernel does not match daemon version
 =====================================
 [ BUG: bad unlock balance detected! ]
 -------------------------------------
 automount/4199 is trying to release lock (&type->s_umount_key) at:
 [<c0163b9e>] get_sb_nodev+0x76/0xa4
 but there are no more locks to release!

 other info that might help us debug this:
 no locks held by automount/4199.

 stack backtrace:
  [<c0103b15>] dump_trace+0x68/0x1b2
  [<c0103c77>] show_trace_log_lvl+0x18/0x2c
  [<c01041db>] show_trace+0xf/0x11
  [<c010424d>] dump_stack+0x12/0x14
  [<c012e02c>] print_unlock_inbalance_bug+0xe7/0xf3
  [<c012fd4f>] lock_release+0x8d/0x164
  [<c012b452>] up_write+0x14/0x27
  [<c0163b9e>] get_sb_nodev+0x76/0xa4
  [<c0163689>] vfs_kern_mount+0x83/0xf6
  [<c016373e>] do_kern_mount+0x2d/0x3e
  [<c017513f>] do_mount+0x607/0x67a
  [<c0175224>] sys_mount+0x72/0xa4
  [<c0102b96>] sysenter_past_esp+0x5f/0x99
 DWARF2 unwinder stuck at sysenter_past_esp+0x5f/0x99
 Leftover inexact backtrace:
  =======================

and then deadlock comes.

The problem: autofs_fill_super() returns EINVAL to get_sb_nodev(), but
before that, it calls kill_anon_super() to destroy the superblock which
won't be needed.  This is however way too soon to call kill_anon_super(),
because get_sb_nodev() has to perform its own cleanup of the superblock
first (deactivate_super(), etc.).  The correct time to call
kill_anon_super() is in the autofs_kill_sb() callback, which is called by
deactivate_super() at proper time, when the superblock is ready to be
killed.

I can see the same faulty codepath also in autofs4.  This patch solves
issues in both filesystems in a same way - it postpones the
kill_anon_super() until the proper time is signalized by deactivate_super()
calling the kill_sb() callback.

[raven@themaw.net: update comment]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Ian Kent <raven@themaw.net>
Cc: <stable@kernel.org>
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:43 -08:00
..
9p [PATCH] Function v9fs_get_idpool returns int, not u32 as called twice in fs/9p/vfs_inode.c 2006-12-07 08:39:33 -08:00
adfs [PATCH] fs/*: trivial vsnprintf() conversion 2006-12-07 08:39:35 -08:00
affs [PATCH] fs/*: trivial vsnprintf() conversion 2006-12-07 08:39:35 -08:00
afs [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
autofs [PATCH] autofs: fix error code path in autofs_fill_sb() 2006-12-07 08:39:43 -08:00
autofs4 [PATCH] autofs: fix error code path in autofs_fill_sb() 2006-12-07 08:39:43 -08:00
befs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
bfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
cifs [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
coda [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
configfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
cramfs [PATCH] corrupted cramfs filesystems cause kernel oops 2006-12-07 08:39:36 -08:00
debugfs [PATCH] debugfs: add header file 2006-11-25 13:28:33 -08:00
devpts [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
dlm [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
ecryptfs [PATCH] make ecryptfs_version_str_map[] static 2006-12-07 08:39:39 -08:00
efs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
exportfs [PATCH] VFS: Make filldir_t and struct kstat deal in 64-bit inode numbers 2006-10-03 08:03:40 -07:00
ext2 [PATCH] protect ext2 ioctl modifying append_only immutable etc with i_mutex 2006-12-07 08:39:37 -08:00
ext3 [PATCH] ext3: fix reservation extension 2006-12-07 08:39:39 -08:00
ext4 [PATCH] ext4 balloc: fix _with_rsv freeze 2006-12-07 08:39:43 -08:00
fat [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
freevxfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
fuse [PATCH] fuse: fix compile without CONFIG_BLOCK 2006-12-07 08:39:32 -08:00
gfs2 [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
hfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
hfsplus [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
hostfs [PATCH] Streamline generic_file_* interfaces and filemap cleanups 2006-10-01 00:39:28 -07:00
hpfs [PATCH] hpfs: fix printk format warnings 2006-12-07 08:39:35 -08:00
hppfs [PATCH] hppfs: readdir callback missed in prototype change 2006-10-09 14:19:08 -07:00
hugetlbfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
isofs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
jbd [PATCH] make fs/jbd/transaction.c:__journal_temp_unlink_buffer() static 2006-12-07 08:39:40 -08:00
jbd2 [PATCH] jbd2: wait for already submitted t_sync_datalist buffer to complete 2006-12-07 08:39:42 -08:00
jffs [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
jffs2 [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
jfs [PATCH] fs/*: trivial vsnprintf() conversion 2006-12-07 08:39:35 -08:00
lockd [PATCH] fs/lockd/host.c: make 2 functions static 2006-12-07 08:39:40 -08:00
minix [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
msdos [PATCH] fat: add fat_getattr() 2006-11-16 11:43:38 -08:00
ncpfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
nfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
nfs_common [PATCH] nfs_common endianness annotations 2006-10-20 10:26:41 -07:00
nfsd [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
nls fix file specification in comments 2006-10-03 23:01:26 +02:00
ntfs [PATCH] slab: remove SLAB_NOFS 2006-12-07 08:39:23 -08:00
ocfs2 [PATCH] fs/*: trivial vsnprintf() conversion 2006-12-07 08:39:35 -08:00
openpromfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
partitions [PATCH] Fix check_partition routines 2006-12-07 08:39:30 -08:00
proc [PATCH] make fs/proc/base.c:proc_pid_instantiate() static 2006-12-07 08:39:40 -08:00
qnx4 [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
ramfs [PATCH] r/o bind mount prepwork: inc_nlink() helper 2006-10-01 00:39:30 -07:00
reiserfs [PATCH] reiserfs: do not add save links for O_DIRECT writes 2006-12-07 08:39:42 -08:00
romfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
smbfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
sysfs [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
sysv [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
udf [PATCH] fs/*: trivial vsnprintf() conversion 2006-12-07 08:39:35 -08:00
ufs [PATCH] fs/*: trivial vsnprintf() conversion 2006-12-07 08:39:35 -08:00
vfat [PATCH] fat: add fat_getattr() 2006-11-16 11:43:38 -08:00
xfs [PATCH] Use freezeable workqueues in XFS 2006-12-07 08:39:29 -08:00
aio.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
attr.c
bad_inode.c [PATCH] Remove readv/writev methods and use aio_read/aio_write instead 2006-10-01 00:39:28 -07:00
binfmt_aout.c [PATCH] Require mmap handler for a.out executables 2006-09-29 09:18:08 -07:00
binfmt_elf.c [PATCH] elf: Always define elf_addr_t in linux/elf.h 2006-12-07 08:39:38 -08:00
binfmt_elf_fdpic.c [PATCH] elf: Always define elf_addr_t in linux/elf.h 2006-12-07 08:39:38 -08:00
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c [PATCH] Fix unserialized task->files changing 2006-09-29 09:18:12 -07:00
binfmt_script.c
binfmt_som.c [PARISC] Fix fs/binfmt_som.c 2006-10-04 06:51:26 -06:00
bio.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
block_dev.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
buffer.c [PATCH] hotplug CPU: clean up hotcpu_notifier() use 2006-12-07 08:39:39 -08:00
char_dev.c [PATCH] BLOCK: Move extern declarations out of fs/*.c into header files [try #6] 2006-09-30 20:52:18 +02:00
compat.c [PATCH] compat: fix uaccess handling 2006-12-07 08:39:33 -08:00
compat_ioctl.c [PATCH] compat: fix uaccess handling 2006-12-07 08:39:33 -08:00
dcache.c [PATCH] dcache: avoid RCU for never-hashed dentries 2006-12-07 08:39:41 -08:00
dcookies.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
direct-io.c
dnotify.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
dquot.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
drop_caches.c
eventpoll.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
exec.c [PATCH] slab: remove SLAB_KERNEL 2006-12-07 08:39:24 -08:00
fcntl.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
fifo.c
file.c [PATCH] file: kill unnecessary timer in fdtable_defer 2006-12-07 08:39:32 -08:00
file_table.c [PATCH] file: modify struct fown_struct to use a struct pid 2006-10-02 07:57:14 -07:00
filesystems.c [PATCH] Ban register_filesystem(NULL); 2006-09-29 09:18:20 -07:00
fs-writeback.c [PATCH] BLOCK: Remove dependence on existence of blockdev_superblock [try #6] 2006-09-30 20:52:26 +02:00
generic_acl.c [PATCH] Generic infrastructure for acls 2006-09-29 09:18:24 -07:00
inode.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
inotify.c [PATCH] severing fs.h, radix-tree.h -> sched.h 2006-12-04 02:00:24 -05:00
inotify_user.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
internal.h [PATCH] CONFIG_BLOCK internal.h cleanups 2006-09-30 20:52:32 +02:00
ioctl.c
ioprio.c [PATCH] block layer: ioprio_best function fix 2006-10-12 15:09:51 +02:00
Kconfig Fix typos in doc and comments 2006-11-30 05:32:19 +01:00
Kconfig.binfmt
libfs.c [PATCH] r/o bind mount prepwork: inc_nlink() helper 2006-10-01 00:39:30 -07:00
locks.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
Makefile [PATCH] jbd2: enable building of jbd2 and have ext4 use it rather than jbd 2006-10-11 11:14:16 -07:00
mbcache.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
mpage.c [PATCH] BLOCK: Dissociate generic_writepages() from mpage stuff [try #6] 2006-09-30 20:52:26 +02:00
namei.c [PATCH] VFS: extra check inside dentry_unhash() 2006-12-07 08:39:35 -08:00
namespace.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
nfsctl.c
no-block.c [PATCH] BLOCK: Make it possible to disable the block layer [try #6] 2006-09-30 20:52:31 +02:00
open.c [PATCH] r/o bind mounts: prepare for write access checks: collapse if() 2006-10-01 00:39:30 -07:00
pipe.c [PATCH] don't insert pipe dentries into dentry_hashtable. 2006-12-07 08:39:41 -08:00
pnode.c
pnode.h
posix_acl.c [PATCH] kmemdup: some users 2006-10-01 00:39:19 -07:00
quota.c [PATCH] BLOCK: Make it possible to disable the block layer [try #6] 2006-09-30 20:52:31 +02:00
quota_v1.c
quota_v2.c
read_write.c [PATCH] Add vector AIO support 2006-10-01 00:39:29 -07:00
read_write.h [PATCH] Remove readv/writev methods and use aio_read/aio_write instead 2006-10-01 00:39:28 -07:00
readdir.c [PATCH] VFS: Make filldir_t and struct kstat deal in 64-bit inode numbers 2006-10-03 08:03:40 -07:00
select.c [PATCH] enforce RLIMIT_NOFILE in poll() 2006-09-29 09:18:23 -07:00
seq_file.c
splice.c [PATCH] splice: fix problem introduced with inode diet 2006-11-04 08:45:39 -08:00
stat.c [PATCH] vfs_getattr(): remove dead code 2006-12-07 08:39:35 -08:00
super.c [PATCH] severing fs.h, radix-tree.h -> sched.h 2006-12-04 02:00:24 -05:00
sync.c [PATCH] severing fs.h, radix-tree.h -> sched.h 2006-12-04 02:00:24 -05:00
utimes.c [PATCH] severing fs.h, radix-tree.h -> sched.h 2006-12-04 02:00:24 -05:00
xattr.c [PATCH] Fix user.* xattr permission check for sticky dirs 2006-11-03 12:27:59 -08:00
xattr_acl.c