Rename struct nfs_parsed_mount_data to struct nfs_sb_config and rename pointers to it to "cfg". At some point this will acquire an sb_config struct as the first term. Signed-off-by: David Howells <dhowells@xxxxxxxxxx> --- fs/nfs/client.c | 64 ++++---- fs/nfs/internal.h | 14 +- fs/nfs/mount.c | 433 +++++++++++++++++++++++++-------------------------- fs/nfs/nfs4client.c | 58 +++---- fs/nfs/nfs4super.c | 10 + fs/nfs/super.c | 184 +++++++++++----------- 6 files changed, 381 insertions(+), 382 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index ee5ddbd36088..5701f5122a64 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -635,25 +635,25 @@ EXPORT_SYMBOL_GPL(nfs_init_client); * Create a version 2 or 3 client */ static int nfs_init_server(struct nfs_server *server, - const struct nfs_parsed_mount_data *data, + const struct nfs_sb_config *cfg, struct nfs_subversion *nfs_mod) { struct rpc_timeout timeparms; struct nfs_client_initdata cl_init = { - .hostname = data->nfs_server.hostname, - .addr = (const struct sockaddr *)&data->nfs_server.address, - .addrlen = data->nfs_server.addrlen, + .hostname = cfg->nfs_server.hostname, + .addr = (const struct sockaddr *)&cfg->nfs_server.address, + .addrlen = cfg->nfs_server.addrlen, .nfs_mod = nfs_mod, - .proto = data->nfs_server.protocol, - .net = data->net, + .proto = cfg->nfs_server.protocol, + .net = cfg->net, .timeparms = &timeparms, }; struct nfs_client *clp; int error; - nfs_init_timeout_values(&timeparms, data->nfs_server.protocol, - data->timeo, data->retrans); - if (data->flags & NFS_MOUNT_NORESVPORT) + nfs_init_timeout_values(&timeparms, cfg->nfs_server.protocol, + cfg->timeo, cfg->retrans); + if (cfg->flags & NFS_MOUNT_NORESVPORT) set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); /* Allocate or find a client reference we can use */ @@ -664,46 +664,46 @@ static int nfs_init_server(struct nfs_server *server, server->nfs_client = clp; /* Initialise the client representation from the mount data */ - server->flags = data->flags; - server->options = data->options; + server->flags = cfg->flags; + server->options = cfg->options; server->caps |= NFS_CAP_HARDLINKS|NFS_CAP_SYMLINKS|NFS_CAP_FILEID| NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER|NFS_CAP_OWNER_GROUP| NFS_CAP_ATIME|NFS_CAP_CTIME|NFS_CAP_MTIME; - if (data->rsize) - server->rsize = nfs_block_size(data->rsize, NULL); - if (data->wsize) - server->wsize = nfs_block_size(data->wsize, NULL); + if (cfg->rsize) + server->rsize = nfs_block_size(cfg->rsize, NULL); + if (cfg->wsize) + server->wsize = nfs_block_size(cfg->wsize, NULL); - server->acregmin = data->acregmin * HZ; - server->acregmax = data->acregmax * HZ; - server->acdirmin = data->acdirmin * HZ; - server->acdirmax = data->acdirmax * HZ; + server->acregmin = cfg->acregmin * HZ; + server->acregmax = cfg->acregmax * HZ; + server->acdirmin = cfg->acdirmin * HZ; + server->acdirmax = cfg->acdirmax * HZ; /* Start lockd here, before we might error out */ error = nfs_start_lockd(server); if (error < 0) goto error; - server->port = data->nfs_server.port; - server->auth_info = data->auth_info; + server->port = cfg->nfs_server.port; + server->auth_info = cfg->auth_info; error = nfs_init_server_rpcclient(server, &timeparms, - data->selected_flavor); + cfg->selected_flavor); if (error < 0) goto error; /* Preserve the values of mount_server-related mount options */ - if (data->mount_server.addrlen) { - memcpy(&server->mountd_address, &data->mount_server.address, - data->mount_server.addrlen); - server->mountd_addrlen = data->mount_server.addrlen; + if (cfg->mount_server.addrlen) { + memcpy(&server->mountd_address, &cfg->mount_server.address, + cfg->mount_server.addrlen); + server->mountd_addrlen = cfg->mount_server.addrlen; } - server->mountd_version = data->mount_server.version; - server->mountd_port = data->mount_server.port; - server->mountd_protocol = data->mount_server.protocol; + server->mountd_version = cfg->mount_server.version; + server->mountd_port = cfg->mount_server.port; + server->mountd_protocol = cfg->mount_server.protocol; - server->namelen = data->namlen; + server->namelen = cfg->namlen; return 0; error: @@ -938,7 +938,7 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info, goto error; /* Get a client representation */ - error = nfs_init_server(server, mount_info->parsed, nfs_mod); + error = nfs_init_server(server, mount_info->cfg, nfs_mod); if (error < 0) goto error; @@ -949,7 +949,7 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info, if (server->nfs_client->rpc_ops->version == 3) { if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN) server->namelen = NFS3_MAXNAMLEN; - if (!(mount_info->parsed->flags & NFS_MOUNT_NORDIRPLUS)) + if (!(mount_info->cfg->flags & NFS_MOUNT_NORDIRPLUS)) server->caps |= NFS_CAP_READDIRPLUS; } else { if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 260494be399e..af6ca28da48d 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -85,7 +85,7 @@ struct nfs_client_initdata { /* * In-kernel mount arguments */ -struct nfs_parsed_mount_data { +struct nfs_sb_config { int flags; unsigned int rsize, wsize; unsigned int timeo, retrans; @@ -142,7 +142,7 @@ struct nfs_mount_request { struct nfs_mount_info { void (*fill_super)(struct super_block *, struct nfs_mount_info *); int (*set_security)(struct super_block *, struct dentry *, struct nfs_mount_info *); - struct nfs_parsed_mount_data *parsed; + struct nfs_sb_config *cfg; struct nfs_clone_mount *cloned; struct nfs_fh *mntfh; }; @@ -234,16 +234,16 @@ struct nfs_pageio_descriptor; /* mount.c */ #define NFS_TEXT_DATA 1 -extern struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(void); -extern void nfs_free_parsed_mount_data(struct nfs_parsed_mount_data *data); -extern int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt); +extern struct nfs_sb_config *nfs_alloc_parsed_mount_data(void); +extern void nfs_free_parsed_mount_data(struct nfs_sb_config *cfg); +extern int nfs_parse_mount_options(char *raw, struct nfs_sb_config *cfg); extern int nfs_validate_mount_data(struct file_system_type *fs_type, void *options, - struct nfs_parsed_mount_data *args, + struct nfs_sb_config *cfg, struct nfs_fh *mntfh, const char *dev_name); extern int nfs_validate_text_mount_data(void *options, - struct nfs_parsed_mount_data *args, + struct nfs_sb_config *cfg, const char *dev_name); /* pagelist.c */ diff --git a/fs/nfs/mount.c b/fs/nfs/mount.c index a41f034aafb2..8f22163a4cc7 100644 --- a/fs/nfs/mount.c +++ b/fs/nfs/mount.c @@ -240,40 +240,40 @@ static const match_table_t nfs_vers_tokens = { { Opt_vers_err, NULL } }; -struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(void) +struct nfs_sb_config *nfs_alloc_parsed_mount_data(void) { - struct nfs_parsed_mount_data *data; - - data = kzalloc(sizeof(*data), GFP_KERNEL); - if (data) { - data->timeo = NFS_UNSPEC_TIMEO; - data->retrans = NFS_UNSPEC_RETRANS; - data->acregmin = NFS_DEF_ACREGMIN; - data->acregmax = NFS_DEF_ACREGMAX; - data->acdirmin = NFS_DEF_ACDIRMIN; - data->acdirmax = NFS_DEF_ACDIRMAX; - data->mount_server.port = NFS_UNSPEC_PORT; - data->nfs_server.port = NFS_UNSPEC_PORT; - data->nfs_server.protocol = XPRT_TRANSPORT_TCP; - data->selected_flavor = RPC_AUTH_MAXFLAVOR; - data->minorversion = 0; - data->need_mount = true; - data->net = current->nsproxy->net_ns; - security_init_mnt_opts(&data->lsm_opts); + struct nfs_sb_config *cfg; + + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + if (cfg) { + cfg->timeo = NFS_UNSPEC_TIMEO; + cfg->retrans = NFS_UNSPEC_RETRANS; + cfg->acregmin = NFS_DEF_ACREGMIN; + cfg->acregmax = NFS_DEF_ACREGMAX; + cfg->acdirmin = NFS_DEF_ACDIRMIN; + cfg->acdirmax = NFS_DEF_ACDIRMAX; + cfg->mount_server.port = NFS_UNSPEC_PORT; + cfg->nfs_server.port = NFS_UNSPEC_PORT; + cfg->nfs_server.protocol = XPRT_TRANSPORT_TCP; + cfg->selected_flavor = RPC_AUTH_MAXFLAVOR; + cfg->minorversion = 0; + cfg->need_mount = true; + cfg->net = current->nsproxy->net_ns; + security_init_mnt_opts(&cfg->lsm_opts); } - return data; + return cfg; } -void nfs_free_parsed_mount_data(struct nfs_parsed_mount_data *data) +void nfs_free_parsed_mount_data(struct nfs_sb_config *cfg) { - if (data) { - kfree(data->client_address); - kfree(data->mount_server.hostname); - kfree(data->nfs_server.export_path); - kfree(data->nfs_server.hostname); - kfree(data->fscache_uniq); - security_free_mnt_opts(&data->lsm_opts); - kfree(data); + if (cfg) { + kfree(cfg->client_address); + kfree(cfg->mount_server.hostname); + kfree(cfg->nfs_server.export_path); + kfree(cfg->nfs_server.hostname); + kfree(cfg->fscache_uniq); + security_free_mnt_opts(&cfg->lsm_opts); + kfree(cfg); } } @@ -304,15 +304,15 @@ static int nfs_verify_server_address(struct sockaddr *addr) * Sanity check the NFS transport protocol. * */ -static void nfs_validate_transport_protocol(struct nfs_parsed_mount_data *mnt) +static void nfs_validate_transport_protocol(struct nfs_sb_config *cfg) { - switch (mnt->nfs_server.protocol) { + switch (cfg->nfs_server.protocol) { case XPRT_TRANSPORT_UDP: case XPRT_TRANSPORT_TCP: case XPRT_TRANSPORT_RDMA: break; default: - mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; + cfg->nfs_server.protocol = XPRT_TRANSPORT_TCP; } } @@ -320,20 +320,20 @@ static void nfs_validate_transport_protocol(struct nfs_parsed_mount_data *mnt) * For text based NFSv2/v3 mounts, the mount protocol transport default * settings should depend upon the specified NFS transport. */ -static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt) +static void nfs_set_mount_transport_protocol(struct nfs_sb_config *cfg) { - nfs_validate_transport_protocol(mnt); + nfs_validate_transport_protocol(cfg); - if (mnt->mount_server.protocol == XPRT_TRANSPORT_UDP || - mnt->mount_server.protocol == XPRT_TRANSPORT_TCP) + if (cfg->mount_server.protocol == XPRT_TRANSPORT_UDP || + cfg->mount_server.protocol == XPRT_TRANSPORT_TCP) return; - switch (mnt->nfs_server.protocol) { + switch (cfg->nfs_server.protocol) { case XPRT_TRANSPORT_UDP: - mnt->mount_server.protocol = XPRT_TRANSPORT_UDP; + cfg->mount_server.protocol = XPRT_TRANSPORT_UDP; break; case XPRT_TRANSPORT_TCP: case XPRT_TRANSPORT_RDMA: - mnt->mount_server.protocol = XPRT_TRANSPORT_TCP; + cfg->mount_server.protocol = XPRT_TRANSPORT_TCP; } } @@ -365,8 +365,7 @@ static bool nfs_auth_info_add(struct nfs_auth_info *auth_info, /* * Parse the value of the 'sec=' option. */ -static int nfs_parse_security_flavors(char *value, - struct nfs_parsed_mount_data *mnt) +static int nfs_parse_security_flavors(char *value, struct nfs_sb_config *cfg) { substring_t args[MAX_OPT_ARGS]; rpc_authflavor_t pseudoflavor; @@ -415,7 +414,7 @@ static int nfs_parse_security_flavors(char *value, return 0; } - if (!nfs_auth_info_add(&mnt->auth_info, pseudoflavor)) + if (!nfs_auth_info_add(&cfg->auth_info, pseudoflavor)) return 0; } @@ -423,36 +422,36 @@ static int nfs_parse_security_flavors(char *value, } static int nfs_parse_version_string(char *string, - struct nfs_parsed_mount_data *mnt, + struct nfs_sb_config *cfg, substring_t *args) { - mnt->flags &= ~NFS_MOUNT_VER3; + cfg->flags &= ~NFS_MOUNT_VER3; switch (match_token(string, nfs_vers_tokens, args)) { case Opt_vers_2: - mnt->version = 2; + cfg->version = 2; break; case Opt_vers_3: - mnt->flags |= NFS_MOUNT_VER3; - mnt->version = 3; + cfg->flags |= NFS_MOUNT_VER3; + cfg->version = 3; break; case Opt_vers_4: /* Backward compatibility option. In future, * the mount program should always supply * a NFSv4 minor version number. */ - mnt->version = 4; + cfg->version = 4; break; case Opt_vers_4_0: - mnt->version = 4; - mnt->minorversion = 0; + cfg->version = 4; + cfg->minorversion = 0; break; case Opt_vers_4_1: - mnt->version = 4; - mnt->minorversion = 1; + cfg->version = 4; + cfg->minorversion = 1; break; case Opt_vers_4_2: - mnt->version = 4; - mnt->minorversion = 2; + cfg->version = 4; + cfg->minorversion = 2; break; default: return 0; @@ -500,7 +499,7 @@ static int nfs_get_option_ul_bound(substring_t args[], unsigned long *option, * skipped as they are encountered. If there were no errors, return 1; * otherwise return 0 (zero). */ -int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) +int nfs_parse_mount_options(char *raw, struct nfs_sb_config *cfg) { char *p, *string, *secdata; int rc, sloppy = 0, invalid_option = 0; @@ -521,7 +520,7 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) if (rc) goto out_security_failure; - rc = security_sb_parse_opts_str(secdata, &mnt->lsm_opts); + rc = security_sb_parse_opts_str(secdata, &cfg->lsm_opts); if (rc) goto out_security_failure; @@ -544,91 +543,91 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) * boolean options: foo/nofoo */ case Opt_soft: - mnt->flags |= NFS_MOUNT_SOFT; + cfg->flags |= NFS_MOUNT_SOFT; break; case Opt_hard: - mnt->flags &= ~NFS_MOUNT_SOFT; + cfg->flags &= ~NFS_MOUNT_SOFT; break; case Opt_posix: - mnt->flags |= NFS_MOUNT_POSIX; + cfg->flags |= NFS_MOUNT_POSIX; break; case Opt_noposix: - mnt->flags &= ~NFS_MOUNT_POSIX; + cfg->flags &= ~NFS_MOUNT_POSIX; break; case Opt_cto: - mnt->flags &= ~NFS_MOUNT_NOCTO; + cfg->flags &= ~NFS_MOUNT_NOCTO; break; case Opt_nocto: - mnt->flags |= NFS_MOUNT_NOCTO; + cfg->flags |= NFS_MOUNT_NOCTO; break; case Opt_ac: - mnt->flags &= ~NFS_MOUNT_NOAC; + cfg->flags &= ~NFS_MOUNT_NOAC; break; case Opt_noac: - mnt->flags |= NFS_MOUNT_NOAC; + cfg->flags |= NFS_MOUNT_NOAC; break; case Opt_lock: - mnt->flags &= ~NFS_MOUNT_NONLM; - mnt->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | + cfg->flags &= ~NFS_MOUNT_NONLM; + cfg->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | NFS_MOUNT_LOCAL_FCNTL); break; case Opt_nolock: - mnt->flags |= NFS_MOUNT_NONLM; - mnt->flags |= (NFS_MOUNT_LOCAL_FLOCK | + cfg->flags |= NFS_MOUNT_NONLM; + cfg->flags |= (NFS_MOUNT_LOCAL_FLOCK | NFS_MOUNT_LOCAL_FCNTL); break; case Opt_udp: - mnt->flags &= ~NFS_MOUNT_TCP; - mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; + cfg->flags &= ~NFS_MOUNT_TCP; + cfg->nfs_server.protocol = XPRT_TRANSPORT_UDP; break; case Opt_tcp: - mnt->flags |= NFS_MOUNT_TCP; - mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; + cfg->flags |= NFS_MOUNT_TCP; + cfg->nfs_server.protocol = XPRT_TRANSPORT_TCP; break; case Opt_rdma: - mnt->flags |= NFS_MOUNT_TCP; /* for side protocols */ - mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA; + cfg->flags |= NFS_MOUNT_TCP; /* for side protocols */ + cfg->nfs_server.protocol = XPRT_TRANSPORT_RDMA; xprt_load_transport(p); break; case Opt_acl: - mnt->flags &= ~NFS_MOUNT_NOACL; + cfg->flags &= ~NFS_MOUNT_NOACL; break; case Opt_noacl: - mnt->flags |= NFS_MOUNT_NOACL; + cfg->flags |= NFS_MOUNT_NOACL; break; case Opt_rdirplus: - mnt->flags &= ~NFS_MOUNT_NORDIRPLUS; + cfg->flags &= ~NFS_MOUNT_NORDIRPLUS; break; case Opt_nordirplus: - mnt->flags |= NFS_MOUNT_NORDIRPLUS; + cfg->flags |= NFS_MOUNT_NORDIRPLUS; break; case Opt_sharecache: - mnt->flags &= ~NFS_MOUNT_UNSHARED; + cfg->flags &= ~NFS_MOUNT_UNSHARED; break; case Opt_nosharecache: - mnt->flags |= NFS_MOUNT_UNSHARED; + cfg->flags |= NFS_MOUNT_UNSHARED; break; case Opt_resvport: - mnt->flags &= ~NFS_MOUNT_NORESVPORT; + cfg->flags &= ~NFS_MOUNT_NORESVPORT; break; case Opt_noresvport: - mnt->flags |= NFS_MOUNT_NORESVPORT; + cfg->flags |= NFS_MOUNT_NORESVPORT; break; case Opt_fscache: - mnt->options |= NFS_OPTION_FSCACHE; - kfree(mnt->fscache_uniq); - mnt->fscache_uniq = NULL; + cfg->options |= NFS_OPTION_FSCACHE; + kfree(cfg->fscache_uniq); + cfg->fscache_uniq = NULL; break; case Opt_nofscache: - mnt->options &= ~NFS_OPTION_FSCACHE; - kfree(mnt->fscache_uniq); - mnt->fscache_uniq = NULL; + cfg->options &= ~NFS_OPTION_FSCACHE; + kfree(cfg->fscache_uniq); + cfg->fscache_uniq = NULL; break; case Opt_migration: - mnt->options |= NFS_OPTION_MIGRATION; + cfg->options |= NFS_OPTION_MIGRATION; break; case Opt_nomigration: - mnt->options &= NFS_OPTION_MIGRATION; + cfg->options &= NFS_OPTION_MIGRATION; break; /* @@ -638,83 +637,83 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) if (nfs_get_option_ul(args, &option) || option > USHRT_MAX) goto out_invalid_value; - mnt->nfs_server.port = option; + cfg->nfs_server.port = option; break; case Opt_rsize: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->rsize = option; + cfg->rsize = option; break; case Opt_wsize: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->wsize = option; + cfg->wsize = option; break; case Opt_bsize: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->bsize = option; + cfg->bsize = option; break; case Opt_timeo: if (nfs_get_option_ul_bound(args, &option, 1, INT_MAX)) goto out_invalid_value; - mnt->timeo = option; + cfg->timeo = option; break; case Opt_retrans: if (nfs_get_option_ul_bound(args, &option, 0, INT_MAX)) goto out_invalid_value; - mnt->retrans = option; + cfg->retrans = option; break; case Opt_acregmin: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->acregmin = option; + cfg->acregmin = option; break; case Opt_acregmax: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->acregmax = option; + cfg->acregmax = option; break; case Opt_acdirmin: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->acdirmin = option; + cfg->acdirmin = option; break; case Opt_acdirmax: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->acdirmax = option; + cfg->acdirmax = option; break; case Opt_actimeo: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->acregmin = mnt->acregmax = - mnt->acdirmin = mnt->acdirmax = option; + cfg->acregmin = cfg->acregmax = + cfg->acdirmin = cfg->acdirmax = option; break; case Opt_namelen: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; - mnt->namlen = option; + cfg->namlen = option; break; case Opt_mountport: if (nfs_get_option_ul(args, &option) || option > USHRT_MAX) goto out_invalid_value; - mnt->mount_server.port = option; + cfg->mount_server.port = option; break; case Opt_mountvers: if (nfs_get_option_ul(args, &option) || option < NFS_MNT_VERSION || option > NFS_MNT3_VERSION) goto out_invalid_value; - mnt->mount_server.version = option; + cfg->mount_server.version = option; break; case Opt_minorversion: if (nfs_get_option_ul(args, &option)) goto out_invalid_value; if (option > NFS4_MAX_MINOR_VERSION) goto out_invalid_value; - mnt->minorversion = option; + cfg->minorversion = option; break; /* @@ -724,7 +723,7 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) string = match_strdup(args); if (string == NULL) goto out_nomem; - rc = nfs_parse_version_string(string, mnt, args); + rc = nfs_parse_version_string(string, cfg, args); kfree(string); if (!rc) goto out_invalid_value; @@ -733,7 +732,7 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) string = match_strdup(args); if (string == NULL) goto out_nomem; - rc = nfs_parse_security_flavors(string, mnt); + rc = nfs_parse_security_flavors(string, cfg); kfree(string); if (!rc) { dfprintk(MOUNT, "NFS: unrecognized " @@ -753,21 +752,21 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) case Opt_xprt_udp6: protofamily = AF_INET6; case Opt_xprt_udp: - mnt->flags &= ~NFS_MOUNT_TCP; - mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; + cfg->flags &= ~NFS_MOUNT_TCP; + cfg->nfs_server.protocol = XPRT_TRANSPORT_UDP; break; case Opt_xprt_tcp6: protofamily = AF_INET6; case Opt_xprt_tcp: - mnt->flags |= NFS_MOUNT_TCP; - mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; + cfg->flags |= NFS_MOUNT_TCP; + cfg->nfs_server.protocol = XPRT_TRANSPORT_TCP; break; case Opt_xprt_rdma6: protofamily = AF_INET6; case Opt_xprt_rdma: /* vector side protocols to TCP */ - mnt->flags |= NFS_MOUNT_TCP; - mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA; + cfg->flags |= NFS_MOUNT_TCP; + cfg->nfs_server.protocol = XPRT_TRANSPORT_RDMA; xprt_load_transport(string); break; default: @@ -791,12 +790,12 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) case Opt_xprt_udp6: mountfamily = AF_INET6; case Opt_xprt_udp: - mnt->mount_server.protocol = XPRT_TRANSPORT_UDP; + cfg->mount_server.protocol = XPRT_TRANSPORT_UDP; break; case Opt_xprt_tcp6: mountfamily = AF_INET6; case Opt_xprt_tcp: - mnt->mount_server.protocol = XPRT_TRANSPORT_TCP; + cfg->mount_server.protocol = XPRT_TRANSPORT_TCP; break; case Opt_xprt_rdma: /* not used for side protocols */ default: @@ -809,35 +808,35 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) string = match_strdup(args); if (string == NULL) goto out_nomem; - mnt->nfs_server.addrlen = - rpc_pton(mnt->net, string, strlen(string), + cfg->nfs_server.addrlen = + rpc_pton(cfg->net, string, strlen(string), (struct sockaddr *) - &mnt->nfs_server.address, - sizeof(mnt->nfs_server.address)); + &cfg->nfs_server.address, + sizeof(cfg->nfs_server.address)); kfree(string); - if (mnt->nfs_server.addrlen == 0) + if (cfg->nfs_server.addrlen == 0) goto out_invalid_address; break; case Opt_clientaddr: - if (nfs_get_option_str(args, &mnt->client_address)) + if (nfs_get_option_str(args, &cfg->client_address)) goto out_nomem; break; case Opt_mounthost: if (nfs_get_option_str(args, - &mnt->mount_server.hostname)) + &cfg->mount_server.hostname)) goto out_nomem; break; case Opt_mountaddr: string = match_strdup(args); if (string == NULL) goto out_nomem; - mnt->mount_server.addrlen = - rpc_pton(mnt->net, string, strlen(string), + cfg->mount_server.addrlen = + rpc_pton(cfg->net, string, strlen(string), (struct sockaddr *) - &mnt->mount_server.address, - sizeof(mnt->mount_server.address)); + &cfg->mount_server.address, + sizeof(cfg->mount_server.address)); kfree(string); - if (mnt->mount_server.addrlen == 0) + if (cfg->mount_server.addrlen == 0) goto out_invalid_address; break; case Opt_lookupcache: @@ -849,14 +848,14 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) kfree(string); switch (token) { case Opt_lookupcache_all: - mnt->flags &= ~(NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE); + cfg->flags &= ~(NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE); break; case Opt_lookupcache_positive: - mnt->flags &= ~NFS_MOUNT_LOOKUP_CACHE_NONE; - mnt->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG; + cfg->flags &= ~NFS_MOUNT_LOOKUP_CACHE_NONE; + cfg->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG; break; case Opt_lookupcache_none: - mnt->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE; + cfg->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE; break; default: dfprintk(MOUNT, "NFS: invalid " @@ -865,9 +864,9 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) }; break; case Opt_fscache_uniq: - if (nfs_get_option_str(args, &mnt->fscache_uniq)) + if (nfs_get_option_str(args, &cfg->fscache_uniq)) goto out_nomem; - mnt->options |= NFS_OPTION_FSCACHE; + cfg->options |= NFS_OPTION_FSCACHE; break; case Opt_local_lock: string = match_strdup(args); @@ -878,17 +877,17 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) kfree(string); switch (token) { case Opt_local_lock_all: - mnt->flags |= (NFS_MOUNT_LOCAL_FLOCK | + cfg->flags |= (NFS_MOUNT_LOCAL_FLOCK | NFS_MOUNT_LOCAL_FCNTL); break; case Opt_local_lock_flock: - mnt->flags |= NFS_MOUNT_LOCAL_FLOCK; + cfg->flags |= NFS_MOUNT_LOCAL_FLOCK; break; case Opt_local_lock_posix: - mnt->flags |= NFS_MOUNT_LOCAL_FCNTL; + cfg->flags |= NFS_MOUNT_LOCAL_FCNTL; break; case Opt_local_lock_none: - mnt->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | + cfg->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | NFS_MOUNT_LOCAL_FCNTL); break; default: @@ -921,11 +920,11 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) if (!sloppy && invalid_option) return 0; - if (mnt->minorversion && mnt->version != 4) + if (cfg->minorversion && cfg->version != 4) goto out_minorversion_mismatch; - if (mnt->options & NFS_OPTION_MIGRATION && - (mnt->version != 4 || mnt->minorversion != 0)) + if (cfg->options & NFS_OPTION_MIGRATION && + (cfg->version != 4 || cfg->minorversion != 0)) goto out_migration_misuse; /* @@ -933,15 +932,15 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) * families in the addr=/mountaddr= options. */ if (protofamily != AF_UNSPEC && - protofamily != mnt->nfs_server.address.ss_family) + protofamily != cfg->nfs_server.address.ss_family) goto out_proto_mismatch; if (mountfamily != AF_UNSPEC) { - if (mnt->mount_server.addrlen) { - if (mountfamily != mnt->mount_server.address.ss_family) + if (cfg->mount_server.addrlen) { + if (mountfamily != cfg->mount_server.address.ss_family) goto out_mountproto_mismatch; } else { - if (mountfamily != mnt->nfs_server.address.ss_family) + if (mountfamily != cfg->nfs_server.address.ss_family) goto out_mountproto_mismatch; } } @@ -963,7 +962,7 @@ int nfs_parse_mount_options(char *raw, struct nfs_parsed_mount_data *mnt) return 0; out_minorversion_mismatch: printk(KERN_INFO "NFS: mount option vers=%u does not support " - "minorversion=%u\n", mnt->version, mnt->minorversion); + "minorversion=%u\n", cfg->version, cfg->minorversion); return 0; out_migration_misuse: printk(KERN_INFO @@ -1067,18 +1066,18 @@ static int nfs_parse_devname(const char *dev_name, * mountproto=tcp after mountproto=udp, and so on */ static int nfs23_validate_mount_data(void *options, - struct nfs_parsed_mount_data *args, + struct nfs_sb_config *cfg, struct nfs_fh *mntfh, const char *dev_name) { struct nfs_mount_data *data = (struct nfs_mount_data *)options; - struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; + struct sockaddr *sap = (struct sockaddr *)&cfg->nfs_server.address; int extra_flags = NFS_MOUNT_LEGACY_INTERFACE; if (data == NULL) goto out_no_data; - args->version = NFS_DEFAULT_VERSION; + cfg->version = NFS_DEFAULT_VERSION; switch (data->version) { case 1: data->namlen = 0; @@ -1101,10 +1100,10 @@ static int nfs23_validate_mount_data(void *options, if (data->root.size > NFS3_FHSIZE || data->root.size == 0) goto out_invalid_fh; mntfh->size = data->root.size; - args->version = 3; + cfg->version = 3; } else { mntfh->size = NFS2_FHSIZE; - args->version = 2; + cfg->version = 2; } @@ -1114,46 +1113,46 @@ static int nfs23_validate_mount_data(void *options, sizeof(mntfh->data) - mntfh->size); /* - * Translate to nfs_parsed_mount_data, which nfs_fill_super + * Translate to nfs_sb_config, which nfs_fill_super * can deal with. */ - args->flags = data->flags & NFS_MOUNT_FLAGMASK; - args->flags |= extra_flags; - args->rsize = data->rsize; - args->wsize = data->wsize; - args->timeo = data->timeo; - args->retrans = data->retrans; - args->acregmin = data->acregmin; - args->acregmax = data->acregmax; - args->acdirmin = data->acdirmin; - args->acdirmax = data->acdirmax; - args->need_mount = false; + cfg->flags = data->flags & NFS_MOUNT_FLAGMASK; + cfg->flags |= extra_flags; + cfg->rsize = data->rsize; + cfg->wsize = data->wsize; + cfg->timeo = data->timeo; + cfg->retrans = data->retrans; + cfg->acregmin = data->acregmin; + cfg->acregmax = data->acregmax; + cfg->acdirmin = data->acdirmin; + cfg->acdirmax = data->acdirmax; + cfg->need_mount = false; memcpy(sap, &data->addr, sizeof(data->addr)); - args->nfs_server.addrlen = sizeof(data->addr); - args->nfs_server.port = ntohs(data->addr.sin_port); + cfg->nfs_server.addrlen = sizeof(data->addr); + cfg->nfs_server.port = ntohs(data->addr.sin_port); if (!nfs_verify_server_address(sap)) goto out_no_address; if (!(data->flags & NFS_MOUNT_TCP)) - args->nfs_server.protocol = XPRT_TRANSPORT_UDP; + cfg->nfs_server.protocol = XPRT_TRANSPORT_UDP; /* N.B. caller will free nfs_server.hostname in all cases */ - args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); - args->namlen = data->namlen; - args->bsize = data->bsize; + cfg->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); + cfg->namlen = data->namlen; + cfg->bsize = data->bsize; if (data->flags & NFS_MOUNT_SECFLAVOUR) - args->selected_flavor = data->pseudoflavor; + cfg->selected_flavor = data->pseudoflavor; else - args->selected_flavor = RPC_AUTH_UNIX; - if (!args->nfs_server.hostname) + cfg->selected_flavor = RPC_AUTH_UNIX; + if (!cfg->nfs_server.hostname) goto out_nomem; if (!(data->flags & NFS_MOUNT_NONLM)) - args->flags &= ~(NFS_MOUNT_LOCAL_FLOCK| + cfg->flags &= ~(NFS_MOUNT_LOCAL_FLOCK| NFS_MOUNT_LOCAL_FCNTL); else - args->flags |= (NFS_MOUNT_LOCAL_FLOCK| + cfg->flags |= (NFS_MOUNT_LOCAL_FLOCK| NFS_MOUNT_LOCAL_FCNTL); /* * The legacy version 6 binary mount data from userspace has a @@ -1172,7 +1171,7 @@ static int nfs23_validate_mount_data(void *options, strcpy(opts_str, "context="); data->context[NFS_MAX_CONTEXT_LEN] = '\0'; strcat(opts_str, &data->context[0]); - rc = security_sb_parse_opts_str(opts_str, &args->lsm_opts); + rc = security_sb_parse_opts_str(opts_str, &cfg->lsm_opts); kfree(opts_str); if (rc) return rc; @@ -1216,9 +1215,9 @@ static int nfs23_validate_mount_data(void *options, #if IS_ENABLED(CONFIG_NFS_V4) -static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args) +static void nfs4_validate_mount_flags(struct nfs_sb_config *cfg) { - args->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3| + cfg->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3| NFS_MOUNT_LOCAL_FLOCK|NFS_MOUNT_LOCAL_FCNTL); } @@ -1226,30 +1225,30 @@ static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args) * Validate NFSv4 mount options */ static int nfs4_validate_mount_data(void *options, - struct nfs_parsed_mount_data *args, + struct nfs_sb_config *cfg, const char *dev_name) { - struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; + struct sockaddr *sap = (struct sockaddr *)&cfg->nfs_server.address; struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; char *c; if (data == NULL) goto out_no_data; - args->version = 4; + cfg->version = 4; switch (data->version) { case 1: - if (data->host_addrlen > sizeof(args->nfs_server.address)) + if (data->host_addrlen > sizeof(cfg->nfs_server.address)) goto out_no_address; if (data->host_addrlen == 0) goto out_no_address; - args->nfs_server.addrlen = data->host_addrlen; + cfg->nfs_server.addrlen = data->host_addrlen; if (copy_from_user(sap, data->host_addr, data->host_addrlen)) return -EFAULT; if (!nfs_verify_server_address(sap)) goto out_no_address; - args->nfs_server.port = ntohs(((struct sockaddr_in *)sap)->sin_port); + cfg->nfs_server.port = ntohs(((struct sockaddr_in *)sap)->sin_port); if (data->auth_flavourlen) { rpc_authflavor_t pseudoflavor; @@ -1259,43 +1258,43 @@ static int nfs4_validate_mount_data(void *options, data->auth_flavours, sizeof(pseudoflavor))) return -EFAULT; - args->selected_flavor = pseudoflavor; + cfg->selected_flavor = pseudoflavor; } else - args->selected_flavor = RPC_AUTH_UNIX; + cfg->selected_flavor = RPC_AUTH_UNIX; c = strndup_user(data->hostname.data, NFS4_MAXNAMLEN); if (IS_ERR(c)) return PTR_ERR(c); - args->nfs_server.hostname = c; + cfg->nfs_server.hostname = c; c = strndup_user(data->mnt_path.data, NFS4_MAXPATHLEN); if (IS_ERR(c)) return PTR_ERR(c); - args->nfs_server.export_path = c; + cfg->nfs_server.export_path = c; dfprintk(MOUNT, "NFS: MNTPATH: '%s'\n", c); c = strndup_user(data->client_addr.data, 16); if (IS_ERR(c)) return PTR_ERR(c); - args->client_address = c; + cfg->client_address = c; /* - * Translate to nfs_parsed_mount_data, which nfs4_fill_super + * Translate to nfs_sb_config, which nfs4_fill_super * can deal with. */ - args->flags = data->flags & NFS4_MOUNT_FLAGMASK; - args->rsize = data->rsize; - args->wsize = data->wsize; - args->timeo = data->timeo; - args->retrans = data->retrans; - args->acregmin = data->acregmin; - args->acregmax = data->acregmax; - args->acdirmin = data->acdirmin; - args->acdirmax = data->acdirmax; - args->nfs_server.protocol = data->proto; - nfs_validate_transport_protocol(args); - if (args->nfs_server.protocol == XPRT_TRANSPORT_UDP) + cfg->flags = data->flags & NFS4_MOUNT_FLAGMASK; + cfg->rsize = data->rsize; + cfg->wsize = data->wsize; + cfg->timeo = data->timeo; + cfg->retrans = data->retrans; + cfg->acregmin = data->acregmin; + cfg->acregmax = data->acregmax; + cfg->acdirmin = data->acdirmin; + cfg->acdirmax = data->acdirmax; + cfg->nfs_server.protocol = data->proto; + nfs_validate_transport_protocol(cfg); + if (cfg->nfs_server.protocol == XPRT_TRANSPORT_UDP) goto out_invalid_transport_udp; break; @@ -1325,61 +1324,61 @@ static int nfs4_validate_mount_data(void *options, int nfs_validate_mount_data(struct file_system_type *fs_type, void *options, - struct nfs_parsed_mount_data *args, + struct nfs_sb_config *cfg, struct nfs_fh *mntfh, const char *dev_name) { if (fs_type == &nfs_fs_type) - return nfs23_validate_mount_data(options, args, mntfh, dev_name); - return nfs4_validate_mount_data(options, args, dev_name); + return nfs23_validate_mount_data(options, cfg, mntfh, dev_name); + return nfs4_validate_mount_data(options, cfg, dev_name); } #else int nfs_validate_mount_data(struct file_system_type *fs_type, void *options, - struct nfs_parsed_mount_data *args, + struct nfs_sb_config *cfg, struct nfs_fh *mntfh, const char *dev_name) { - return nfs23_validate_mount_data(options, args, mntfh, dev_name); + return nfs23_validate_mount_data(options, cfg, mntfh, dev_name); } #endif int nfs_validate_text_mount_data(void *options, - struct nfs_parsed_mount_data *args, + struct nfs_sb_config *cfg, const char *dev_name) { int port = 0; int max_namelen = PAGE_SIZE; int max_pathlen = NFS_MAXPATHLEN; - struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; + struct sockaddr *sap = (struct sockaddr *)&cfg->nfs_server.address; - if (nfs_parse_mount_options((char *)options, args) == 0) + if (nfs_parse_mount_options((char *)options, cfg) == 0) return -EINVAL; if (!nfs_verify_server_address(sap)) goto out_no_address; - if (args->version == 4) { + if (cfg->version == 4) { #if IS_ENABLED(CONFIG_NFS_V4) port = NFS_PORT; max_namelen = NFS4_MAXNAMLEN; max_pathlen = NFS4_MAXPATHLEN; - nfs_validate_transport_protocol(args); - if (args->nfs_server.protocol == XPRT_TRANSPORT_UDP) + nfs_validate_transport_protocol(cfg); + if (cfg->nfs_server.protocol == XPRT_TRANSPORT_UDP) goto out_invalid_transport_udp; - nfs4_validate_mount_flags(args); + nfs4_validate_mount_flags(cfg); #else goto out_v4_not_compiled; #endif /* CONFIG_NFS_V4 */ } else - nfs_set_mount_transport_protocol(args); + nfs_set_mount_transport_protocol(cfg); - nfs_set_port(sap, &args->nfs_server.port, port); + nfs_set_port(sap, &cfg->nfs_server.port, port); return nfs_parse_devname(dev_name, - &args->nfs_server.hostname, + &cfg->nfs_server.hostname, max_namelen, - &args->nfs_server.export_path, + &cfg->nfs_server.export_path, max_pathlen); #if !IS_ENABLED(CONFIG_NFS_V4) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 692a7a8bfc7a..ec0c112d8148 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -1010,60 +1010,60 @@ static int nfs4_server_common_setup(struct nfs_server *server, * Create a version 4 volume record */ static int nfs4_init_server(struct nfs_server *server, - struct nfs_parsed_mount_data *data) + struct nfs_sb_config *cfg) { struct rpc_timeout timeparms; int error; - nfs_init_timeout_values(&timeparms, data->nfs_server.protocol, - data->timeo, data->retrans); + nfs_init_timeout_values(&timeparms, cfg->nfs_server.protocol, + cfg->timeo, cfg->retrans); /* Initialise the client representation from the mount data */ - server->flags = data->flags; - server->options = data->options; - server->auth_info = data->auth_info; + server->flags = cfg->flags; + server->options = cfg->options; + server->auth_info = cfg->auth_info; /* Use the first specified auth flavor. If this flavor isn't * allowed by the server, use the SECINFO path to try the * other specified flavors */ - if (data->auth_info.flavor_len >= 1) - data->selected_flavor = data->auth_info.flavors[0]; + if (cfg->auth_info.flavor_len >= 1) + cfg->selected_flavor = cfg->auth_info.flavors[0]; else - data->selected_flavor = RPC_AUTH_UNIX; + cfg->selected_flavor = RPC_AUTH_UNIX; /* Get a client record */ error = nfs4_set_client(server, - data->nfs_server.hostname, - (const struct sockaddr *)&data->nfs_server.address, - data->nfs_server.addrlen, - data->client_address, - data->nfs_server.protocol, + cfg->nfs_server.hostname, + (const struct sockaddr *)&cfg->nfs_server.address, + cfg->nfs_server.addrlen, + cfg->client_address, + cfg->nfs_server.protocol, &timeparms, - data->minorversion, - data->net); + cfg->minorversion, + cfg->net); if (error < 0) return error; - if (data->rsize) - server->rsize = nfs_block_size(data->rsize, NULL); - if (data->wsize) - server->wsize = nfs_block_size(data->wsize, NULL); + if (cfg->rsize) + server->rsize = nfs_block_size(cfg->rsize, NULL); + if (cfg->wsize) + server->wsize = nfs_block_size(cfg->wsize, NULL); - server->acregmin = data->acregmin * HZ; - server->acregmax = data->acregmax * HZ; - server->acdirmin = data->acdirmin * HZ; - server->acdirmax = data->acdirmax * HZ; - server->port = data->nfs_server.port; + server->acregmin = cfg->acregmin * HZ; + server->acregmax = cfg->acregmax * HZ; + server->acdirmin = cfg->acdirmin * HZ; + server->acdirmax = cfg->acdirmax * HZ; + server->port = cfg->nfs_server.port; return nfs_init_server_rpcclient(server, &timeparms, - data->selected_flavor); + cfg->selected_flavor); } /* * Create a version 4 volume record * - keyed on server and FSID */ -/*struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data, +/*struct nfs_server *nfs4_create_server(const struct nfs_sb_config *data, struct nfs_fh *mntfh)*/ struct nfs_server *nfs4_create_server(struct nfs_mount_info *mount_info, struct nfs_subversion *nfs_mod) @@ -1076,10 +1076,10 @@ struct nfs_server *nfs4_create_server(struct nfs_mount_info *mount_info, if (!server) return ERR_PTR(-ENOMEM); - auth_probe = mount_info->parsed->auth_info.flavor_len < 1; + auth_probe = mount_info->cfg->auth_info.flavor_len < 1; /* set up the general RPC client */ - error = nfs4_init_server(server, mount_info->parsed); + error = nfs4_init_server(server, mount_info->cfg); if (error < 0) goto error; diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index 6fb7cb6b3f4b..d160ccd89865 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c @@ -241,15 +241,15 @@ struct dentry *nfs4_try_mount(int flags, const char *dev_name, char *export_path; struct vfsmount *root_mnt; struct dentry *res; - struct nfs_parsed_mount_data *data = mount_info->parsed; + struct nfs_sb_config *cfg = mount_info->cfg; dfprintk(MOUNT, "--> nfs4_try_mount()\n"); - export_path = data->nfs_server.export_path; - data->nfs_server.export_path = "/"; + export_path = cfg->nfs_server.export_path; + cfg->nfs_server.export_path = "/"; root_mnt = nfs_do_root_mount(&nfs4_remote_fs_type, flags, mount_info, - data->nfs_server.hostname); - data->nfs_server.export_path = export_path; + cfg->nfs_server.hostname); + cfg->nfs_server.export_path = export_path; res = nfs_follow_remote_path(root_mnt, export_path); diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 1f39638f4d91..26c1fca31e6b 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -710,11 +710,11 @@ bool nfs_auth_info_match(const struct nfs_auth_info *auth_info, EXPORT_SYMBOL_GPL(nfs_auth_info_match); /* - * Ensure that a specified authtype in args->auth_info is supported by - * the server. Returns 0 and sets args->selected_flavor if it's ok, and + * Ensure that a specified authtype in cfg->auth_info is supported by + * the server. Returns 0 and sets cfg->selected_flavor if it's ok, and * -EACCES if not. */ -static int nfs_verify_authflavors(struct nfs_parsed_mount_data *args, +static int nfs_verify_authflavors(struct nfs_sb_config *cfg, rpc_authflavor_t *server_authlist, unsigned int count) { rpc_authflavor_t flavor = RPC_AUTH_MAXFLAVOR; @@ -732,7 +732,7 @@ static int nfs_verify_authflavors(struct nfs_parsed_mount_data *args, for (i = 0; i < count; i++) { flavor = server_authlist[i]; - if (nfs_auth_info_match(&args->auth_info, flavor)) + if (nfs_auth_info_match(&cfg->auth_info, flavor)) goto out; if (flavor == RPC_AUTH_NULL) @@ -749,8 +749,8 @@ static int nfs_verify_authflavors(struct nfs_parsed_mount_data *args, return -EACCES; out: - args->selected_flavor = flavor; - dfprintk(MOUNT, "NFS: using auth flavor %u\n", args->selected_flavor); + cfg->selected_flavor = flavor; + dfprintk(MOUNT, "NFS: using auth flavor %u\n", cfg->selected_flavor); return 0; } @@ -758,50 +758,50 @@ static int nfs_verify_authflavors(struct nfs_parsed_mount_data *args, * Use the remote server's MOUNT service to request the NFS file handle * corresponding to the provided path. */ -static int nfs_request_mount(struct nfs_parsed_mount_data *args, +static int nfs_request_mount(struct nfs_sb_config *cfg, struct nfs_fh *root_fh, rpc_authflavor_t *server_authlist, unsigned int *server_authlist_len) { struct nfs_mount_request request = { .sap = (struct sockaddr *) - &args->mount_server.address, - .dirpath = args->nfs_server.export_path, - .protocol = args->mount_server.protocol, + &cfg->mount_server.address, + .dirpath = cfg->nfs_server.export_path, + .protocol = cfg->mount_server.protocol, .fh = root_fh, - .noresvport = args->flags & NFS_MOUNT_NORESVPORT, + .noresvport = cfg->flags & NFS_MOUNT_NORESVPORT, .auth_flav_len = server_authlist_len, .auth_flavs = server_authlist, - .net = args->net, + .net = cfg->net, }; int status; - if (args->mount_server.version == 0) { - switch (args->version) { + if (cfg->mount_server.version == 0) { + switch (cfg->version) { default: - args->mount_server.version = NFS_MNT3_VERSION; + cfg->mount_server.version = NFS_MNT3_VERSION; break; case 2: - args->mount_server.version = NFS_MNT_VERSION; + cfg->mount_server.version = NFS_MNT_VERSION; } } - request.version = args->mount_server.version; + request.version = cfg->mount_server.version; - if (args->mount_server.hostname) - request.hostname = args->mount_server.hostname; + if (cfg->mount_server.hostname) + request.hostname = cfg->mount_server.hostname; else - request.hostname = args->nfs_server.hostname; + request.hostname = cfg->nfs_server.hostname; /* * Construct the mount server's address. */ - if (args->mount_server.address.ss_family == AF_UNSPEC) { - memcpy(request.sap, &args->nfs_server.address, - args->nfs_server.addrlen); - args->mount_server.addrlen = args->nfs_server.addrlen; + if (cfg->mount_server.address.ss_family == AF_UNSPEC) { + memcpy(request.sap, &cfg->nfs_server.address, + cfg->nfs_server.addrlen); + cfg->mount_server.addrlen = cfg->nfs_server.addrlen; } - request.salen = args->mount_server.addrlen; - nfs_set_port(request.sap, &args->mount_server.port, 0); + request.salen = cfg->mount_server.addrlen; + nfs_set_port(request.sap, &cfg->mount_server.port, 0); /* * Now ask the mount server to map our export path @@ -825,11 +825,11 @@ static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_inf bool tried_auth_unix = false; bool auth_null_in_list = false; struct nfs_server *server = ERR_PTR(-EACCES); - struct nfs_parsed_mount_data *args = mount_info->parsed; + struct nfs_sb_config *cfg = mount_info->cfg; rpc_authflavor_t authlist[NFS_MAX_SECFLAVORS]; unsigned int authlist_len = ARRAY_SIZE(authlist); - status = nfs_request_mount(args, mount_info->mntfh, authlist, + status = nfs_request_mount(cfg, mount_info->mntfh, authlist, &authlist_len); if (status) return ERR_PTR(status); @@ -838,10 +838,10 @@ static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_inf * Was a sec= authflavor specified in the options? First, verify * whether the server supports it, and then just try to use it if so. */ - if (args->auth_info.flavor_len > 0) { - status = nfs_verify_authflavors(args, authlist, authlist_len); + if (cfg->auth_info.flavor_len > 0) { + status = nfs_verify_authflavors(cfg, authlist, authlist_len); dfprintk(MOUNT, "NFS: using auth flavor %u\n", - args->selected_flavor); + cfg->selected_flavor); if (status) return ERR_PTR(status); return nfs_mod->rpc_ops->create_server(mount_info, nfs_mod); @@ -870,7 +870,7 @@ static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_inf /* Fallthrough */ } dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", flavor); - args->selected_flavor = flavor; + cfg->selected_flavor = flavor; server = nfs_mod->rpc_ops->create_server(mount_info, nfs_mod); if (!IS_ERR(server)) return server; @@ -886,7 +886,7 @@ static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_inf /* Last chance! Try AUTH_UNIX */ dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", RPC_AUTH_UNIX); - args->selected_flavor = RPC_AUTH_UNIX; + cfg->selected_flavor = RPC_AUTH_UNIX; return nfs_mod->rpc_ops->create_server(mount_info, nfs_mod); } @@ -896,7 +896,7 @@ struct dentry *nfs_try_mount(int flags, const char *dev_name, { struct nfs_server *server; - if (mount_info->parsed->need_mount) + if (mount_info->cfg->need_mount) server = nfs_try_mount_request(mount_info, nfs_mod); else server = nfs_mod->rpc_ops->create_server(mount_info, nfs_mod); @@ -923,23 +923,23 @@ EXPORT_SYMBOL_GPL(nfs_try_mount); static int nfs_compare_remount_data(struct nfs_server *nfss, - struct nfs_parsed_mount_data *data) + struct nfs_sb_config *cfg) { - if ((data->flags ^ nfss->flags) & NFS_REMOUNT_CMP_FLAGMASK || - data->rsize != nfss->rsize || - data->wsize != nfss->wsize || - data->version != nfss->nfs_client->rpc_ops->version || - data->minorversion != nfss->nfs_client->cl_minorversion || - data->retrans != nfss->client->cl_timeout->to_retries || - !nfs_auth_info_match(&data->auth_info, nfss->client->cl_auth->au_flavor) || - data->acregmin != nfss->acregmin / HZ || - data->acregmax != nfss->acregmax / HZ || - data->acdirmin != nfss->acdirmin / HZ || - data->acdirmax != nfss->acdirmax / HZ || - data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || - data->nfs_server.port != nfss->port || - data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || - !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address, + if ((cfg->flags ^ nfss->flags) & NFS_REMOUNT_CMP_FLAGMASK || + cfg->rsize != nfss->rsize || + cfg->wsize != nfss->wsize || + cfg->version != nfss->nfs_client->rpc_ops->version || + cfg->minorversion != nfss->nfs_client->cl_minorversion || + cfg->retrans != nfss->client->cl_timeout->to_retries || + !nfs_auth_info_match(&cfg->auth_info, nfss->client->cl_auth->au_flavor) || + cfg->acregmin != nfss->acregmin / HZ || + cfg->acregmax != nfss->acregmax / HZ || + cfg->acdirmin != nfss->acdirmin / HZ || + cfg->acdirmax != nfss->acdirmax / HZ || + cfg->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || + cfg->nfs_server.port != nfss->port || + cfg->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || + !rpc_cmp_addr((struct sockaddr *)&cfg->nfs_server.address, (struct sockaddr *)&nfss->nfs_client->cl_addr)) return -EINVAL; @@ -951,7 +951,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) { int error; struct nfs_server *nfss = sb->s_fs_info; - struct nfs_parsed_mount_data *data; + struct nfs_sb_config *cfg; struct nfs_mount_data *options = (struct nfs_mount_data *)raw_data; struct nfs4_mount_data *options4 = (struct nfs4_mount_data *)raw_data; u32 nfsvers = nfss->nfs_client->rpc_ops->version; @@ -969,32 +969,32 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) options->version <= 6)))) return 0; - data = kzalloc(sizeof(*data), GFP_KERNEL); - if (data == NULL) + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + if (cfg == NULL) return -ENOMEM; /* fill out struct with values from existing mount */ - data->flags = nfss->flags; - data->rsize = nfss->rsize; - data->wsize = nfss->wsize; - data->retrans = nfss->client->cl_timeout->to_retries; - data->selected_flavor = nfss->client->cl_auth->au_flavor; - data->acregmin = nfss->acregmin / HZ; - data->acregmax = nfss->acregmax / HZ; - data->acdirmin = nfss->acdirmin / HZ; - data->acdirmax = nfss->acdirmax / HZ; - data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; - data->nfs_server.port = nfss->port; - data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; - data->version = nfsvers; - data->minorversion = nfss->nfs_client->cl_minorversion; - data->net = current->nsproxy->net_ns; - memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr, - data->nfs_server.addrlen); + cfg->flags = nfss->flags; + cfg->rsize = nfss->rsize; + cfg->wsize = nfss->wsize; + cfg->retrans = nfss->client->cl_timeout->to_retries; + cfg->selected_flavor = nfss->client->cl_auth->au_flavor; + cfg->acregmin = nfss->acregmin / HZ; + cfg->acregmax = nfss->acregmax / HZ; + cfg->acdirmin = nfss->acdirmin / HZ; + cfg->acdirmax = nfss->acdirmax / HZ; + cfg->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; + cfg->nfs_server.port = nfss->port; + cfg->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; + cfg->version = nfsvers; + cfg->minorversion = nfss->nfs_client->cl_minorversion; + cfg->net = current->nsproxy->net_ns; + memcpy(&cfg->nfs_server.address, &nfss->nfs_client->cl_addr, + cfg->nfs_server.addrlen); /* overwrite those values with any that were specified */ error = -EINVAL; - if (!nfs_parse_mount_options((char *)options, data)) + if (!nfs_parse_mount_options((char *)options, cfg)) goto out; /* @@ -1003,13 +1003,13 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) * will clear MS_SYNCHRONOUS if -o sync wasn't specified in the * remount options, so we have to explicitly reset it. */ - if (data->flags & NFS_MOUNT_NOAC) + if (cfg->flags & NFS_MOUNT_NOAC) *flags |= MS_SYNCHRONOUS; /* compare new mount options with old ones */ - error = nfs_compare_remount_data(nfss, data); + error = nfs_compare_remount_data(nfss, cfg); out: - kfree(data); + kfree(cfg); return error; } EXPORT_SYMBOL_GPL(nfs_remount); @@ -1039,15 +1039,15 @@ inline void nfs_initialise_sb(struct super_block *sb) */ void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info) { - struct nfs_parsed_mount_data *data = mount_info->parsed; + struct nfs_sb_config *cfg = mount_info->cfg; struct nfs_server *server = NFS_SB(sb); sb->s_blocksize_bits = 0; sb->s_blocksize = 0; sb->s_xattr = server->nfs_client->cl_nfs_mod->xattr; sb->s_op = server->nfs_client->cl_nfs_mod->sops; - if (data && data->bsize) - sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits); + if (cfg && cfg->bsize) + sb->s_blocksize = nfs_block_size(cfg->bsize, &sb->s_blocksize_bits); if (server->nfs_client->rpc_ops->version != 2) { /* The VFS shouldn't apply the umask to mode bits. We will do @@ -1198,7 +1198,7 @@ static int nfs_compare_super(struct super_block *sb, void *data) #ifdef CONFIG_NFS_FSCACHE static void nfs_get_cache_cookie(struct super_block *sb, - struct nfs_parsed_mount_data *parsed, + struct nfs_sb_config *cfg, struct nfs_clone_mount *cloned) { struct nfs_server *nfss = NFS_SB(sb); @@ -1208,12 +1208,12 @@ static void nfs_get_cache_cookie(struct super_block *sb, nfss->fscache_key = NULL; nfss->fscache = NULL; - if (parsed) { - if (!(parsed->options & NFS_OPTION_FSCACHE)) + if (cfg) { + if (!(cfg->options & NFS_OPTION_FSCACHE)) return; - if (parsed->fscache_uniq) { - uniq = parsed->fscache_uniq; - ulen = strlen(parsed->fscache_uniq); + if (cfg->fscache_uniq) { + uniq = cfg->fscache_uniq; + ulen = strlen(cfg->fscache_uniq); } } else if (cloned) { struct nfs_server *mnt_s = NFS_SB(cloned->sb); @@ -1230,7 +1230,7 @@ static void nfs_get_cache_cookie(struct super_block *sb, } #else static void nfs_get_cache_cookie(struct super_block *sb, - struct nfs_parsed_mount_data *parsed, + struct nfs_sb_config *parsed, struct nfs_clone_mount *cloned) { } @@ -1244,7 +1244,7 @@ int nfs_set_sb_security(struct super_block *s, struct dentry *mntroot, if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL) kflags |= SECURITY_LSM_NATIVE_LABELS; - error = security_sb_set_mnt_opts(s, &mount_info->parsed->lsm_opts, + error = security_sb_set_mnt_opts(s, &mount_info->cfg->lsm_opts, kflags, &kflags_out); if (error) goto err; @@ -1316,7 +1316,7 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server, if (!s->s_root) { /* initial superblock/root creation */ mount_info->fill_super(s, mount_info); - nfs_get_cache_cookie(s, mount_info->parsed, mount_info->cloned); + nfs_get_cache_cookie(s, mount_info->cfg, mount_info->cloned); } mntroot = nfs_get_root(s, mount_info->mntfh, dev_name); @@ -1356,21 +1356,21 @@ struct dentry *nfs_fs_mount(struct file_system_type *fs_type, struct nfs_subversion *nfs_mod; int error; - mount_info.parsed = nfs_alloc_parsed_mount_data(); + mount_info.cfg = nfs_alloc_parsed_mount_data(); mount_info.mntfh = nfs_alloc_fhandle(); - if (mount_info.parsed == NULL || mount_info.mntfh == NULL) + if (mount_info.cfg == NULL || mount_info.mntfh == NULL) goto out; /* Validate the mount data */ - error = nfs_validate_mount_data(fs_type, raw_data, mount_info.parsed, mount_info.mntfh, dev_name); + error = nfs_validate_mount_data(fs_type, raw_data, mount_info.cfg, mount_info.mntfh, dev_name); if (error == NFS_TEXT_DATA) - error = nfs_validate_text_mount_data(raw_data, mount_info.parsed, dev_name); + error = nfs_validate_text_mount_data(raw_data, mount_info.cfg, dev_name); if (error < 0) { mntroot = ERR_PTR(error); goto out; } - nfs_mod = get_nfs_version(mount_info.parsed->version); + nfs_mod = get_nfs_version(mount_info.cfg->version); if (IS_ERR(nfs_mod)) { mntroot = ERR_CAST(nfs_mod); goto out; @@ -1380,7 +1380,7 @@ struct dentry *nfs_fs_mount(struct file_system_type *fs_type, put_nfs_version(nfs_mod); out: - nfs_free_parsed_mount_data(mount_info.parsed); + nfs_free_parsed_mount_data(mount_info.cfg); nfs_free_fhandle(mount_info.mntfh); return mntroot; } -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html