Skip to contentSkip to conversation

vfs pile 2 (automount work)

GIT PULL Al Viro 4 participants 8 messages Jan 16, 2011 VFS

lore
Share & tools
lore

Al Viro

author maintainer
#0 lore raw

This pile consists mostly automount patchset by dhowells plus
fixes for related mainline bugs. There's more, but I'd rather keep pull requests separate; I'll send another one tonight and there will be more on Monday. Please, pull from

git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/ for-linus

Shortlog:
Al Viro (3):
do_lookup() fix
fix old umount_tree() breakage
sanitize vfsmount refcounting changes

David Howells (11):
Add a dentry op to handle automounting rather than abusing follow_link() Add a dentry op to allow processes to be held during pathwalk transit Add an AT_NO_AUTOMOUNT flag to suppress terminal automount
AFS: Use d_automount() rather than abusing follow_link()
NFS: Use d_automount() rather than abusing follow_link()
CIFS: Use d_automount() rather than abusing follow_link() Remove the automount through follow_link() kludge code from pathwalk Remove a further kludge from __do_follow_link()
Allow d_manage() to be used in RCU-walk mode
Unexport do_add_mount() and add in follow_automount(), not ->d_automount()
autofs4: Merge the remaining dentry ops tables

Ian Kent (9):
autofs4: Add d_automount() dentry operation
autofs4: Add d_manage() dentry operation
autofs4: Remove unused code
autofs4: Clean up inode operations
autofs4: Clean up dentry operations
autofs4: Clean up autofs4_free_ino()
autofs4: Fix wait validation
autofs4: Add v4 pseudo direct mount support
autofs4: Bump version

Diffstat:

 Documentation/filesystems/Locking |    4 +
 Documentation/filesystems/vfs.txt |   43 +++
 drivers/mtd/mtdchar.c             |    2 +-
 drivers/staging/autofs/dirhash.c  |    5 +-
 fs/afs/dir.c                      |    1 +
 fs/afs/inode.c                    |    3 +-
 fs/afs/internal.h                 |    1 +
 fs/afs/mntpt.c                    |   56 +---
 fs/anon_inodes.c                  |    2 +-
 fs/autofs4/autofs_i.h             |   99 ++++--
 fs/autofs4/dev-ioctl.c            |    2 +-
 fs/autofs4/expire.c               |   51 ++--
 fs/autofs4/inode.c                |   26 +--
 fs/autofs4/root.c                 |  673 ++++++++++++++++---------------------
 fs/autofs4/waitq.c                |   17 +-
 fs/cifs/cifs_dfs_ref.c            |  120 +++----
 fs/cifs/cifsfs.h                  |    6 +
 fs/cifs/dir.c                     |    2 +
 fs/cifs/inode.c                   |    8 +-
 fs/dcache.c                       |    5 +-
 fs/fs_struct.c                    |   35 ++-
 fs/internal.h                     |    5 +
 fs/namei.c                        |  379 +++++++++++++++------
 fs/namespace.c                    |  179 +++++-----
 fs/nfs/dir.c                      |    4 +-
 fs/nfs/inode.c                    |    4 +-
 fs/nfs/internal.h                 |    1 +
 fs/nfs/namespace.c                |   79 ++---
 fs/nfsd/vfs.c                     |    5 +-
 fs/pipe.c                         |    2 +-
 fs/stat.c                         |    4 +-
 fs/super.c                        |    2 +-
 include/linux/auto_fs4.h          |    2 +-
 include/linux/dcache.h            |   16 +-
 include/linux/fcntl.h             |    1 +
 include/linux/fs.h                |    2 +
 include/linux/mount.h             |   11 +-
 include/linux/namei.h             |    5 +-
 include/linux/nfs_fs.h            |    1 -
 include/linux/path.h              |    2 -
 40 files changed, 1010 insertions(+), 855 deletions(-)
#1 lore raw

Hi,

Quoted 2 lines · Al Viro

Al Viro (3):
sanitize vfsmount refcounting changes

f03c65993b98eeb909a4012ce7833c5857d74755 - sanitize vfsmount refcounting changes

Breaks my ARM !CONFIG_SMP compile

CC fs/namespace.o
fs/namespace.c: In function 'commit_tree':
fs/namespace.c:629: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'umount_tree':
fs/namespace.c:1192: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'mnt_make_longterm':
fs/namespace.c:2246: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'mnt_make_shortterm':
fs/namespace.c:2251: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c:2254: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'dup_mnt_ns':
fs/namespace.c:2295: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c:2299: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c:2305: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'create_mnt_ns':
fs/namespace.c:2351: error: 'struct vfsmount' has no member named 'mnt_longterm' make[1]: *** [fs/namespace.o] Error 1
make: *** [fs] Error 2

My configuration is arch/arm/configs/at91rm9200_defconfig.

regards
Joachim Eastwood

author maintainer
#2 lore raw
Quoted 10 lines · Joachim Eastwood

Hi,

Quoted 2 lines · Al Viro

Al Viro (3):
sanitize vfsmount refcounting changes

f03c65993b98eeb909a4012ce7833c5857d74755 - sanitize vfsmount refcounting changes

Breaks my ARM !CONFIG_SMP compile

Quoted 16 lines

CC fs/namespace.o
fs/namespace.c: In function 'commit_tree':
fs/namespace.c:629: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'umount_tree':
fs/namespace.c:1192: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'mnt_make_longterm':
fs/namespace.c:2246: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'mnt_make_shortterm':
fs/namespace.c:2251: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c:2254: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'dup_mnt_ns':
fs/namespace.c:2295: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c:2299: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c:2305: error: 'struct vfsmount' has no member named 'mnt_longterm' fs/namespace.c: In function 'create_mnt_ns':
fs/namespace.c:2351: error: 'struct vfsmount' has no member named 'mnt_longterm'

Aaaaargh... Brown paperbag time - all testing was on SMP boxen ;-/ The fix follows. Linus, I've dropped that into for-linus in usual place
(git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/), so if you prefer to pull it, it's there.

commit 91ed228ab50daa7aca54faa8bf5208b97e3448b8

Author: Al Viro <[email protected]>
Date:   Sun Jan 16 16:32:11 2011 -0500

mnt_longterm is there only on SMP

fs/namespace.c +24 -7
index 48809e2..9f544f3 100644
@@ -611,6 +611,21 @@ static void attach_mnt(struct vfsmount *mnt, struct path *path)
 	list_add_tail(&mnt->mnt_child, &path->mnt->mnt_mounts);
 }
 
+static inline void __mnt_make_longterm(struct vfsmount *mnt)
+{
+#ifdef CONFIG_SMP
+	atomic_inc(&mnt->mnt_longterm);
+#endif
+}
+
+/* needs vfsmount lock for write */
+static inline void __mnt_make_shortterm(struct vfsmount *mnt)
+{
+#ifdef CONFIG_SMP
+	atomic_dec(&mnt->mnt_longterm);
+#endif
+}
+
 /*
  * vfsmount lock must be held for write
  */
@@ -626,7 +641,7 @@ static void commit_tree(struct vfsmount *mnt)
 	list_add_tail(&head, &mnt->mnt_list);
 	list_for_each_entry(m, &head, mnt_list) {
 		m->mnt_ns = n;
-		atomic_inc(&m->mnt_longterm);
+		__mnt_make_longterm(m);
 	}
 
 	list_splice(&head, n->list.prev);
@@ -1189,7 +1204,7 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
 		list_del_init(&p->mnt_list);
 		__touch_mnt_namespace(p->mnt_ns);
 		p->mnt_ns = NULL;
-		atomic_dec(&p->mnt_longterm);
+		__mnt_make_shortterm(p);
 		list_del_init(&p->mnt_child);
 		if (p->mnt_parent != p) {
 			p->mnt_parent->mnt_ghosts++;
@@ -2243,16 +2258,18 @@ static struct mnt_namespace *alloc_mnt_ns(void)
 
 void mnt_make_longterm(struct vfsmount *mnt)
 {
-	atomic_inc(&mnt->mnt_longterm);
+	__mnt_make_longterm(mnt);
 }
 
 void mnt_make_shortterm(struct vfsmount *mnt)
 {
+#ifdef CONFIG_SMP
 	if (atomic_add_unless(&mnt->mnt_longterm, -1, 1))
 		return;
 	br_write_lock(vfsmount_lock);
 	atomic_dec(&mnt->mnt_longterm);
 	br_write_unlock(vfsmount_lock);
+#endif
 }
 
 /*
@@ -2292,17 +2309,17 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
 	q = new_ns->root;
 	while (p) {
 		q->mnt_ns = new_ns;
-		atomic_inc(&q->mnt_longterm);
+		__mnt_make_longterm(q);
 		if (fs) {
 			if (p == fs->root.mnt) {
 				fs->root.mnt = mntget(q);
-				atomic_inc(&q->mnt_longterm);
+				__mnt_make_longterm(q);
 				mnt_make_shortterm(p);
 				rootmnt = p;
 			}
 			if (p == fs->pwd.mnt) {
 				fs->pwd.mnt = mntget(q);
-				atomic_inc(&q->mnt_longterm);
+				__mnt_make_longterm(q);
 				mnt_make_shortterm(p);
 				pwdmnt = p;
 			}
@@ -2348,7 +2365,7 @@ struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt)
 	new_ns = alloc_mnt_ns();
 	if (!IS_ERR(new_ns)) {
 		mnt->mnt_ns = new_ns;
-		atomic_inc(&mnt->mnt_longterm);
+		__mnt_make_longterm(mnt);
 		new_ns->root = mnt;
 		list_add(&new_ns->list, &new_ns->root->mnt_list);
 	}
#3 lore raw
Quoted 43 lines · Al Viro
Quoted 28 lines · Joachim Eastwood

Hi,

Quoted 2 lines · Al Viro

Al Viro (3):
sanitize vfsmount refcounting changes

f03c65993b98eeb909a4012ce7833c5857d74755 - sanitize vfsmount refcounting changes

Breaks my ARM !CONFIG_SMP compile

CC fs/namespace.o
fs/namespace.c: In function 'commit_tree':
fs/namespace.c:629: error: 'struct vfsmount' has no member named 'mnt_longterm'
fs/namespace.c: In function 'umount_tree':
fs/namespace.c:1192: error: 'struct vfsmount' has no member named 'mnt_longterm'
fs/namespace.c: In function 'mnt_make_longterm':
fs/namespace.c:2246: error: 'struct vfsmount' has no member named 'mnt_longterm'
fs/namespace.c: In function 'mnt_make_shortterm':
fs/namespace.c:2251: error: 'struct vfsmount' has no member named 'mnt_longterm'
fs/namespace.c:2254: error: 'struct vfsmount' has no member named 'mnt_longterm'
fs/namespace.c: In function 'dup_mnt_ns':
fs/namespace.c:2295: error: 'struct vfsmount' has no member named

Quoted 8 lines

'mnt_longterm'
fs/namespace.c:2299: error: 'struct vfsmount' has no member named 'mnt_longterm'
fs/namespace.c:2305: error: 'struct vfsmount' has no member named 'mnt_longterm'
fs/namespace.c: In function 'create_mnt_ns':
fs/namespace.c:2351: error: 'struct vfsmount' has no member named 'mnt_longterm'

Aaaaargh... Brown paperbag time - all testing was on SMP boxen ;-/ The fix follows. Linus, I've dropped that into for-linus in usual place
(git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/), so if you prefer to pull it, it's there.

Quoted 7 lines

commit 91ed228ab50daa7aca54faa8bf5208b97e3448b8

Author: Al Viro <[email protected]>
Date:   Sun Jan 16 16:32:11 2011 -0500

mnt_longterm is there only on SMP

Thanks,
The patch fixed it.

regards
Joachim Eastwood

#4 lore raw
In reply to Joachim Eastwood
Quoted 4 lines · Joachim Eastwood

f03c65993b98eeb909a4012ce7833c5857d74755 - sanitize vfsmount refcounting changes

Breaks my ARM !CONFIG_SMP compile

In fact, any non-SMP compile, it's not ARM-specific.

The simple fix for the build breakage should be to just move the mnt_longterm thing out of the #ifdef CONFIG_SMP in include/linux/mount.h. But I do worry that it would cause some count imbalance, because there are some accesses that are still inside that CONFIG_SMP case in mntput_no_expire().

Al, please take a look,

Linus

author maintainer
#5 lore raw
Quoted 8 lines · Linus Torvalds
Quoted 4 lines · Joachim Eastwood

f03c65993b98eeb909a4012ce7833c5857d74755 - sanitize vfsmount refcounting changes

Breaks my ARM !CONFIG_SMP compile

In fact, any non-SMP compile, it's not ARM-specific.

Quoted 7 lines

The simple fix for the build breakage should be to just move the mnt_longterm thing out of the #ifdef CONFIG_SMP in include/linux/mount.h. But I do worry that it would cause some count imbalance, because there are some accesses that are still inside that CONFIG_SMP case in mntput_no_expire().

Al, please take a look,

Already fixed. Actually, taking it out of ifdef would work (the only place that actually cares about the value of that sucker is SMP side of mntput()), but we are obviously better off just not touching it on UP at all - why do pointless work and waste space?

See the patch upthread. ->mnt_longterm is SMP-only optimization of mntput(); it's there only to free the common case of mntput() from cacheline bouncing and on UP it's needed at all.

#6 lore raw
Quoted 17 lines · Al Viro
Quoted 8 lines · Linus Torvalds
Quoted 4 lines · Joachim Eastwood

f03c65993b98eeb909a4012ce7833c5857d74755 - sanitize vfsmount refcounting changes

Breaks my ARM !CONFIG_SMP compile

In fact, any non-SMP compile, it's not ARM-specific.

Quoted 7 lines

The simple fix for the build breakage should be to just move the mnt_longterm thing out of the #ifdef CONFIG_SMP in include/linux/mount.h. But I do worry that it would cause some count imbalance, because there are some accesses that are still inside that CONFIG_SMP case in mntput_no_expire().

Al, please take a look,

Quoted 9 lines

Already fixed.  Actually, taking it out of ifdef would work (the only place that actually cares about the value of that sucker is SMP side of mntput()), but we are obviously better off just not touching it on UP at all - why do pointless work and waste space?

See the patch upthread.  ->mnt_longterm is SMP-only optimization of mntput(); it's there only to free the common case of mntput() from cacheline bouncing and on UP it's needed at all.

You push "mnt_longterm is there only on SMP" patch also for "for-next" GIT branch?

- Sedat -
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#7 lore raw
In reply to Al Viro
Quoted 8 lines · Al Viro

Already fixed. Actually, taking it out of ifdef would work (the only place that actually cares about the value of that sucker is SMP side of mntput()), but we are obviously better off just not touching it on UP at all - why do pointless work and waste space?

See the patch upthread. ->mnt_longterm is SMP-only optimization of mntput(); it's there only to free the common case of mntput() from cacheline bouncing and on UP it's needed at all.

PS: the patch does survive UP beating. Could you pull
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6.git/ for-linus ? There's only one patch at the moment:

Al Viro (1):
mnt_longterm is there only on SMP

 fs/namespace.c |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)