2009-06-12 01:45:19

by Al Viro

[permalink] [raw]
Subject: [git pull] vfs patches, part 1

All sorts of stuff, from more people than usual. Among other stuff:
* sanitizing superblock methods (me, hch, Jan Kara)
* more pushing of lock_super() and BKL down into fs (by now only ->get_sb()
has the latter held by caller and nothing in VFS touches the former) (me,
hch, Alessio Igor Bogani)
* ->fsync() sanitizing and fixes (tangentially related to sb methods work;
file_fsync() must die and it's getting on the way to extinction)
* _very_ welcome speedup of mnt_want_write() from Nick Piggin
* solution for Trond's "nfs wants to have pathname resolution starting
at isolate vfsmount, with automounting" problem

Please, pull from
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/ for-linus

Shortlog:
Al Viro (36):
Get rid of path_lookup in autofs4
Preparations to caching root in path_walk()
Cache root in nameidata
Make vfs_path_lookup() use starting point as root
Don't bother with check_mnt() in do_add_mount() on shrinkable ones
nfsd struct path use: exp_get_by_name()
switch exp_parent() to struct path
switch rqst_exp_get_by_name()
switch rqst_exp_parent()
switch follow_up() to struct path
Switch collect_mounts() to struct path
switch follow_down()
switch follow_mount()
switch lookup_mnt()
Move junk from proc_fs.h to fs/proc/internal.h
Make sure that all callers of remount hold s_umount exclusive
Trim a bit of crap from fs.h
No need to do lock_super() for exclusion in generic_shutdown_super()
Push lock_super() into the ->remount_fs() of filesystems that care about it
Push BKL into do_mount()
Push BKL down beyond VFS-only parts of do_mount()
Push BKL down into do_remount_sb()
New helper - simple_fsync()
Sanitize qnx4 fsync handling
fs/qnx4: sanitize includes
Sanitize ->fsync() for FAT
switch ext2 to simple_fsync()
switch minix to simple_fsync()
repair sysv_write_inode(), switch sysv to simple_fsync()
switch ufs to simple_fsync()
switch udf to simple_fsync()
switch omfs to simple_fsync()
repair adfs ->write_inode(), switch to simple_fsync()
Fix adfs GET_FRAG_ID() on big-endian
repair bfs_write_inode(), switch bfs to simple_fsync()
sanitize ->fsync() for affs

Alessio Igor Bogani (1):
Push BKL down into ->remount_fs()

Alexey Dobriyan (1):
dcache: extrace and use d_unlinked()

Christoph Hellwig (26):
remove s_async_list
quota: cleanup dquota sync functions (version 4)
btrfs: remove ->write_super and stop maintaining ->s_dirt
ext3: remove ->write_super and stop maintaining ->s_dirt
gfs2: remove ->write_super and stop maintaining ->s_dirt
ocfs2: remove ->write_super and stop maintaining ->s_dirt
qnx4: remove ->write_super
remove ->write_super call in generic_shutdown_super
cleanup sync_supers
enforce ->sync_fs is only called for rw superblock
push BKL down into ->put_super
jffs2: move jffs2_write_super to super.c
->write_super lock_super pushdown
xfs: remove ->write_super and stop maintaining ->s_dirt
affs: add ->sync_fs
bfs: add ->sync_fs
exofs: add ->sync_fs
ext2: add ->sync_fs
fat: add ->sync_fs
hfs: add ->sync_fs
hfsplus: add ->sync_fs
sysv: add ->sync_fs
ufs: add ->sync_fs
jffs2: call jffs2_write_super from jffs2_sync_fs
nilfs2: call nilfs2_write_super from nilfs2_sync_fs
remove the call to ->write_super in __sync_filesystem

Jan Kara (7):
vfs: Fix sys_sync() and fsync_super() reliability (version 4)
vfs: Call ->sync_fs() even if s_dirt is 0 (version 4)
vfs: Make __fsync_super() a static function (version 4)
vfs: Make sys_sync() use fsync_super() (version 4)
vfs: Move syncing code from super.c to sync.c (version 4)
vfs: Rename fsync_super() to sync_filesystem() (version 4)
quota: Introduce writeout_quota_sb() (version 4)

Jeff Mahoney (1):
reiserfs: allow exposing privroot w/ xattrs enabled

Jens Axboe (1):
ntfs: remove old debug check for dirty data in ntfs_put_super()

Mike Frysinger (1):
linux/magic.h: move cramfs magic out of cramfs_fs.h

Nick Piggin (5):
fs: remove incorrect I_NEW warnings
fs: block_dump missing dentry locking
fs: mnt_want_write speedup
fs: introduce mnt_clone_write
fs: move mark_files_ro into file_table.c

Ryusuke Konishi (6):
nilfs2: remove meaningless EBUSY case from nilfs_get_sb function
nilfs2: get rid of sget use for acquiring nilfs object
nilfs2: get rid of sget use for checking if current mount is present
nilfs2: simplify remaining sget() use
nilfs2: correct exclusion control in nilfs_remount function
nilfs2: get rid of bd_mount_sem use from nilfs

Theodore Ts'o (2):
fs: Remove i_cindex from struct inode
fs: Rearrange inode structure elements to avoid waste due to padding

Diffstat:
arch/alpha/kernel/osf_sys.c | 3 -
drivers/ieee1394/dv1394.c | 5 +-
drivers/ieee1394/ieee1394_core.h | 6 +-
drivers/usb/core/inode.c | 5 +
fs/adfs/adfs.h | 4 +-
fs/adfs/dir.c | 10 +-
fs/adfs/dir_f.c | 17 ++
fs/adfs/dir_fplus.c | 17 ++
fs/adfs/file.c | 2 +-
fs/adfs/inode.c | 4 +-
fs/adfs/map.c | 2 +-
fs/adfs/super.c | 4 +
fs/affs/affs.h | 1 +
fs/affs/dir.c | 2 +-
fs/affs/file.c | 14 ++-
fs/affs/super.c | 54 +++++--
fs/afs/mntpt.c | 2 +-
fs/afs/super.c | 4 +
fs/autofs/dirhash.c | 5 +-
fs/autofs4/autofs_i.h | 6 +-
fs/autofs4/dev-ioctl.c | 195 +++++++----------------
fs/autofs4/expire.c | 15 +-
fs/autofs4/root.c | 7 +-
fs/befs/linuxvfs.c | 5 +-
fs/bfs/dir.c | 8 +-
fs/bfs/inode.c | 52 +++++--
fs/block_dev.c | 19 ++-
fs/btrfs/inode.c | 7 -
fs/btrfs/super.c | 11 --
fs/cachefiles/interface.c | 4 +-
fs/char_dev.c | 14 ++-
fs/cifs/cifs_dfs_ref.c | 2 +-
fs/cifs/cifsfs.c | 6 +-
fs/compat.c | 2 -
fs/dcache.c | 7 +-
fs/ecryptfs/super.c | 5 +
fs/exofs/super.c | 25 +++-
fs/ext2/Makefile | 2 +-
fs/ext2/dir.c | 2 +-
fs/ext2/ext2.h | 3 -
fs/ext2/file.c | 4 +-
fs/ext2/fsync.c | 50 ------
fs/ext2/inode.c | 11 +-
fs/ext2/super.c | 60 +++++--
fs/ext3/balloc.c | 3 +-
fs/ext3/ialloc.c | 3 +-
fs/ext3/inode.c | 1 -
fs/ext3/resize.c | 2 -
fs/ext3/super.c | 34 ++---
fs/ext3/xattr.c | 1 -
fs/ext4/super.c | 16 ++-
fs/fat/dir.c | 16 +-
fs/fat/fat.h | 6 +
fs/fat/fatent.c | 13 +-
fs/fat/file.c | 14 ++-
fs/fat/inode.c | 31 ++++-
fs/fat/namei_msdos.c | 4 +-
fs/fat/namei_vfat.c | 4 +-
fs/file_table.c | 40 +++++-
fs/freevxfs/vxfs_super.c | 4 +
fs/fs-writeback.c | 92 +++--------
fs/gfs2/log.c | 2 -
fs/gfs2/super.c | 15 +--
fs/hfs/super.c | 23 +++-
fs/hfsplus/super.c | 25 +++-
fs/hpfs/super.c | 12 ++
fs/inode.c | 2 +-
fs/internal.h | 17 ++
fs/isofs/inode.c | 5 +
fs/jffs2/fs.c | 18 +--
fs/jffs2/os-linux.h | 1 -
fs/jffs2/super.c | 26 +++
fs/jfs/super.c | 27 +++-
fs/libfs.c | 25 +++
fs/minix/dir.c | 2 +-
fs/minix/file.c | 20 +---
fs/minix/inode.c | 37 ++---
fs/minix/minix.h | 2 -
fs/namei.c | 129 +++++++++------
fs/namespace.c | 327 ++++++++++++++++----------------------
fs/ncpfs/inode.c | 4 +
fs/nfs/namespace.c | 2 +-
fs/nfs/super.c | 2 +
fs/nfsd/export.c | 78 ++++------
fs/nfsd/vfs.c | 54 +++---
fs/nilfs2/cpfile.c | 6 +-
fs/nilfs2/sb.h | 1 +
fs/nilfs2/super.c | 256 +++++++++++-------------------
fs/nilfs2/the_nilfs.c | 113 +++++++++++++-
fs/nilfs2/the_nilfs.h | 23 +++-
fs/ntfs/super.c | 54 +++----
fs/ocfs2/super.c | 22 +--
fs/omfs/file.c | 17 +--
fs/open.c | 4 +-
fs/proc/internal.h | 25 +++
fs/proc/proc_devtree.c | 1 +
fs/qnx4/Makefile | 2 +-
fs/qnx4/bitmap.c | 7 +-
fs/qnx4/dir.c | 9 +-
fs/qnx4/file.c | 5 +-
fs/qnx4/fsync.c | 169 --------------------
fs/qnx4/inode.c | 58 ++-----
fs/qnx4/namei.c | 13 +--
fs/qnx4/qnx4.h | 57 +++++++
fs/qnx4/truncate.c | 6 +-
fs/quota/quota.c | 25 ++--
fs/reiserfs/dir.c | 10 +-
fs/reiserfs/super.c | 33 +++--
fs/reiserfs/xattr.c | 3 +-
fs/smbfs/inode.c | 4 +
fs/squashfs/super.c | 4 +
fs/super.c | 192 ++++-------------------
fs/sync.c | 117 ++++++++++++--
fs/sysv/dir.c | 2 +-
fs/sysv/file.c | 17 +--
fs/sysv/inode.c | 75 +++++----
fs/sysv/sysv.h | 1 -
fs/ubifs/super.c | 17 ++-
fs/udf/Makefile | 2 +-
fs/udf/dir.c | 2 +-
fs/udf/file.c | 2 +-
fs/udf/fsync.c | 52 ------
fs/udf/super.c | 11 ++-
fs/udf/udfdecl.h | 3 -
fs/ufs/dir.c | 2 +-
fs/ufs/file.c | 23 +---
fs/ufs/super.c | 65 ++++++--
fs/ufs/ufs.h | 1 -
fs/xattr.c | 4 +-
fs/xfs/linux-2.6/xfs_super.c | 12 --
fs/xfs/xfs_trans.c | 2 -
include/linux/Kbuild | 2 +-
include/linux/cdev.h | 2 +
include/linux/cramfs_fs.h | 3 +-
include/linux/dcache.h | 7 +-
include/linux/fs.h | 21 +--
include/linux/magic.h | 2 +
include/linux/mount.h | 25 +++-
include/linux/namei.h | 5 +-
include/linux/nfsd/export.h | 6 +-
include/linux/proc_fs.h | 24 ---
include/linux/qnx4_fs.h | 61 -------
include/linux/quotaops.h | 20 ++-
include/linux/reiserfs_fs_sb.h | 2 +
include/linux/writeback.h | 1 -
kernel/audit_tree.c | 6 +-
kernel/cgroup.c | 3 +
147 files changed, 1707 insertions(+), 1834 deletions(-)


2009-06-12 03:14:16

by Linus Torvalds

[permalink] [raw]
Subject: Re: [git pull] vfs patches, part 1



On Fri, 12 Jun 2009, Al Viro wrote:
>
> Please, pull from
> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/ for-linus

Done. Should I be expecting the posix xattr cleanups stuff too, or will
that be for the next merge window?

Linus

2009-06-12 03:38:28

by Al Viro

[permalink] [raw]
Subject: Re: [git pull] vfs patches, part 1

On Thu, Jun 11, 2009 at 08:13:59PM -0700, Linus Torvalds wrote:
>
>
> On Fri, 12 Jun 2009, Al Viro wrote:
> >
> > Please, pull from
> > git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/ for-linus
>
> Done. Should I be expecting the posix xattr cleanups stuff too, or will
> that be for the next merge window?

Later in this one, after XFS merge. At least part of that - I've several
patches sitting in local tree on top of vfs-2.6.git#acl, but I'm still
not convinced that they are moving in the right direction. E.g. it's bloody
tempting to merge the "how to pick ACLs for new object" logics, but
journalling filesystems want to have handle/transaction id/whatnot for
what would appear to be natural fs-specific callbacks. We can deal with
that in obvious way (pass void *context, basically), but I want to look
a bit more at the results before deciding if it's worth doing.

Stuff in vfs-2.6.git#acl probably will go, but it has 3 cherry-picked
changesets and at least XFS one should go in via XFS tree.

There's other pending stuff as well (sysfs ->readdir(), etc.), so there'll
probably be a couple of merges after this one.

2009-06-16 16:19:28

by J. R. Okajima

[permalink] [raw]
Subject: Re: [git pull] vfs patches, part 1


Al Viro:
> * more pushing of lock_super() and BKL down into fs (by now only ->get_sb()
> has the latter held by caller and nothing in VFS touches the former) (me,
> hch, Alessio Igor Bogani)
:::
> Al Viro (36):
:::
> Push BKL down into do_remount_sb()
:::
> Alessio Igor Bogani (1):
> Push BKL down into ->remount_fs()

These two patches conflict, or are unmatched.
Al's patch adds one lock_kernel() call and several unlock_kernel() into
do_remount_sb(), and then Alessio's patch removes only single pair of
lock/unlock_kernel().
Finally a few unlock_kernel() are left in do_remount_sb().

I guess Alessio's base was different from Al's.


J. R. Okajima

commit 8219ce0904f57cd0893092369fbde39471cfb5a7
Author: J. R. Okajima <[email protected]>
Date: Wed Jun 17 01:16:50 2009 +0900

remove unlock_kernel() left accidentally

commit 337eb00a2c3a421999c39c94ce7e33545ee8baa7
Push BKL down into ->remount_fs()
and
commit 4aa98cf768b6f2ea4b204620d949a665959214f6
Push BKL down into do_remount_sb()

were uncorrectly merged.
The former removes one pair of lock/unlock_kernel(), but the latter adds
several unlock_kernel(). Finally a few unlock_kernel() calls left.

Signed-off-by: J. R. Okajima <[email protected]>

diff --git a/fs/super.c b/fs/super.c
index 83b4741..d40d53a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -545,24 +545,18 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
if (force)
mark_files_ro(sb);
- else if (!fs_may_remount_ro(sb)) {
- unlock_kernel();
+ else if (!fs_may_remount_ro(sb))
return -EBUSY;
- }
retval = vfs_dq_off(sb, 1);
- if (retval < 0 && retval != -ENOSYS) {
- unlock_kernel();
+ if (retval < 0 && retval != -ENOSYS)
return -EBUSY;
- }
}
remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);

if (sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data);
- if (retval) {
- unlock_kernel();
+ if (retval)
return retval;
- }
}
sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
if (remount_rw)

2009-06-16 17:31:17

by Al Viro

[permalink] [raw]
Subject: Re: [git pull] vfs patches, part 1

On Wed, Jun 17, 2009 at 01:19:09AM +0900, [email protected] wrote:

> These two patches conflict, or are unmatched.
> Al's patch adds one lock_kernel() call and several unlock_kernel() into
> do_remount_sb(), and then Alessio's patch removes only single pair of
> lock/unlock_kernel().
> Finally a few unlock_kernel() are left in do_remount_sb().

Nice catch...

Applied, will push today.

2009-06-18 14:31:05

by J. R. Okajima

[permalink] [raw]
Subject: Re: [git pull] vfs patches, part 1


Al Viro:
> Cache root in nameidata

Didn't you forget path_put() for the new member before returning in the
middle of do_filp_open()?


J. R. Okajima

----------------------------------------------------------------------
commit ccf163f67e7c4bf3890010a5a593eb62c3004a6a
Author: J. R. Okajima <[email protected]>
Date: Thu Jun 18 23:26:34 2009 +0900

vfs: nd->root in do_filp_open()

commit 2a737871108de9ba8930f7650d549f1383767f8b
"Cache root in nameidata"
introduced a new member nd->root, but forgot to put it in
do_filp_open().

Signed-off-by: J. R. Okajima <[email protected]>

diff --git a/fs/namei.c b/fs/namei.c
index 527119a..5b961eb 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1698,8 +1698,11 @@ struct file *do_filp_open(int dfd, const char *pathname,
if (error)
return ERR_PTR(error);
error = path_walk(pathname, &nd);
- if (error)
+ if (error) {
+ if (nd.root.mnt)
+ path_put(&nd.root);
return ERR_PTR(error);
+ }
if (unlikely(!audit_dummy_context()))
audit_inode(pathname, nd.path.dentry);

@@ -1759,6 +1762,8 @@ do_last:
}
filp = nameidata_to_filp(&nd, open_flag);
mnt_drop_write(nd.path.mnt);
+ if (nd.root.mnt)
+ path_put(&nd.root);
return filp;
}

@@ -1819,6 +1824,8 @@ ok:
*/
if (will_write)
mnt_drop_write(nd.path.mnt);
+ if (nd.root.mnt)
+ path_put(&nd.root);
return filp;

exit_mutex_unlock:
@@ -1859,6 +1866,8 @@ do_link:
* with "intent.open".
*/
release_open_intent(&nd);
+ if (nd.root.mnt)
+ path_put(&nd.root);
return ERR_PTR(error);
}
nd.flags &= ~LOOKUP_PARENT;

2009-06-20 00:29:17

by Linus Torvalds

[permalink] [raw]
Subject: Re: [git pull] vfs patches, part 1


Al? There does seem to be a leak there.

Linus

On Thu, 18 Jun 2009, [email protected] wrote:
>
> Didn't you forget path_put() for the new member before returning in the
> middle of do_filp_open()?
>
>
> J. R. Okajima
>
> ----------------------------------------------------------------------
> commit ccf163f67e7c4bf3890010a5a593eb62c3004a6a
> Author: J. R. Okajima <[email protected]>
> Date: Thu Jun 18 23:26:34 2009 +0900
>
> vfs: nd->root in do_filp_open()
>
> commit 2a737871108de9ba8930f7650d549f1383767f8b
> "Cache root in nameidata"
> introduced a new member nd->root, but forgot to put it in
> do_filp_open().
>
> Signed-off-by: J. R. Okajima <[email protected]>
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 527119a..5b961eb 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1698,8 +1698,11 @@ struct file *do_filp_open(int dfd, const char *pathname,
> if (error)
> return ERR_PTR(error);
> error = path_walk(pathname, &nd);
> - if (error)
> + if (error) {
> + if (nd.root.mnt)
> + path_put(&nd.root);
> return ERR_PTR(error);
> + }
> if (unlikely(!audit_dummy_context()))
> audit_inode(pathname, nd.path.dentry);
>
> @@ -1759,6 +1762,8 @@ do_last:
> }
> filp = nameidata_to_filp(&nd, open_flag);
> mnt_drop_write(nd.path.mnt);
> + if (nd.root.mnt)
> + path_put(&nd.root);
> return filp;
> }
>
> @@ -1819,6 +1824,8 @@ ok:
> */
> if (will_write)
> mnt_drop_write(nd.path.mnt);
> + if (nd.root.mnt)
> + path_put(&nd.root);
> return filp;
>
> exit_mutex_unlock:
> @@ -1859,6 +1866,8 @@ do_link:
> * with "intent.open".
> */
> release_open_intent(&nd);
> + if (nd.root.mnt)
> + path_put(&nd.root);
> return ERR_PTR(error);
> }
> nd.flags &= ~LOOKUP_PARENT;
>