@@ -1295,7 +1295,7 @@ extern const struct inode_operations afs_mntpt_inode_operations;
extern const struct inode_operations afs_autocell_inode_operations;
extern const struct file_operations afs_mntpt_file_operations;
-extern struct vfsmount *afs_d_automount(struct path *);
+extern struct vfsmount *afs_d_automount(struct path *, unsigned int);
extern void afs_mntpt_kill_timer(void);
/*
@@ -161,7 +161,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
BUG_ON(!d_inode(mntpt));
- fc = fs_context_for_submount(&afs_fs_type, mntpt);
+ fc = fs_context_for_submount(&afs_fs_type, mntpt, 0);
if (IS_ERR(fc))
return ERR_CAST(fc);
@@ -178,7 +178,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
/*
* handle an automount point
*/
-struct vfsmount *afs_d_automount(struct path *path)
+struct vfsmount *afs_d_automount(struct path *path, unsigned int sb_flags)
{
struct vfsmount *newmnt;
@@ -25,7 +25,7 @@ static long autofs_root_compat_ioctl(struct file *,
static int autofs_dir_open(struct inode *inode, struct file *file);
static struct dentry *autofs_lookup(struct inode *,
struct dentry *, unsigned int);
-static struct vfsmount *autofs_d_automount(struct path *);
+static struct vfsmount *autofs_d_automount(struct path *, unsigned int);
static int autofs_d_manage(const struct path *, bool);
static void autofs_dentry_release(struct dentry *);
@@ -328,7 +328,7 @@ static struct dentry *autofs_mountpoint_changed(struct path *path)
return path->dentry;
}
-static struct vfsmount *autofs_d_automount(struct path *path)
+static struct vfsmount *autofs_d_automount(struct path *path, unsigned int sb_flags)
{
struct dentry *dentry = path->dentry;
struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
@@ -229,7 +229,7 @@ static void debugfs_release_dentry(struct dentry *dentry)
kfree(fsd);
}
-static struct vfsmount *debugfs_automount(struct path *path)
+static struct vfsmount *debugfs_automount(struct path *path, unsigned int sb_flags)
{
struct debugfs_fsdata *fsd = path->dentry->d_fsdata;
@@ -352,12 +352,13 @@ EXPORT_SYMBOL(fs_context_for_reconfigure);
* the fc->security object is inherited from @reference (if needed).
*/
struct fs_context *fs_context_for_submount(struct file_system_type *type,
- struct dentry *reference)
+ struct dentry *reference,
+ unsigned int sb_flags)
{
struct fs_context *fc;
int ret;
- fc = alloc_fs_context(type, reference, 0, 0, FS_CONTEXT_FOR_SUBMOUNT);
+ fc = alloc_fs_context(type, reference, sb_flags, 0, FS_CONTEXT_FOR_SUBMOUNT);
if (IS_ERR(fc))
return fc;
@@ -305,13 +305,13 @@ static int fuse_dentry_delete(const struct dentry *dentry)
* as the root), and return that mount so it can be auto-mounted on
* @path.
*/
-static struct vfsmount *fuse_dentry_automount(struct path *path)
+static struct vfsmount *fuse_dentry_automount(struct path *path, unsigned int sb_flags)
{
struct fs_context *fsc;
struct vfsmount *mnt;
struct fuse_inode *mp_fi = get_fuse_inode(d_inode(path->dentry));
- fsc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
+ fsc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry, 0);
if (IS_ERR(fsc))
return ERR_CAST(fsc);
@@ -1345,6 +1345,7 @@ static bool choose_mountpoint(struct mount *m, const struct path *root,
static int follow_automount(struct path *path, int *count, unsigned lookup_flags)
{
struct dentry *dentry = path->dentry;
+ struct nameidata *nd = container_of(count, struct nameidata, total_link_count);
/* We don't want to mount if someone's just doing a stat -
* unless they're stat'ing a directory and appended a '/' to
@@ -1365,7 +1366,7 @@ static int follow_automount(struct path *path, int *count, unsigned lookup_flags
if (count && (*count)++ >= MAXSYMLINKS)
return -ELOOP;
- return finish_automount(dentry->d_op->d_automount(path), path);
+ return finish_automount(dentry->d_op->d_automount(path, nd->root.mnt->mnt_sb->s_flags), path);
}
/*
@@ -484,7 +484,7 @@ static inline bool nfs_file_io_is_buffered(struct nfs_inode *nfsi)
#define NFS_PATH_CANONICAL 1
extern char *nfs_path(char **p, struct dentry *dentry,
char *buffer, ssize_t buflen, unsigned flags);
-extern struct vfsmount *nfs_d_automount(struct path *path);
+extern struct vfsmount *nfs_d_automount(struct path *path, unsigned int);
int nfs_submount(struct fs_context *, struct nfs_server *);
int nfs_do_submount(struct fs_context *);
@@ -142,7 +142,7 @@ EXPORT_SYMBOL_GPL(nfs_path);
* situation, and that different filesystems may want to use
* different security flavours.
*/
-struct vfsmount *nfs_d_automount(struct path *path)
+struct vfsmount *nfs_d_automount(struct path *path, unsigned int sb_flags)
{
struct nfs_fs_context *ctx;
struct fs_context *fc;
@@ -158,7 +158,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
/* Open a new filesystem context, transferring parameters from the
* parent superblock, including the network namespace.
*/
- fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
+ fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry, 0);
if (IS_ERR(fc))
return ERR_CAST(fc);
@@ -113,7 +113,7 @@ extern int cifs_readdir(struct file *file, struct dir_context *ctx);
extern const struct dentry_operations cifs_dentry_ops;
extern const struct dentry_operations cifs_ci_dentry_ops;
-extern struct vfsmount *cifs_d_automount(struct path *path);
+extern struct vfsmount *cifs_d_automount(struct path *path, unsigned int sb_flags);
/* Functions related to symlinks */
extern const char *cifs_get_link(struct dentry *, struct inode *,
@@ -254,7 +254,7 @@ static struct vfsmount *cifs_do_automount(struct path *path)
/*
* Attempt to automount the referral
*/
-struct vfsmount *cifs_d_automount(struct path *path)
+struct vfsmount *cifs_d_automount(struct path *path, unsigned int sb_flags)
{
struct vfsmount *newmnt;
@@ -142,7 +142,7 @@ struct dentry_operations {
void (*d_prune)(struct dentry *);
void (*d_iput)(struct dentry *, struct inode *);
char *(*d_dname)(struct dentry *, char *, int);
- struct vfsmount *(*d_automount)(struct path *);
+ struct vfsmount *(*d_automount)(struct path *, unsigned int sb_flags);
int (*d_manage)(const struct path *, bool);
struct dentry *(*d_real)(struct dentry *, enum d_real_type type);
} ____cacheline_aligned;
@@ -130,7 +130,8 @@ extern struct fs_context *fs_context_for_reconfigure(struct dentry *dentry,
unsigned int sb_flags,
unsigned int sb_flags_mask);
extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_type,
- struct dentry *reference);
+ struct dentry *reference,
+ unsigned int sb_flags);
extern struct fs_context *vfs_dup_fs_context(struct fs_context *fc);
extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);