Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pull-automount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull automount updates from Al Viro:
"Automount wart removal

A bunch of odd boilerplate gone from instances - the reason for
those was the need to protect the yet-to-be-attched mount from
mark_mounts_for_expiry() deciding to take it out.

But that's easy to detect and take care of in mark_mounts_for_expiry()
itself; no need to have every instance simulate mount being busy by
grabbing an extra reference to it, with finish_automount() undoing
that once it attaches that mount.

Should've done it that way from the very beginning... This is a
flagday change, thankfully there are very few instances.

vfs_submount() is gone - its sole remaining user (trace_automount)
had been switched to saner primitives"

* tag 'pull-automount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
kill vfs_submount()
saner calling conventions for ->d_automount()

+27 -47
+6
Documentation/filesystems/porting.rst
··· 1243 1243 1244 1244 Using try_lookup_noperm() will require linux/namei.h to be included. 1245 1245 1246 + --- 1247 + 1248 + **mandatory** 1249 + 1250 + Calling conventions for ->d_automount() have changed; we should *not* grab 1251 + an extra reference to new mount - it should be returned with refcount 1.
+1 -3
Documentation/filesystems/vfs.rst
··· 1390 1390 1391 1391 If a vfsmount is returned, the caller will attempt to mount it 1392 1392 on the mountpoint and will remove the vfsmount from its 1393 - expiration list in the case of failure. The vfsmount should be 1394 - returned with 2 refs on it to prevent automatic expiration - the 1395 - caller will clean up the additional ref. 1393 + expiration list in the case of failure. 1396 1394 1397 1395 This function is only used if DCACHE_NEED_AUTOMOUNT is set on 1398 1396 the dentry. This is set by __d_instantiate() if S_AUTOMOUNT is
-1
fs/afs/mntpt.c
··· 189 189 if (IS_ERR(newmnt)) 190 190 return newmnt; 191 191 192 - mntget(newmnt); /* prevent immediate expiration */ 193 192 mnt_set_expiry(newmnt, &afs_vfsmounts); 194 193 queue_delayed_work(afs_wq, &afs_mntpt_expiry_timer, 195 194 afs_mntpt_expiry_timeout * HZ);
-3
fs/fuse/dir.c
··· 319 319 320 320 /* Create the submount */ 321 321 mnt = fc_mount(fsc); 322 - if (!IS_ERR(mnt)) 323 - mntget(mnt); 324 - 325 322 put_fs_context(fsc); 326 323 return mnt; 327 324 }
+3 -21
fs/namespace.c
··· 1326 1326 } 1327 1327 EXPORT_SYMBOL_GPL(vfs_kern_mount); 1328 1328 1329 - struct vfsmount * 1330 - vfs_submount(const struct dentry *mountpoint, struct file_system_type *type, 1331 - const char *name, void *data) 1332 - { 1333 - /* Until it is worked out how to pass the user namespace 1334 - * through from the parent mount to the submount don't support 1335 - * unprivileged mounts with submounts. 1336 - */ 1337 - if (mountpoint->d_sb->s_user_ns != &init_user_ns) 1338 - return ERR_PTR(-EPERM); 1339 - 1340 - return vfs_kern_mount(type, SB_SUBMOUNT, name, data); 1341 - } 1342 - EXPORT_SYMBOL_GPL(vfs_submount); 1343 - 1344 1329 static struct mount *clone_mnt(struct mount *old, struct dentry *root, 1345 1330 int flag) 1346 1331 { ··· 3874 3889 return PTR_ERR(m); 3875 3890 3876 3891 mnt = real_mount(m); 3877 - /* The new mount record should have at least 2 refs to prevent it being 3878 - * expired before we get a chance to add it 3879 - */ 3880 - BUG_ON(mnt_get_count(mnt) < 2); 3881 3892 3882 3893 if (m->mnt_sb == path->mnt->mnt_sb && 3883 3894 m->mnt_root == dentry) { ··· 3906 3925 unlock_mount(mp); 3907 3926 if (unlikely(err)) 3908 3927 goto discard; 3909 - mntput(m); 3910 3928 return 0; 3911 3929 3912 3930 discard_locked: ··· 3918 3938 list_del_init(&mnt->mnt_expire); 3919 3939 namespace_unlock(); 3920 3940 } 3921 - mntput(m); 3922 3941 mntput(m); 3923 3942 return err; 3924 3943 } ··· 3955 3976 3956 3977 /* extract from the expiration list every vfsmount that matches the 3957 3978 * following criteria: 3979 + * - already mounted 3958 3980 * - only referenced by its parent vfsmount 3959 3981 * - still marked for expiry (marked on the last call here; marks are 3960 3982 * cleared by mntput()) 3961 3983 */ 3962 3984 list_for_each_entry_safe(mnt, next, mounts, mnt_expire) { 3985 + if (!is_mounted(&mnt->mnt)) 3986 + continue; 3963 3987 if (!xchg(&mnt->mnt_expiry_mark, 1) || 3964 3988 propagate_mount_busy(mnt, 1)) 3965 3989 continue;
-1
fs/nfs/namespace.c
··· 195 195 if (IS_ERR(mnt)) 196 196 goto out_fc; 197 197 198 - mntget(mnt); /* prevent immediate expiration */ 199 198 if (timeout <= 0) 200 199 goto out_fc; 201 200
-1
fs/smb/client/namespace.c
··· 283 283 return newmnt; 284 284 } 285 285 286 - mntget(newmnt); /* prevent immediate expiration */ 287 286 mnt_set_expiry(newmnt, &cifs_automount_list); 288 287 schedule_delayed_work(&cifs_automount_task, 289 288 cifs_mountpoint_expiry_timeout);
+1 -8
fs/super.c
··· 824 824 struct super_block *old; 825 825 int err; 826 826 827 - /* We don't yet pass the user namespace of the parent 828 - * mount through to here so always use &init_user_ns 829 - * until that changes. 830 - */ 831 - if (flags & SB_SUBMOUNT) 832 - user_ns = &init_user_ns; 833 - 834 827 retry: 835 828 spin_lock(&sb_lock); 836 829 if (test) { ··· 843 850 } 844 851 if (!s) { 845 852 spin_unlock(&sb_lock); 846 - s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns); 853 + s = alloc_super(type, flags, user_ns); 847 854 if (!s) 848 855 return ERR_PTR(-ENOMEM); 849 856 goto retry;
-1
include/linux/fs.h
··· 1250 1250 /* These sb flags are internal to the kernel */ 1251 1251 #define SB_DEAD BIT(21) 1252 1252 #define SB_DYING BIT(24) 1253 - #define SB_SUBMOUNT BIT(26) 1254 1253 #define SB_FORCE BIT(27) 1255 1254 #define SB_NOSEC BIT(28) 1256 1255 #define SB_BORN BIT(29)
-3
include/linux/mount.h
··· 101 101 extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 102 102 int flags, const char *name, 103 103 void *data); 104 - extern struct vfsmount *vfs_submount(const struct dentry *mountpoint, 105 - struct file_system_type *type, 106 - const char *name, void *data); 107 104 108 105 extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list); 109 106 extern void mark_mounts_for_expiry(struct list_head *mounts);
+16 -5
kernel/trace/trace.c
··· 51 51 #include <linux/workqueue.h> 52 52 #include <linux/sort.h> 53 53 #include <linux/io.h> /* vmap_page_range() */ 54 + #include <linux/fs_context.h> 54 55 55 56 #include <asm/setup.h> /* COMMAND_LINE_SIZE */ 56 57 ··· 10242 10241 { 10243 10242 struct vfsmount *mnt; 10244 10243 struct file_system_type *type; 10244 + struct fs_context *fc; 10245 + int ret; 10245 10246 10246 10247 /* 10247 10248 * To maintain backward compatibility for tools that mount ··· 10253 10250 type = get_fs_type("tracefs"); 10254 10251 if (!type) 10255 10252 return NULL; 10256 - mnt = vfs_submount(mntpt, type, "tracefs", NULL); 10257 - put_filesystem(type); 10258 - if (IS_ERR(mnt)) 10259 - return NULL; 10260 - mntget(mnt); 10261 10253 10254 + fc = fs_context_for_submount(type, mntpt); 10255 + put_filesystem(type); 10256 + if (IS_ERR(fc)) 10257 + return ERR_CAST(fc); 10258 + 10259 + ret = vfs_parse_fs_string(fc, "source", 10260 + "tracefs", strlen("tracefs")); 10261 + if (!ret) 10262 + mnt = fc_mount(fc); 10263 + else 10264 + mnt = ERR_PTR(ret); 10265 + 10266 + put_fs_context(fc); 10262 10267 return mnt; 10263 10268 } 10264 10269