From: Li Lingfeng <lilingfeng@huaweicloud.com>
To: dhowells@redhat.com, marc.dionne@auristor.com, raven@themaw.net,
gregkh@linuxfoundation.org, rafael@kernel.org,
viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
miklos@szeredi.hu, trond.myklebust@hammerspace.com,
anna@kernel.org, sfrench@samba.org, pc@manguebit.com,
ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
bharathsm@microsoft.com, djwong@kernel.org
Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
autofs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org,
samba-technical@lists.samba.org, yi.zhang@huawei.com,
yangerkun@huawei.com, zhangxiaoxu5@huawei.com,
lilingfeng@huaweicloud.com, lilingfeng3@huawei.com
Subject: [PATCH RFC 1/2] fs: pass sb_flags to submount
Date: Tue, 4 Jun 2024 19:26:35 +0800 [thread overview]
Message-ID: <20240604112636.236517-2-lilingfeng@huaweicloud.com> (raw)
In-Reply-To: <20240604112636.236517-1-lilingfeng@huaweicloud.com>
From: Li Lingfeng <lilingfeng3@huawei.com>
This commit has no functional change.
Get sb_flags by nameidata, and pass it to submount.
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
---
fs/afs/internal.h | 2 +-
fs/afs/mntpt.c | 4 ++--
fs/autofs/root.c | 4 ++--
fs/debugfs/inode.c | 2 +-
fs/fs_context.c | 5 +++--
fs/fuse/dir.c | 4 ++--
fs/namei.c | 3 ++-
fs/nfs/internal.h | 2 +-
fs/nfs/namespace.c | 4 ++--
fs/smb/client/cifsfs.h | 2 +-
fs/smb/client/namespace.c | 2 +-
include/linux/dcache.h | 2 +-
include/linux/fs_context.h | 3 ++-
13 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 6e1d3c4daf72..dc07446e6378 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -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);
/*
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 297487ee8323..3519deab514f 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -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;
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 530d18827e35..f7294d3a089f 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -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);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index dc51df0b118d..a2cdab95d12a 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -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;
diff --git a/fs/fs_context.c b/fs/fs_context.c
index 98589aae5208..95367dc7dc40 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -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;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 2b0d4781f394..88bd5aec11e7 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -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);
diff --git a/fs/namei.c b/fs/namei.c
index 37fb0a8aa09a..445de9fcef38 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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);
}
/*
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 9f0f4534744b..f0e35e0d05c9 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -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 *);
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index e7494cdd957e..887aeacedebd 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -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);
diff --git a/fs/smb/client/cifsfs.h b/fs/smb/client/cifsfs.h
index 62d5fee3e5eb..eec5d5fa42a5 100644
--- a/fs/smb/client/cifsfs.h
+++ b/fs/smb/client/cifsfs.h
@@ -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 *,
diff --git a/fs/smb/client/namespace.c b/fs/smb/client/namespace.c
index 4a517b280f2b..81640e6b2d3f 100644
--- a/fs/smb/client/namespace.c
+++ b/fs/smb/client/namespace.c
@@ -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;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index bf53e3894aae..864b0cd1c0c9 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -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;
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index c13e99cbbf81..920bcbfaff2e 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -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);
--
2.39.2
next prev parent reply other threads:[~2024-06-04 11:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 11:26 [PATCH RFC 0/2] NFSv4: set sb_flags to second superblock Li Lingfeng
2024-06-04 11:26 ` Li Lingfeng [this message]
2024-06-04 11:26 ` [PATCH RFC 2/2] " Li Lingfeng
2024-06-14 3:14 ` Li Lingfeng
2024-07-13 9:33 ` Li Lingfeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240604112636.236517-2-lilingfeng@huaweicloud.com \
--to=lilingfeng@huaweicloud.com \
--cc=anna@kernel.org \
--cc=autofs@vger.kernel.org \
--cc=bharathsm@microsoft.com \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=djwong@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=lilingfeng3@huawei.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=miklos@szeredi.hu \
--cc=pc@manguebit.com \
--cc=rafael@kernel.org \
--cc=raven@themaw.net \
--cc=ronniesahlberg@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=trond.myklebust@hammerspace.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).