linux/fs
Al Viro 7b7b1ace2d [PATCH] saner handling of auto_acct_off() and DQUOT_OFF() in umount
The way we currently deal with quota and process accounting that might
keep vfsmount busy at umount time is inherently broken; we try to turn
them off just in case (not quite correctly, at that) and

  a) pray umount doesn't fail (otherwise they'll stay turned off)
  b) pray nobody doesn anything funny just as we turn quota off

Moreover, LSM provides hooks for doing the same sort of broken logics.

The proper way to deal with that is to introduce the second kind of
reference to vfsmount.  Semantics:

 - when the last normal reference is dropped, all special ones are
   converted to normal ones and if there had been any, cleanup is done.
 - normal reference can be cloned into a special one
 - special reference can be converted to normal one; that's a no-op if
   we'd already passed the point of no return (i.e.  mntput() had
   converted special references to normal and started cleanup).

The way it works: e.g. starting process accounting converts the vfsmount
reference pinned by the opened file into special one and turns it back
to normal when it gets shut down; acct_auto_close() is done when no
normal references are left.  That way it does *not* obstruct umount(2)
and it silently gets turned off when the last normal reference to
vfsmount is gone.  Which is exactly what we want...

The same should be done by LSM module that holds some internal
references to vfsmount and wants to shut them down on umount - it should
make them special and security_sb_umount_close() will be called exactly
when the last normal reference to vfsmount is gone.

quota handling is even simpler - we don't use normal file IO anymore, so
there's no need to hold vfsmounts at all.  DQUOT_OFF() is done from
deactivate_super(), where it really belongs.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 18:18:09 -08:00
..
9p [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
adfs [ARM] fs/adfs/adfs.h: "extern inline" doesn't make sense 2005-08-20 17:20:28 +01:00
affs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
afs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
autofs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
autofs4 [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
befs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
bfs [PATCH] bfs iget() abuses 2005-10-04 13:22:01 -07:00
cifs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
coda [PATCH] Driver Core: fix up all callers of class_device_create() 2005-10-28 09:52:52 -07:00
cramfs [PATCH] fs/cramfs/uncompress.c should #include <linux/cramfs_fs.h> 2005-09-10 10:06:35 -07:00
debugfs [PATCH] remove duplicate get_dentry functions in various places 2005-06-23 09:45:20 -07:00
devfs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
devpts [PATCH] Generic VFS fallback for security xattrs 2005-09-05 00:05:52 -07:00
efs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
exportfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ext2 [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
ext3 [PATCH] Test for sb_getblk return value 2005-10-30 17:37:26 -08:00
fat [PATCH] fat: Remove duplicate directory scanning code 2005-10-30 17:37:32 -08:00
freevxfs [PATCH] vxfs: use generic_ro_fops 2005-11-07 07:53:41 -08:00
fuse [PATCH] FUSE: pass file handle in setattr 2005-11-07 07:53:42 -08:00
hfs [PATCH] gfp_t: fs/* 2005-10-28 08:16:47 -07:00
hfsplus [PATCH] gfp_t: fs/* 2005-10-28 08:16:47 -07:00
hostfs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
hpfs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
hppfs [PATCH] hppfs: fix symlink error path 2005-08-26 11:39:19 -07:00
hugetlbfs [PATCH] hugetlb: overcommit accounting check 2005-10-29 21:40:43 -07:00
isofs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
jbd [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
jffs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
jffs2 Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6 2005-11-07 10:24:08 -08:00
jfs [PATCH] mm: split page table lock 2005-10-29 21:40:42 -07:00
lockd [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
minix [PATCH] update filesystems for new delete_inode behavior 2005-09-09 13:57:27 -07:00
msdos [PATCH] fat: remove the unneeded vfat_find() in vfat_rename() 2005-10-30 17:37:32 -08:00
ncpfs [PATCH] update filesystems for new delete_inode behavior 2005-09-09 13:57:27 -07:00
nfs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
nfs_common [PATCH] nfsacl: Solaris VxFS compatibility fix 2005-10-11 09:46:54 -07:00
nfsd [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
nls [PATCH] make some things static 2005-05-05 16:36:47 -07:00
ntfs NTFS: Fix a stupid bug causing writes to non-initialized pages to segfault. 2005-11-01 15:49:31 +00:00
openpromfs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
partitions [PATCH] s390: cleanup of include/asm-s390/vtoc.h 2005-11-07 07:53:34 -08:00
proc Merge ../linux-2.6 by hand 2005-10-31 13:37:12 +11:00
qnx4 [PATCH] update filesystems for new delete_inode behavior 2005-09-09 13:57:27 -07:00
ramfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
reiserfs [PATCH] reiserfs: [kv]free() checking cleanup 2005-10-30 17:37:17 -08:00
relayfs [PATCH] relayfs: fix bogus param value in call to vmap 2005-10-10 08:39:50 -07:00
romfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
smbfs [PATCH] smbfs: 'names_cache' memory leak 2005-11-07 07:53:39 -08:00
sysfs [PATCH] Fix oops in sysfs_hash_and_remove_file() 2005-08-26 19:37:13 -07:00
sysv [PATCH] update filesystems for new delete_inode behavior 2005-09-09 13:57:27 -07:00
udf [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
ufs [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
vfat [PATCH] fat: remove the unneeded vfat_find() in vfat_rename() 2005-10-30 17:37:32 -08:00
xfs [PATCH] mm: rename kmem_cache_s to kmem_cache 2005-11-07 07:53:24 -08:00
aio.c [PATCH] aio: remove aio_max_nr accounting race 2005-11-07 07:53:38 -08:00
attr.c [PATCH] fs/attr.c: remove BUG() 2005-10-30 17:37:27 -08:00
bad_inode.c [PATCH] make some things static 2005-05-05 16:36:47 -07:00
binfmt_aout.c [PATCH] mm: mm_init set_mm_counters 2005-10-29 21:40:38 -07:00
binfmt_elf.c [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
binfmt_elf_fdpic.c [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
binfmt_em86.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_flat.c [PATCH] mm: mm_init set_mm_counters 2005-10-29 21:40:38 -07:00
binfmt_misc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_script.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_som.c [PATCH] mm: mm_init set_mm_counters 2005-10-29 21:40:38 -07:00
bio.c [PATCH] gfp_t: fs/* 2005-10-28 08:16:47 -07:00
block_dev.c [PATCH] block: add unlocked_ioctl support for block devices 2005-06-23 09:45:32 -07:00
buffer.c [PATCH] __find_get_block_slow() cleanup 2005-11-07 07:53:39 -08:00
char_dev.c [PATCH] cdev: cdev_put oops 2005-07-12 16:01:02 -07:00
compat.c [PATCH] mm: update_hiwaters just in time 2005-10-29 21:40:39 -07:00
compat_ioctl.c [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
dcache.c [PATCH] Remove hlist_for_each_rcu() API, convert existing use to hlist_for_each_entry_rcu 2005-11-07 07:53:35 -08:00
dcookies.c [PATCH] dcookies.c: use proper refcounting functions 2005-07-07 18:23:52 -07:00
direct-io.c [PATCH] core remove PageReserved 2005-10-29 21:40:39 -07:00
dnotify.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dquot.c [PATCH] saner handling of auto_acct_off() and DQUOT_OFF() in umount 2005-11-07 18:18:09 -08:00
eventpoll.c [PATCH] epoll: handle timeout overflow 2005-09-28 07:46:41 -07:00
exec.c [PATCH] VFS: pass file pointer to filesystem from ftruncate() 2005-11-07 07:53:42 -08:00
fcntl.c [PATCH] files: lock-free fd look-up 2005-09-09 13:57:55 -07:00
fifo.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
file.c [PATCH] Fix the fdtable freeing in the case of vmalloced fdset/arrays 2005-09-14 12:38:26 -07:00
file_table.c [PATCH] mm: rename kmem_cache_s to kmem_cache 2005-11-07 07:53:24 -08:00
filesystems.c [PATCH] fix missing includes 2005-10-30 17:37:32 -08:00
fs-writeback.c [PATCH] kernel-docs: fix kernel-doc format problems 2005-11-07 07:53:55 -08:00
inode.c [PATCH] fix nr_unused accounting, and avoid recursing in iput with I_WILL_FREE set 2005-10-30 17:37:26 -08:00
inotify.c [PATCH] inotify/idr leak fix 2005-10-23 16:38:39 -07:00
ioctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ioprio.c Don't allow normal users to set idle IO priority 2005-08-20 18:51:29 -07:00
Kconfig Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6 2005-11-07 10:24:08 -08:00
Kconfig.binfmt [PATCH] CONFIG_IA32 2005-10-30 17:37:10 -08:00
libfs.c [PATCH] fix fsync(dir) return value for ram-based filesystems 2005-06-25 16:24:38 -07:00
locks.c Fix Connectathon locking test failure 2005-10-18 14:20:21 -07:00
Makefile [PATCH] FUSE - MAINTAINERS, Kconfig and Makefile changes 2005-09-09 14:03:44 -07:00
mbcache.c [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
mpage.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
namei.c [PATCH] VFS: pass file pointer to filesystem from ftruncate() 2005-11-07 07:53:42 -08:00
namespace.c [PATCH] saner handling of auto_acct_off() and DQUOT_OFF() in umount 2005-11-07 18:18:09 -08:00
nfsctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
open.c [PATCH] VFS: pass file pointer to filesystem from ftruncate() 2005-11-07 07:53:42 -08:00
pipe.c [PATCH] sched: TASK_NONINTERACTIVE 2005-09-10 10:06:22 -07:00
posix_acl.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
quota.c [PATCH] quota: small cleanups 2005-11-07 07:53:39 -08:00
quota_v1.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
quota_v2.c [PATCH] quota: possible bug in quota format v2 support 2005-04-16 15:25:47 -07:00
read_write.c [PATCH] readv/writev syscalls are not checked by lsm 2005-09-29 15:42:08 -07:00
readdir.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
select.c [PATCH] files: lock-free fd look-up 2005-09-09 13:57:55 -07:00
seq_file.c [PATCH] DocBook: fix some descriptions 2005-05-01 08:59:26 -07:00
stat.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
super.c [PATCH] saner handling of auto_acct_off() and DQUOT_OFF() in umount 2005-11-07 18:18:09 -08:00
xattr.c [PATCH] kfree cleanup: fs 2005-11-07 07:54:06 -08:00
xattr_acl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00