NFS: Additional refactoring for fs_context conversion
Split out from commit "NFS: Add fs_context support." This patch adds additional refactoring for the conversion of NFS to use fs_context, namely: (*) Merge nfs_mount_info and nfs_clone_mount into nfs_fs_context. nfs_clone_mount has had several fields removed, and nfs_mount_info has been removed altogether. (*) Various functions now take an fs_context as an argument instead of nfs_mount_info, nfs_fs_context, etc. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
f2aedb713c
commit
62a55d088c
|
@ -658,17 +658,17 @@ EXPORT_SYMBOL_GPL(nfs_init_client);
|
||||||
* Create a version 2 or 3 client
|
* Create a version 2 or 3 client
|
||||||
*/
|
*/
|
||||||
static int nfs_init_server(struct nfs_server *server,
|
static int nfs_init_server(struct nfs_server *server,
|
||||||
const struct nfs_fs_context *ctx,
|
const struct fs_context *fc)
|
||||||
struct nfs_subversion *nfs_mod)
|
|
||||||
{
|
{
|
||||||
|
const struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct rpc_timeout timeparms;
|
struct rpc_timeout timeparms;
|
||||||
struct nfs_client_initdata cl_init = {
|
struct nfs_client_initdata cl_init = {
|
||||||
.hostname = ctx->nfs_server.hostname,
|
.hostname = ctx->nfs_server.hostname,
|
||||||
.addr = (const struct sockaddr *)&ctx->nfs_server.address,
|
.addr = (const struct sockaddr *)&ctx->nfs_server.address,
|
||||||
.addrlen = ctx->nfs_server.addrlen,
|
.addrlen = ctx->nfs_server.addrlen,
|
||||||
.nfs_mod = nfs_mod,
|
.nfs_mod = ctx->nfs_mod,
|
||||||
.proto = ctx->nfs_server.protocol,
|
.proto = ctx->nfs_server.protocol,
|
||||||
.net = ctx->net,
|
.net = fc->net_ns,
|
||||||
.timeparms = &timeparms,
|
.timeparms = &timeparms,
|
||||||
.cred = server->cred,
|
.cred = server->cred,
|
||||||
.nconnect = ctx->nfs_server.nconnect,
|
.nconnect = ctx->nfs_server.nconnect,
|
||||||
|
@ -951,10 +951,10 @@ EXPORT_SYMBOL_GPL(nfs_free_server);
|
||||||
* Create a version 2 or 3 volume record
|
* Create a version 2 or 3 volume record
|
||||||
* - keyed on server and FSID
|
* - keyed on server and FSID
|
||||||
*/
|
*/
|
||||||
struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info)
|
struct nfs_server *nfs_create_server(struct fs_context *fc)
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct nfs_server *server;
|
struct nfs_server *server;
|
||||||
struct nfs_subversion *nfs_mod = mount_info->nfs_mod;
|
|
||||||
struct nfs_fattr *fattr;
|
struct nfs_fattr *fattr;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -970,18 +970,18 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Get a client representation */
|
/* Get a client representation */
|
||||||
error = nfs_init_server(server, mount_info->ctx, nfs_mod);
|
error = nfs_init_server(server, fc);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Probe the root fh to retrieve its FSID */
|
/* Probe the root fh to retrieve its FSID */
|
||||||
error = nfs_probe_fsinfo(server, mount_info->mntfh, fattr);
|
error = nfs_probe_fsinfo(server, ctx->mntfh, fattr);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
if (server->nfs_client->rpc_ops->version == 3) {
|
if (server->nfs_client->rpc_ops->version == 3) {
|
||||||
if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN)
|
if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN)
|
||||||
server->namelen = NFS3_MAXNAMLEN;
|
server->namelen = NFS3_MAXNAMLEN;
|
||||||
if (!(mount_info->ctx->flags & NFS_MOUNT_NORDIRPLUS))
|
if (!(ctx->flags & NFS_MOUNT_NORDIRPLUS))
|
||||||
server->caps |= NFS_CAP_READDIRPLUS;
|
server->caps |= NFS_CAP_READDIRPLUS;
|
||||||
} else {
|
} else {
|
||||||
if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN)
|
if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN)
|
||||||
|
@ -989,7 +989,7 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fattr->valid & NFS_ATTR_FATTR)) {
|
if (!(fattr->valid & NFS_ATTR_FATTR)) {
|
||||||
error = nfs_mod->rpc_ops->getattr(server, mount_info->mntfh,
|
error = ctx->nfs_mod->rpc_ops->getattr(server, ctx->mntfh,
|
||||||
fattr, NULL, NULL);
|
fattr, NULL, NULL);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
dprintk("nfs_create_server: getattr error = %d\n", -error);
|
dprintk("nfs_create_server: getattr error = %d\n", -error);
|
||||||
|
|
|
@ -241,43 +241,6 @@ static const struct constant_table nfs_secflavor_tokens[] = {
|
||||||
{ "sys", Opt_sec_sys },
|
{ "sys", Opt_sec_sys },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nfs_fs_context *nfs_alloc_parsed_mount_data(void)
|
|
||||||
{
|
|
||||||
struct nfs_fs_context *ctx;
|
|
||||||
|
|
||||||
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
|
|
||||||
if (ctx) {
|
|
||||||
ctx->timeo = NFS_UNSPEC_TIMEO;
|
|
||||||
ctx->retrans = NFS_UNSPEC_RETRANS;
|
|
||||||
ctx->acregmin = NFS_DEF_ACREGMIN;
|
|
||||||
ctx->acregmax = NFS_DEF_ACREGMAX;
|
|
||||||
ctx->acdirmin = NFS_DEF_ACDIRMIN;
|
|
||||||
ctx->acdirmax = NFS_DEF_ACDIRMAX;
|
|
||||||
ctx->mount_server.port = NFS_UNSPEC_PORT;
|
|
||||||
ctx->nfs_server.port = NFS_UNSPEC_PORT;
|
|
||||||
ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
|
|
||||||
ctx->selected_flavor = RPC_AUTH_MAXFLAVOR;
|
|
||||||
ctx->minorversion = 0;
|
|
||||||
ctx->need_mount = true;
|
|
||||||
ctx->net = current->nsproxy->net_ns;
|
|
||||||
ctx->lsm_opts = NULL;
|
|
||||||
}
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nfs_free_parsed_mount_data(struct nfs_fs_context *ctx)
|
|
||||||
{
|
|
||||||
if (ctx) {
|
|
||||||
kfree(ctx->client_address);
|
|
||||||
kfree(ctx->mount_server.hostname);
|
|
||||||
kfree(ctx->nfs_server.export_path);
|
|
||||||
kfree(ctx->nfs_server.hostname);
|
|
||||||
kfree(ctx->fscache_uniq);
|
|
||||||
security_free_mnt_opts(&ctx->lsm_opts);
|
|
||||||
kfree(ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sanity-check a server address provided by the mount command.
|
* Sanity-check a server address provided by the mount command.
|
||||||
*
|
*
|
||||||
|
@ -342,7 +305,7 @@ static void nfs_set_mount_transport_protocol(struct nfs_fs_context *ctx)
|
||||||
* Add 'flavor' to 'auth_info' if not already present.
|
* Add 'flavor' to 'auth_info' if not already present.
|
||||||
* Returns true if 'flavor' ends up in the list, false otherwise
|
* Returns true if 'flavor' ends up in the list, false otherwise
|
||||||
*/
|
*/
|
||||||
static int nfs_auth_info_add(struct nfs_fs_context *ctx,
|
static int nfs_auth_info_add(struct fs_context *fc,
|
||||||
struct nfs_auth_info *auth_info,
|
struct nfs_auth_info *auth_info,
|
||||||
rpc_authflavor_t flavor)
|
rpc_authflavor_t flavor)
|
||||||
{
|
{
|
||||||
|
@ -367,9 +330,10 @@ static int nfs_auth_info_add(struct nfs_fs_context *ctx,
|
||||||
/*
|
/*
|
||||||
* Parse the value of the 'sec=' option.
|
* Parse the value of the 'sec=' option.
|
||||||
*/
|
*/
|
||||||
static int nfs_parse_security_flavors(struct nfs_fs_context *ctx,
|
static int nfs_parse_security_flavors(struct fs_context *fc,
|
||||||
struct fs_parameter *param)
|
struct fs_parameter *param)
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
rpc_authflavor_t pseudoflavor;
|
rpc_authflavor_t pseudoflavor;
|
||||||
char *string = param->string, *p;
|
char *string = param->string, *p;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -419,7 +383,7 @@ static int nfs_parse_security_flavors(struct nfs_fs_context *ctx,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nfs_auth_info_add(ctx, &ctx->auth_info, pseudoflavor);
|
ret = nfs_auth_info_add(fc, &ctx->auth_info, pseudoflavor);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -427,9 +391,11 @@ static int nfs_parse_security_flavors(struct nfs_fs_context *ctx,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfs_parse_version_string(struct nfs_fs_context *ctx,
|
static int nfs_parse_version_string(struct fs_context *fc,
|
||||||
const char *string)
|
const char *string)
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
|
|
||||||
ctx->flags &= ~NFS_MOUNT_VER3;
|
ctx->flags &= ~NFS_MOUNT_VER3;
|
||||||
switch (lookup_constant(nfs_vers_tokens, string, -1)) {
|
switch (lookup_constant(nfs_vers_tokens, string, -1)) {
|
||||||
case Opt_vers_2:
|
case Opt_vers_2:
|
||||||
|
@ -656,17 +622,17 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
|
||||||
* options that take text values
|
* options that take text values
|
||||||
*/
|
*/
|
||||||
case Opt_v:
|
case Opt_v:
|
||||||
ret = nfs_parse_version_string(ctx, param->key + 1);
|
ret = nfs_parse_version_string(fc, param->key + 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
case Opt_vers:
|
case Opt_vers:
|
||||||
ret = nfs_parse_version_string(ctx, param->string);
|
ret = nfs_parse_version_string(fc, param->string);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
case Opt_sec:
|
case Opt_sec:
|
||||||
ret = nfs_parse_security_flavors(ctx, param);
|
ret = nfs_parse_security_flavors(fc, param);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
|
@ -729,7 +695,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Opt_addr:
|
case Opt_addr:
|
||||||
len = rpc_pton(ctx->net, param->string, param->size,
|
len = rpc_pton(fc->net_ns, param->string, param->size,
|
||||||
&ctx->nfs_server.address,
|
&ctx->nfs_server.address,
|
||||||
sizeof(ctx->nfs_server._address));
|
sizeof(ctx->nfs_server._address));
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
|
@ -747,7 +713,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
|
||||||
param->string = NULL;
|
param->string = NULL;
|
||||||
break;
|
break;
|
||||||
case Opt_mountaddr:
|
case Opt_mountaddr:
|
||||||
len = rpc_pton(ctx->net, param->string, param->size,
|
len = rpc_pton(fc->net_ns, param->string, param->size,
|
||||||
&ctx->mount_server.address,
|
&ctx->mount_server.address,
|
||||||
sizeof(ctx->mount_server._address));
|
sizeof(ctx->mount_server._address));
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
|
@ -819,7 +785,7 @@ out_of_bounds:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Split "dev_name" into "hostname:export_path".
|
* Split fc->source into "hostname:export_path".
|
||||||
*
|
*
|
||||||
* The leftmost colon demarks the split between the server's hostname
|
* The leftmost colon demarks the split between the server's hostname
|
||||||
* and the export path. If the hostname starts with a left square
|
* and the export path. If the hostname starts with a left square
|
||||||
|
@ -827,12 +793,13 @@ out_of_bounds:
|
||||||
*
|
*
|
||||||
* Note: caller frees hostname and export path, even on error.
|
* Note: caller frees hostname and export path, even on error.
|
||||||
*/
|
*/
|
||||||
static int nfs_parse_devname(struct nfs_fs_context *ctx,
|
static int nfs_parse_source(struct fs_context *fc,
|
||||||
const char *dev_name,
|
|
||||||
size_t maxnamlen, size_t maxpathlen)
|
size_t maxnamlen, size_t maxpathlen)
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
|
const char *dev_name = fc->source;
|
||||||
size_t len;
|
size_t len;
|
||||||
char *end;
|
const char *end;
|
||||||
|
|
||||||
if (unlikely(!dev_name || !*dev_name)) {
|
if (unlikely(!dev_name || !*dev_name)) {
|
||||||
dfprintk(MOUNT, "NFS: device name not specified\n");
|
dfprintk(MOUNT, "NFS: device name not specified\n");
|
||||||
|
@ -848,7 +815,7 @@ static int nfs_parse_devname(struct nfs_fs_context *ctx,
|
||||||
len = end - dev_name;
|
len = end - dev_name;
|
||||||
end++;
|
end++;
|
||||||
} else {
|
} else {
|
||||||
char *comma;
|
const char *comma;
|
||||||
|
|
||||||
end = strchr(dev_name, ':');
|
end = strchr(dev_name, ':');
|
||||||
if (end == NULL)
|
if (end == NULL)
|
||||||
|
@ -856,8 +823,8 @@ static int nfs_parse_devname(struct nfs_fs_context *ctx,
|
||||||
len = end - dev_name;
|
len = end - dev_name;
|
||||||
|
|
||||||
/* kill possible hostname list: not supported */
|
/* kill possible hostname list: not supported */
|
||||||
comma = strchr(dev_name, ',');
|
comma = memchr(dev_name, ',', len);
|
||||||
if (comma != NULL && comma < end)
|
if (comma)
|
||||||
len = comma - dev_name;
|
len = comma - dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +887,7 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
|
||||||
struct nfs_mount_data *data)
|
struct nfs_mount_data *data)
|
||||||
{
|
{
|
||||||
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct nfs_fh *mntfh = ctx->mount_info.mntfh;
|
struct nfs_fh *mntfh = ctx->mntfh;
|
||||||
struct sockaddr *sap = (struct sockaddr *)&ctx->nfs_server.address;
|
struct sockaddr *sap = (struct sockaddr *)&ctx->nfs_server.address;
|
||||||
int extra_flags = NFS_MOUNT_LEGACY_INTERFACE;
|
int extra_flags = NFS_MOUNT_LEGACY_INTERFACE;
|
||||||
|
|
||||||
|
@ -1009,6 +976,7 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
|
||||||
else
|
else
|
||||||
ctx->flags |= (NFS_MOUNT_LOCAL_FLOCK|
|
ctx->flags |= (NFS_MOUNT_LOCAL_FLOCK|
|
||||||
NFS_MOUNT_LOCAL_FCNTL);
|
NFS_MOUNT_LOCAL_FCNTL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The legacy version 6 binary mount data from userspace has a
|
* The legacy version 6 binary mount data from userspace has a
|
||||||
* field used only to transport selinux information into the
|
* field used only to transport selinux information into the
|
||||||
|
@ -1073,12 +1041,6 @@ out_invalid_fh:
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_NFS_V4)
|
#if IS_ENABLED(CONFIG_NFS_V4)
|
||||||
static void nfs4_validate_mount_flags(struct nfs_fs_context *ctx)
|
|
||||||
{
|
|
||||||
ctx->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3|
|
|
||||||
NFS_MOUNT_LOCAL_FLOCK|NFS_MOUNT_LOCAL_FCNTL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate NFSv4 mount options
|
* Validate NFSv4 mount options
|
||||||
*/
|
*/
|
||||||
|
@ -1251,7 +1213,7 @@ static int nfs_fs_context_validate(struct fs_context *fc)
|
||||||
goto out_no_address;
|
goto out_no_address;
|
||||||
|
|
||||||
if (ctx->version == 4) {
|
if (ctx->version == 4) {
|
||||||
#if IS_ENABLED(CONFIG_NFS_V4)
|
if (IS_ENABLED(CONFIG_NFS_V4)) {
|
||||||
if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
|
if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
|
||||||
port = NFS_RDMA_PORT;
|
port = NFS_RDMA_PORT;
|
||||||
else
|
else
|
||||||
|
@ -1261,10 +1223,12 @@ static int nfs_fs_context_validate(struct fs_context *fc)
|
||||||
nfs_validate_transport_protocol(ctx);
|
nfs_validate_transport_protocol(ctx);
|
||||||
if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
|
if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
|
||||||
goto out_invalid_transport_udp;
|
goto out_invalid_transport_udp;
|
||||||
nfs4_validate_mount_flags(ctx);
|
ctx->flags &= ~(NFS_MOUNT_NONLM | NFS_MOUNT_NOACL |
|
||||||
#else
|
NFS_MOUNT_VER3 | NFS_MOUNT_LOCAL_FLOCK |
|
||||||
|
NFS_MOUNT_LOCAL_FCNTL);
|
||||||
|
} else {
|
||||||
goto out_v4_not_compiled;
|
goto out_v4_not_compiled;
|
||||||
#endif /* CONFIG_NFS_V4 */
|
}
|
||||||
} else {
|
} else {
|
||||||
nfs_set_mount_transport_protocol(ctx);
|
nfs_set_mount_transport_protocol(ctx);
|
||||||
if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
|
if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
|
||||||
|
@ -1273,33 +1237,30 @@ static int nfs_fs_context_validate(struct fs_context *fc)
|
||||||
|
|
||||||
nfs_set_port(sap, &ctx->nfs_server.port, port);
|
nfs_set_port(sap, &ctx->nfs_server.port, port);
|
||||||
|
|
||||||
ret = nfs_parse_devname(ctx, fc->source, max_namelen, max_pathlen);
|
ret = nfs_parse_source(fc, max_namelen, max_pathlen);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Load the NFS protocol module if we haven't done so yet */
|
/* Load the NFS protocol module if we haven't done so yet */
|
||||||
if (!ctx->mount_info.nfs_mod) {
|
if (!ctx->nfs_mod) {
|
||||||
nfs_mod = get_nfs_version(ctx->version);
|
nfs_mod = get_nfs_version(ctx->version);
|
||||||
if (IS_ERR(nfs_mod)) {
|
if (IS_ERR(nfs_mod)) {
|
||||||
ret = PTR_ERR(nfs_mod);
|
ret = PTR_ERR(nfs_mod);
|
||||||
goto out_version_unavailable;
|
goto out_version_unavailable;
|
||||||
}
|
}
|
||||||
ctx->mount_info.nfs_mod = nfs_mod;
|
ctx->nfs_mod = nfs_mod;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_no_device_name:
|
out_no_device_name:
|
||||||
dfprintk(MOUNT, "NFS: Device name not specified\n");
|
dfprintk(MOUNT, "NFS: Device name not specified\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#if !IS_ENABLED(CONFIG_NFS_V4)
|
|
||||||
out_v4_not_compiled:
|
out_v4_not_compiled:
|
||||||
dfprintk(MOUNT, "NFS: NFSv4 is not compiled into kernel\n");
|
dfprintk(MOUNT, "NFS: NFSv4 is not compiled into kernel\n");
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
#else
|
|
||||||
out_invalid_transport_udp:
|
out_invalid_transport_udp:
|
||||||
dfprintk(MOUNT, "NFSv4: Unsupported transport protocol udp\n");
|
dfprintk(MOUNT, "NFSv4: Unsupported transport protocol udp\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#endif /* !CONFIG_NFS_V4 */
|
|
||||||
out_no_address:
|
out_no_address:
|
||||||
dfprintk(MOUNT, "NFS: mount program didn't pass remote address\n");
|
dfprintk(MOUNT, "NFS: mount program didn't pass remote address\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1332,7 +1293,7 @@ static int nfs_get_tree(struct fs_context *fc)
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
if (!ctx->internal)
|
if (!ctx->internal)
|
||||||
return ctx->mount_info.nfs_mod->rpc_ops->try_get_tree(fc);
|
return ctx->nfs_mod->rpc_ops->try_get_tree(fc);
|
||||||
else
|
else
|
||||||
return nfs_get_tree_common(fc);
|
return nfs_get_tree_common(fc);
|
||||||
}
|
}
|
||||||
|
@ -1351,20 +1312,19 @@ static int nfs_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc)
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ctx->mount_info.mntfh = nfs_alloc_fhandle();
|
ctx->mntfh = nfs_alloc_fhandle();
|
||||||
if (!ctx->mount_info.mntfh) {
|
if (!ctx->mntfh) {
|
||||||
kfree(ctx);
|
kfree(ctx);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
nfs_copy_fh(ctx->mount_info.mntfh, src->mount_info.mntfh);
|
nfs_copy_fh(ctx->mntfh, src->mntfh);
|
||||||
|
|
||||||
__module_get(ctx->mount_info.nfs_mod->owner);
|
__module_get(ctx->nfs_mod->owner);
|
||||||
ctx->client_address = NULL;
|
ctx->client_address = NULL;
|
||||||
ctx->mount_server.hostname = NULL;
|
ctx->mount_server.hostname = NULL;
|
||||||
ctx->nfs_server.export_path = NULL;
|
ctx->nfs_server.export_path = NULL;
|
||||||
ctx->nfs_server.hostname = NULL;
|
ctx->nfs_server.hostname = NULL;
|
||||||
ctx->fscache_uniq = NULL;
|
ctx->fscache_uniq = NULL;
|
||||||
ctx->clone_data.addr = NULL;
|
|
||||||
ctx->clone_data.fattr = NULL;
|
ctx->clone_data.fattr = NULL;
|
||||||
fc->fs_private = ctx;
|
fc->fs_private = ctx;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1375,17 +1335,16 @@ static void nfs_fs_context_free(struct fs_context *fc)
|
||||||
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
|
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (ctx->mount_info.server)
|
if (ctx->server)
|
||||||
nfs_free_server(ctx->mount_info.server);
|
nfs_free_server(ctx->server);
|
||||||
if (ctx->mount_info.nfs_mod)
|
if (ctx->nfs_mod)
|
||||||
put_nfs_version(ctx->mount_info.nfs_mod);
|
put_nfs_version(ctx->nfs_mod);
|
||||||
kfree(ctx->client_address);
|
kfree(ctx->client_address);
|
||||||
kfree(ctx->mount_server.hostname);
|
kfree(ctx->mount_server.hostname);
|
||||||
kfree(ctx->nfs_server.export_path);
|
kfree(ctx->nfs_server.export_path);
|
||||||
kfree(ctx->nfs_server.hostname);
|
kfree(ctx->nfs_server.hostname);
|
||||||
kfree(ctx->fscache_uniq);
|
kfree(ctx->fscache_uniq);
|
||||||
nfs_free_fhandle(ctx->mount_info.mntfh);
|
nfs_free_fhandle(ctx->mntfh);
|
||||||
kfree(ctx->clone_data.addr);
|
|
||||||
nfs_free_fattr(ctx->clone_data.fattr);
|
nfs_free_fattr(ctx->clone_data.fattr);
|
||||||
kfree(ctx);
|
kfree(ctx);
|
||||||
}
|
}
|
||||||
|
@ -1413,9 +1372,8 @@ static int nfs_init_fs_context(struct fs_context *fc)
|
||||||
if (unlikely(!ctx))
|
if (unlikely(!ctx))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ctx->mount_info.ctx = ctx;
|
ctx->mntfh = nfs_alloc_fhandle();
|
||||||
ctx->mount_info.mntfh = nfs_alloc_fhandle();
|
if (unlikely(!ctx->mntfh)) {
|
||||||
if (unlikely(!ctx->mount_info.mntfh)) {
|
|
||||||
kfree(ctx);
|
kfree(ctx);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -1452,8 +1410,8 @@ static int nfs_init_fs_context(struct fs_context *fc)
|
||||||
fc->net_ns = get_net(net);
|
fc->net_ns = get_net(net);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->mount_info.nfs_mod = nfss->nfs_client->cl_nfs_mod;
|
ctx->nfs_mod = nfss->nfs_client->cl_nfs_mod;
|
||||||
__module_get(ctx->mount_info.nfs_mod->owner);
|
__module_get(ctx->nfs_mod->owner);
|
||||||
} else {
|
} else {
|
||||||
/* defaults */
|
/* defaults */
|
||||||
ctx->timeo = NFS_UNSPEC_TIMEO;
|
ctx->timeo = NFS_UNSPEC_TIMEO;
|
||||||
|
@ -1468,7 +1426,6 @@ static int nfs_init_fs_context(struct fs_context *fc)
|
||||||
ctx->minorversion = 0;
|
ctx->minorversion = 0;
|
||||||
ctx->need_mount = true;
|
ctx->need_mount = true;
|
||||||
}
|
}
|
||||||
ctx->net = fc->net_ns;
|
|
||||||
fc->fs_private = ctx;
|
fc->fs_private = ctx;
|
||||||
fc->ops = &nfs_fs_context_ops;
|
fc->ops = &nfs_fs_context_ops;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -128,7 +128,7 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int
|
||||||
return;
|
return;
|
||||||
|
|
||||||
key->nfs_client = nfss->nfs_client;
|
key->nfs_client = nfss->nfs_client;
|
||||||
key->key.super.s_flags = sb->s_flags & NFS_MS_MASK;
|
key->key.super.s_flags = sb->s_flags & NFS_SB_MASK;
|
||||||
key->key.nfs_server.flags = nfss->flags;
|
key->key.nfs_server.flags = nfss->flags;
|
||||||
key->key.nfs_server.rsize = nfss->rsize;
|
key->key.nfs_server.rsize = nfss->rsize;
|
||||||
key->key.nfs_server.wsize = nfss->wsize;
|
key->key.nfs_server.wsize = nfss->wsize;
|
||||||
|
|
|
@ -64,66 +64,68 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
|
||||||
/*
|
/*
|
||||||
* get an NFS2/NFS3 root dentry from the root filehandle
|
* get an NFS2/NFS3 root dentry from the root filehandle
|
||||||
*/
|
*/
|
||||||
struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh,
|
int nfs_get_root(struct super_block *s, struct fs_context *fc)
|
||||||
const char *devname)
|
|
||||||
{
|
{
|
||||||
struct nfs_server *server = NFS_SB(sb);
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
|
struct nfs_server *server = NFS_SB(s);
|
||||||
struct nfs_fsinfo fsinfo;
|
struct nfs_fsinfo fsinfo;
|
||||||
struct dentry *ret;
|
struct dentry *root;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
void *name = kstrdup(devname, GFP_KERNEL);
|
char *name;
|
||||||
int error;
|
int error = -ENOMEM;
|
||||||
|
|
||||||
|
name = kstrdup(fc->source, GFP_KERNEL);
|
||||||
if (!name)
|
if (!name)
|
||||||
return ERR_PTR(-ENOMEM);
|
goto out;
|
||||||
|
|
||||||
/* get the actual root for this mount */
|
/* get the actual root for this mount */
|
||||||
fsinfo.fattr = nfs_alloc_fattr();
|
fsinfo.fattr = nfs_alloc_fattr();
|
||||||
if (fsinfo.fattr == NULL) {
|
if (fsinfo.fattr == NULL)
|
||||||
kfree(name);
|
goto out_name;
|
||||||
return ERR_PTR(-ENOMEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
error = server->nfs_client->rpc_ops->getroot(server, mntfh, &fsinfo);
|
error = server->nfs_client->rpc_ops->getroot(server, ctx->mntfh, &fsinfo);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
dprintk("nfs_get_root: getattr error = %d\n", -error);
|
dprintk("nfs_get_root: getattr error = %d\n", -error);
|
||||||
ret = ERR_PTR(error);
|
goto out_fattr;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = nfs_fhget(sb, mntfh, fsinfo.fattr, NULL);
|
inode = nfs_fhget(s, ctx->mntfh, fsinfo.fattr, NULL);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
dprintk("nfs_get_root: get root inode failed\n");
|
dprintk("nfs_get_root: get root inode failed\n");
|
||||||
ret = ERR_CAST(inode);
|
error = PTR_ERR(inode);
|
||||||
goto out;
|
goto out_fattr;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = nfs_superblock_set_dummy_root(sb, inode);
|
error = nfs_superblock_set_dummy_root(s, inode);
|
||||||
if (error != 0) {
|
if (error != 0)
|
||||||
ret = ERR_PTR(error);
|
goto out_fattr;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* root dentries normally start off anonymous and get spliced in later
|
/* root dentries normally start off anonymous and get spliced in later
|
||||||
* if the dentry tree reaches them; however if the dentry already
|
* if the dentry tree reaches them; however if the dentry already
|
||||||
* exists, we'll pick it up at this point and use it as the root
|
* exists, we'll pick it up at this point and use it as the root
|
||||||
*/
|
*/
|
||||||
ret = d_obtain_root(inode);
|
root = d_obtain_root(inode);
|
||||||
if (IS_ERR(ret)) {
|
if (IS_ERR(root)) {
|
||||||
dprintk("nfs_get_root: get root dentry failed\n");
|
dprintk("nfs_get_root: get root dentry failed\n");
|
||||||
goto out;
|
error = PTR_ERR(root);
|
||||||
|
goto out_fattr;
|
||||||
}
|
}
|
||||||
|
|
||||||
security_d_instantiate(ret, inode);
|
security_d_instantiate(root, inode);
|
||||||
spin_lock(&ret->d_lock);
|
spin_lock(&root->d_lock);
|
||||||
if (IS_ROOT(ret) && !ret->d_fsdata &&
|
if (IS_ROOT(root) && !root->d_fsdata &&
|
||||||
!(ret->d_flags & DCACHE_NFSFS_RENAMED)) {
|
!(root->d_flags & DCACHE_NFSFS_RENAMED)) {
|
||||||
ret->d_fsdata = name;
|
root->d_fsdata = name;
|
||||||
name = NULL;
|
name = NULL;
|
||||||
}
|
}
|
||||||
spin_unlock(&ret->d_lock);
|
spin_unlock(&root->d_lock);
|
||||||
out:
|
fc->root = root;
|
||||||
kfree(name);
|
error = 0;
|
||||||
|
|
||||||
|
out_fattr:
|
||||||
nfs_free_fattr(fsinfo.fattr);
|
nfs_free_fattr(fsinfo.fattr);
|
||||||
return ret;
|
out_name:
|
||||||
|
kfree(name);
|
||||||
|
out:
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <linux/nfs_page.h>
|
#include <linux/nfs_page.h>
|
||||||
#include <linux/wait_bit.h>
|
#include <linux/wait_bit.h>
|
||||||
|
|
||||||
#define NFS_MS_MASK (SB_RDONLY|SB_NOSUID|SB_NODEV|SB_NOEXEC|SB_SYNCHRONOUS)
|
#define NFS_SB_MASK (SB_RDONLY|SB_NOSUID|SB_NODEV|SB_NOEXEC|SB_SYNCHRONOUS)
|
||||||
|
|
||||||
extern const struct export_operations nfs_export_ops;
|
extern const struct export_operations nfs_export_ops;
|
||||||
|
|
||||||
|
@ -33,17 +33,6 @@ static inline int nfs_attr_use_mounted_on_fileid(struct nfs_fattr *fattr)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nfs_clone_mount {
|
|
||||||
const struct super_block *sb;
|
|
||||||
struct dentry *dentry;
|
|
||||||
char *hostname;
|
|
||||||
char *mnt_path;
|
|
||||||
struct sockaddr *addr;
|
|
||||||
size_t addrlen;
|
|
||||||
rpc_authflavor_t authflavor;
|
|
||||||
struct nfs_fattr *fattr;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: RFC 1813 doesn't limit the number of auth flavors that
|
* Note: RFC 1813 doesn't limit the number of auth flavors that
|
||||||
* a server can return, so make something up.
|
* a server can return, so make something up.
|
||||||
|
@ -80,15 +69,6 @@ struct nfs_client_initdata {
|
||||||
const struct cred *cred;
|
const struct cred *cred;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nfs_mount_info {
|
|
||||||
unsigned int inherited_bsize;
|
|
||||||
struct nfs_fs_context *ctx;
|
|
||||||
struct nfs_clone_mount *cloned;
|
|
||||||
struct nfs_server *server;
|
|
||||||
struct nfs_fh *mntfh;
|
|
||||||
struct nfs_subversion *nfs_mod;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In-kernel mount arguments
|
* In-kernel mount arguments
|
||||||
*/
|
*/
|
||||||
|
@ -140,13 +120,17 @@ struct nfs_fs_context {
|
||||||
unsigned short export_path_len;
|
unsigned short export_path_len;
|
||||||
} nfs_server;
|
} nfs_server;
|
||||||
|
|
||||||
void *lsm_opts;
|
struct nfs_fh *mntfh;
|
||||||
struct net *net;
|
struct nfs_server *server;
|
||||||
|
struct nfs_subversion *nfs_mod;
|
||||||
|
|
||||||
char buf[32]; /* Parse buffer */
|
/* Information for a cloned mount. */
|
||||||
|
struct nfs_clone_mount {
|
||||||
struct nfs_mount_info mount_info;
|
struct super_block *sb;
|
||||||
struct nfs_clone_mount clone_data;
|
struct dentry *dentry;
|
||||||
|
struct nfs_fattr *fattr;
|
||||||
|
unsigned int inherited_bsize;
|
||||||
|
} clone_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct nfs_fs_context *nfs_fc2context(const struct fs_context *fc)
|
static inline struct nfs_fs_context *nfs_fc2context(const struct fs_context *fc)
|
||||||
|
@ -194,10 +178,9 @@ extern struct nfs_client *nfs4_find_client_ident(struct net *, int);
|
||||||
extern struct nfs_client *
|
extern struct nfs_client *
|
||||||
nfs4_find_client_sessionid(struct net *, const struct sockaddr *,
|
nfs4_find_client_sessionid(struct net *, const struct sockaddr *,
|
||||||
struct nfs4_sessionid *, u32);
|
struct nfs4_sessionid *, u32);
|
||||||
extern struct nfs_server *nfs_create_server(struct nfs_mount_info *);
|
extern struct nfs_server *nfs_create_server(struct fs_context *);
|
||||||
extern struct nfs_server *nfs4_create_server(struct nfs_mount_info *);
|
extern struct nfs_server *nfs4_create_server(struct fs_context *);
|
||||||
extern struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *,
|
extern struct nfs_server *nfs4_create_referral_server(struct fs_context *);
|
||||||
struct nfs_fh *);
|
|
||||||
extern int nfs4_update_server(struct nfs_server *server, const char *hostname,
|
extern int nfs4_update_server(struct nfs_server *server, const char *hostname,
|
||||||
struct sockaddr *sap, size_t salen,
|
struct sockaddr *sap, size_t salen,
|
||||||
struct net *net);
|
struct net *net);
|
||||||
|
@ -444,12 +427,8 @@ int nfs_submount(struct fs_context *, struct nfs_server *);
|
||||||
int nfs_do_submount(struct fs_context *);
|
int nfs_do_submount(struct fs_context *);
|
||||||
|
|
||||||
/* getroot.c */
|
/* getroot.c */
|
||||||
extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *,
|
extern int nfs_get_root(struct super_block *s, struct fs_context *fc);
|
||||||
const char *);
|
|
||||||
#if IS_ENABLED(CONFIG_NFS_V4)
|
#if IS_ENABLED(CONFIG_NFS_V4)
|
||||||
extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *,
|
|
||||||
const char *);
|
|
||||||
|
|
||||||
extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh, bool);
|
extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh, bool);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,8 @@ struct vfsmount *nfs_d_automount(struct path *path)
|
||||||
|
|
||||||
ctx->version = client->rpc_ops->version;
|
ctx->version = client->rpc_ops->version;
|
||||||
ctx->minorversion = client->cl_minorversion;
|
ctx->minorversion = client->cl_minorversion;
|
||||||
ctx->mount_info.nfs_mod = client->cl_nfs_mod;
|
ctx->nfs_mod = client->cl_nfs_mod;
|
||||||
__module_get(ctx->mount_info.nfs_mod->owner);
|
__module_get(ctx->nfs_mod->owner);
|
||||||
|
|
||||||
ret = client->rpc_ops->submount(fc, server);
|
ret = client->rpc_ops->submount(fc, server);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -262,22 +262,22 @@ int nfs_do_submount(struct fs_context *fc)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* create a new volume representation */
|
/* create a new volume representation */
|
||||||
server = ctx->mount_info.nfs_mod->rpc_ops->clone_server(NFS_SB(ctx->clone_data.sb),
|
server = ctx->nfs_mod->rpc_ops->clone_server(NFS_SB(ctx->clone_data.sb),
|
||||||
ctx->mount_info.mntfh,
|
ctx->mntfh,
|
||||||
ctx->clone_data.fattr,
|
ctx->clone_data.fattr,
|
||||||
ctx->selected_flavor);
|
ctx->selected_flavor);
|
||||||
|
|
||||||
if (IS_ERR(server))
|
if (IS_ERR(server))
|
||||||
return PTR_ERR(server);
|
return PTR_ERR(server);
|
||||||
|
|
||||||
ctx->mount_info.server = server;
|
ctx->server = server;
|
||||||
|
|
||||||
buffer = kmalloc(4096, GFP_USER);
|
buffer = kmalloc(4096, GFP_USER);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ctx->internal = true;
|
ctx->internal = true;
|
||||||
ctx->mount_info.inherited_bsize = ctx->clone_data.sb->s_blocksize_bits;
|
ctx->clone_data.inherited_bsize = ctx->clone_data.sb->s_blocksize_bits;
|
||||||
|
|
||||||
p = nfs_devname(dentry, buffer, 4096);
|
p = nfs_devname(dentry, buffer, 4096);
|
||||||
if (IS_ERR(p)) {
|
if (IS_ERR(p)) {
|
||||||
|
@ -302,7 +302,7 @@ int nfs_submount(struct fs_context *fc, struct nfs_server *server)
|
||||||
|
|
||||||
/* Look it up again to get its attributes */
|
/* Look it up again to get its attributes */
|
||||||
err = server->nfs_client->rpc_ops->lookup(d_inode(parent), &dentry->d_name,
|
err = server->nfs_client->rpc_ops->lookup(d_inode(parent), &dentry->d_name,
|
||||||
ctx->mount_info.mntfh, ctx->clone_data.fattr,
|
ctx->mntfh, ctx->clone_data.fattr,
|
||||||
NULL);
|
NULL);
|
||||||
dput(parent);
|
dput(parent);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
|
|
|
@ -27,7 +27,7 @@ static inline int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
|
||||||
#endif /* CONFIG_NFS_V3_ACL */
|
#endif /* CONFIG_NFS_V3_ACL */
|
||||||
|
|
||||||
/* nfs3client.c */
|
/* nfs3client.c */
|
||||||
struct nfs_server *nfs3_create_server(struct nfs_mount_info *);
|
struct nfs_server *nfs3_create_server(struct fs_context *);
|
||||||
struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *,
|
struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *,
|
||||||
struct nfs_fattr *, rpc_authflavor_t);
|
struct nfs_fattr *, rpc_authflavor_t);
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,10 @@ static inline void nfs_init_server_aclclient(struct nfs_server *server)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct nfs_server *nfs3_create_server(struct nfs_mount_info *mount_info)
|
struct nfs_server *nfs3_create_server(struct fs_context *fc)
|
||||||
{
|
{
|
||||||
struct nfs_server *server = nfs_create_server(mount_info);
|
struct nfs_server *server = nfs_create_server(fc);
|
||||||
|
|
||||||
/* Create a client RPC handle for the NFS v3 ACL management interface */
|
/* Create a client RPC handle for the NFS v3 ACL management interface */
|
||||||
if (!IS_ERR(server))
|
if (!IS_ERR(server))
|
||||||
nfs_init_server_aclclient(server);
|
nfs_init_server_aclclient(server);
|
||||||
|
|
|
@ -1055,9 +1055,9 @@ out:
|
||||||
/*
|
/*
|
||||||
* Create a version 4 volume record
|
* Create a version 4 volume record
|
||||||
*/
|
*/
|
||||||
static int nfs4_init_server(struct nfs_server *server,
|
static int nfs4_init_server(struct nfs_server *server, struct fs_context *fc)
|
||||||
struct nfs_fs_context *ctx)
|
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct rpc_timeout timeparms;
|
struct rpc_timeout timeparms;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -1080,14 +1080,14 @@ static int nfs4_init_server(struct nfs_server *server,
|
||||||
/* Get a client record */
|
/* Get a client record */
|
||||||
error = nfs4_set_client(server,
|
error = nfs4_set_client(server,
|
||||||
ctx->nfs_server.hostname,
|
ctx->nfs_server.hostname,
|
||||||
(const struct sockaddr *)&ctx->nfs_server.address,
|
&ctx->nfs_server.address,
|
||||||
ctx->nfs_server.addrlen,
|
ctx->nfs_server.addrlen,
|
||||||
ctx->client_address,
|
ctx->client_address,
|
||||||
ctx->nfs_server.protocol,
|
ctx->nfs_server.protocol,
|
||||||
&timeparms,
|
&timeparms,
|
||||||
ctx->minorversion,
|
ctx->minorversion,
|
||||||
ctx->nfs_server.nconnect,
|
ctx->nfs_server.nconnect,
|
||||||
ctx->net);
|
fc->net_ns);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
@ -1110,10 +1110,9 @@ static int nfs4_init_server(struct nfs_server *server,
|
||||||
* Create a version 4 volume record
|
* Create a version 4 volume record
|
||||||
* - keyed on server and FSID
|
* - keyed on server and FSID
|
||||||
*/
|
*/
|
||||||
/*struct nfs_server *nfs4_create_server(const struct nfs_fs_context *data,
|
struct nfs_server *nfs4_create_server(struct fs_context *fc)
|
||||||
struct nfs_fh *mntfh)*/
|
|
||||||
struct nfs_server *nfs4_create_server(struct nfs_mount_info *mount_info)
|
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct nfs_server *server;
|
struct nfs_server *server;
|
||||||
bool auth_probe;
|
bool auth_probe;
|
||||||
int error;
|
int error;
|
||||||
|
@ -1124,14 +1123,14 @@ struct nfs_server *nfs4_create_server(struct nfs_mount_info *mount_info)
|
||||||
|
|
||||||
server->cred = get_cred(current_cred());
|
server->cred = get_cred(current_cred());
|
||||||
|
|
||||||
auth_probe = mount_info->ctx->auth_info.flavor_len < 1;
|
auth_probe = ctx->auth_info.flavor_len < 1;
|
||||||
|
|
||||||
/* set up the general RPC client */
|
/* set up the general RPC client */
|
||||||
error = nfs4_init_server(server, mount_info->ctx);
|
error = nfs4_init_server(server, fc);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
error = nfs4_server_common_setup(server, mount_info->mntfh, auth_probe);
|
error = nfs4_server_common_setup(server, ctx->mntfh, auth_probe);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -1145,9 +1144,9 @@ error:
|
||||||
/*
|
/*
|
||||||
* Create an NFS4 referral server record
|
* Create an NFS4 referral server record
|
||||||
*/
|
*/
|
||||||
struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
|
struct nfs_server *nfs4_create_referral_server(struct fs_context *fc)
|
||||||
struct nfs_fh *mntfh)
|
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct nfs_client *parent_client;
|
struct nfs_client *parent_client;
|
||||||
struct nfs_server *server, *parent_server;
|
struct nfs_server *server, *parent_server;
|
||||||
bool auth_probe;
|
bool auth_probe;
|
||||||
|
@ -1157,7 +1156,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
|
||||||
if (!server)
|
if (!server)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
parent_server = NFS_SB(data->sb);
|
parent_server = NFS_SB(ctx->clone_data.sb);
|
||||||
parent_client = parent_server->nfs_client;
|
parent_client = parent_server->nfs_client;
|
||||||
|
|
||||||
server->cred = get_cred(parent_server->cred);
|
server->cred = get_cred(parent_server->cred);
|
||||||
|
@ -1167,10 +1166,11 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
|
||||||
|
|
||||||
/* Get a client representation */
|
/* Get a client representation */
|
||||||
#if IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA)
|
#if IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA)
|
||||||
rpc_set_port(data->addr, NFS_RDMA_PORT);
|
rpc_set_port(&ctx->nfs_server.address, NFS_RDMA_PORT);
|
||||||
error = nfs4_set_client(server, data->hostname,
|
error = nfs4_set_client(server,
|
||||||
data->addr,
|
ctx->nfs_server.hostname,
|
||||||
data->addrlen,
|
&ctx->nfs_server.address,
|
||||||
|
ctx->nfs_server.addrlen,
|
||||||
parent_client->cl_ipaddr,
|
parent_client->cl_ipaddr,
|
||||||
XPRT_TRANSPORT_RDMA,
|
XPRT_TRANSPORT_RDMA,
|
||||||
parent_server->client->cl_timeout,
|
parent_server->client->cl_timeout,
|
||||||
|
@ -1181,10 +1181,11 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
|
||||||
goto init_server;
|
goto init_server;
|
||||||
#endif /* IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA) */
|
#endif /* IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA) */
|
||||||
|
|
||||||
rpc_set_port(data->addr, NFS_PORT);
|
rpc_set_port(&ctx->nfs_server.address, NFS_PORT);
|
||||||
error = nfs4_set_client(server, data->hostname,
|
error = nfs4_set_client(server,
|
||||||
data->addr,
|
ctx->nfs_server.hostname,
|
||||||
data->addrlen,
|
&ctx->nfs_server.address,
|
||||||
|
ctx->nfs_server.addrlen,
|
||||||
parent_client->cl_ipaddr,
|
parent_client->cl_ipaddr,
|
||||||
XPRT_TRANSPORT_TCP,
|
XPRT_TRANSPORT_TCP,
|
||||||
parent_server->client->cl_timeout,
|
parent_server->client->cl_timeout,
|
||||||
|
@ -1197,13 +1198,14 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
|
||||||
#if IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA)
|
#if IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA)
|
||||||
init_server:
|
init_server:
|
||||||
#endif
|
#endif
|
||||||
error = nfs_init_server_rpcclient(server, parent_server->client->cl_timeout, data->authflavor);
|
error = nfs_init_server_rpcclient(server, parent_server->client->cl_timeout,
|
||||||
|
ctx->selected_flavor);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
auth_probe = parent_server->auth_info.flavor_len < 1;
|
auth_probe = parent_server->auth_info.flavor_len < 1;
|
||||||
|
|
||||||
error = nfs4_server_common_setup(server, mntfh, auth_probe);
|
error = nfs4_server_common_setup(server, ctx->mntfh, auth_probe);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
|
@ -130,9 +130,10 @@ static int nfs4_validate_fspath(struct dentry *dentry,
|
||||||
const struct nfs4_fs_locations *locations,
|
const struct nfs4_fs_locations *locations,
|
||||||
struct nfs_fs_context *ctx)
|
struct nfs_fs_context *ctx)
|
||||||
{
|
{
|
||||||
const char *path, *fs_path;
|
const char *path;
|
||||||
char *buf;
|
char *fs_path;
|
||||||
unsigned short len;
|
unsigned short len;
|
||||||
|
char *buf;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
buf = kmalloc(4096, GFP_KERNEL);
|
buf = kmalloc(4096, GFP_KERNEL);
|
||||||
|
@ -278,7 +279,6 @@ out:
|
||||||
static int try_location(struct fs_context *fc,
|
static int try_location(struct fs_context *fc,
|
||||||
const struct nfs4_fs_location *location)
|
const struct nfs4_fs_location *location)
|
||||||
{
|
{
|
||||||
const size_t addr_bufsize = sizeof(struct sockaddr_storage);
|
|
||||||
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
unsigned int len, s;
|
unsigned int len, s;
|
||||||
char *export_path, *source, *p;
|
char *export_path, *source, *p;
|
||||||
|
@ -314,29 +314,24 @@ static int try_location(struct fs_context *fc,
|
||||||
|
|
||||||
kfree(fc->source);
|
kfree(fc->source);
|
||||||
fc->source = source;
|
fc->source = source;
|
||||||
|
|
||||||
ctx->clone_data.addr = kmalloc(addr_bufsize, GFP_KERNEL);
|
|
||||||
if (ctx->clone_data.addr == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
for (s = 0; s < location->nservers; s++) {
|
for (s = 0; s < location->nservers; s++) {
|
||||||
const struct nfs4_string *buf = &location->servers[s];
|
const struct nfs4_string *buf = &location->servers[s];
|
||||||
|
|
||||||
if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len))
|
if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ctx->clone_data.addrlen =
|
ctx->nfs_server.addrlen =
|
||||||
nfs_parse_server_name(buf->data, buf->len,
|
nfs_parse_server_name(buf->data, buf->len,
|
||||||
ctx->clone_data.addr,
|
&ctx->nfs_server.address,
|
||||||
addr_bufsize,
|
sizeof(ctx->nfs_server._address),
|
||||||
fc->net_ns);
|
fc->net_ns);
|
||||||
if (ctx->clone_data.addrlen == 0)
|
if (ctx->nfs_server.addrlen == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rpc_set_port(ctx->clone_data.addr, NFS_PORT);
|
rpc_set_port(&ctx->nfs_server.address, NFS_PORT);
|
||||||
|
|
||||||
memcpy(ctx->nfs_server.hostname, buf->data, buf->len);
|
memcpy(ctx->nfs_server.hostname, buf->data, buf->len);
|
||||||
ctx->nfs_server.hostname[buf->len] = '\0';
|
ctx->nfs_server.hostname[buf->len] = '\0';
|
||||||
ctx->clone_data.hostname = ctx->nfs_server.hostname;
|
|
||||||
|
|
||||||
p = source;
|
p = source;
|
||||||
memcpy(p, buf->data, buf->len);
|
memcpy(p, buf->data, buf->len);
|
||||||
|
@ -449,7 +444,7 @@ int nfs4_submount(struct fs_context *fc, struct nfs_server *server)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Look it up again to get its attributes and sec flavor */
|
/* Look it up again to get its attributes and sec flavor */
|
||||||
client = nfs4_proc_lookup_mountpoint(dir, name, ctx->mount_info.mntfh,
|
client = nfs4_proc_lookup_mountpoint(dir, name, ctx->mntfh,
|
||||||
ctx->clone_data.fattr);
|
ctx->clone_data.fattr);
|
||||||
dput(parent);
|
dput(parent);
|
||||||
if (IS_ERR(client))
|
if (IS_ERR(client))
|
||||||
|
|
|
@ -168,7 +168,7 @@ static int do_nfs4_mount(struct nfs_server *server,
|
||||||
|
|
||||||
root_ctx = nfs_fc2context(root_fc);
|
root_ctx = nfs_fc2context(root_fc);
|
||||||
root_ctx->internal = true;
|
root_ctx->internal = true;
|
||||||
root_ctx->mount_info.server = server;
|
root_ctx->server = server;
|
||||||
/* We leave export_path unset as it's not used to find the root. */
|
/* We leave export_path unset as it's not used to find the root. */
|
||||||
|
|
||||||
len = strlen(hostname) + 5;
|
len = strlen(hostname) + 5;
|
||||||
|
@ -221,7 +221,7 @@ int nfs4_try_get_tree(struct fs_context *fc)
|
||||||
/* We create a mount for the server's root, walk to the requested
|
/* We create a mount for the server's root, walk to the requested
|
||||||
* location and then create another mount for that.
|
* location and then create another mount for that.
|
||||||
*/
|
*/
|
||||||
err= do_nfs4_mount(nfs4_create_server(&ctx->mount_info),
|
err= do_nfs4_mount(nfs4_create_server(fc),
|
||||||
fc, ctx->nfs_server.hostname,
|
fc, ctx->nfs_server.hostname,
|
||||||
ctx->nfs_server.export_path);
|
ctx->nfs_server.export_path);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -243,7 +243,7 @@ int nfs4_get_referral_tree(struct fs_context *fc)
|
||||||
dprintk("--> nfs4_referral_mount()\n");
|
dprintk("--> nfs4_referral_mount()\n");
|
||||||
|
|
||||||
/* create a new volume representation */
|
/* create a new volume representation */
|
||||||
err = do_nfs4_mount(nfs4_create_referral_server(&ctx->clone_data, ctx->mount_info.mntfh),
|
err = do_nfs4_mount(nfs4_create_referral_server(fc),
|
||||||
fc, ctx->nfs_server.hostname,
|
fc, ctx->nfs_server.hostname,
|
||||||
ctx->nfs_server.export_path);
|
ctx->nfs_server.export_path);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -254,7 +254,6 @@ int nfs4_get_referral_tree(struct fs_context *fc)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init init_nfs_v4(void)
|
static int __init init_nfs_v4(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
|
@ -745,11 +745,12 @@ out:
|
||||||
* Use the remote server's MOUNT service to request the NFS file handle
|
* Use the remote server's MOUNT service to request the NFS file handle
|
||||||
* corresponding to the provided path.
|
* corresponding to the provided path.
|
||||||
*/
|
*/
|
||||||
static int nfs_request_mount(struct nfs_fs_context *ctx,
|
static int nfs_request_mount(struct fs_context *fc,
|
||||||
struct nfs_fh *root_fh,
|
struct nfs_fh *root_fh,
|
||||||
rpc_authflavor_t *server_authlist,
|
rpc_authflavor_t *server_authlist,
|
||||||
unsigned int *server_authlist_len)
|
unsigned int *server_authlist_len)
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct nfs_mount_request request = {
|
struct nfs_mount_request request = {
|
||||||
.sap = (struct sockaddr *)
|
.sap = (struct sockaddr *)
|
||||||
&ctx->mount_server.address,
|
&ctx->mount_server.address,
|
||||||
|
@ -759,7 +760,7 @@ static int nfs_request_mount(struct nfs_fs_context *ctx,
|
||||||
.noresvport = ctx->flags & NFS_MOUNT_NORESVPORT,
|
.noresvport = ctx->flags & NFS_MOUNT_NORESVPORT,
|
||||||
.auth_flav_len = server_authlist_len,
|
.auth_flav_len = server_authlist_len,
|
||||||
.auth_flavs = server_authlist,
|
.auth_flavs = server_authlist,
|
||||||
.net = ctx->net,
|
.net = fc->net_ns,
|
||||||
};
|
};
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -804,20 +805,18 @@ static int nfs_request_mount(struct nfs_fs_context *ctx,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_info)
|
static struct nfs_server *nfs_try_mount_request(struct fs_context *fc)
|
||||||
{
|
{
|
||||||
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
int status;
|
int status;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool tried_auth_unix = false;
|
bool tried_auth_unix = false;
|
||||||
bool auth_null_in_list = false;
|
bool auth_null_in_list = false;
|
||||||
struct nfs_server *server = ERR_PTR(-EACCES);
|
struct nfs_server *server = ERR_PTR(-EACCES);
|
||||||
struct nfs_fs_context *ctx = mount_info->ctx;
|
|
||||||
rpc_authflavor_t authlist[NFS_MAX_SECFLAVORS];
|
rpc_authflavor_t authlist[NFS_MAX_SECFLAVORS];
|
||||||
unsigned int authlist_len = ARRAY_SIZE(authlist);
|
unsigned int authlist_len = ARRAY_SIZE(authlist);
|
||||||
struct nfs_subversion *nfs_mod = mount_info->nfs_mod;
|
|
||||||
|
|
||||||
status = nfs_request_mount(ctx, mount_info->mntfh, authlist,
|
status = nfs_request_mount(fc, ctx->mntfh, authlist, &authlist_len);
|
||||||
&authlist_len);
|
|
||||||
if (status)
|
if (status)
|
||||||
return ERR_PTR(status);
|
return ERR_PTR(status);
|
||||||
|
|
||||||
|
@ -831,7 +830,7 @@ static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_inf
|
||||||
ctx->selected_flavor);
|
ctx->selected_flavor);
|
||||||
if (status)
|
if (status)
|
||||||
return ERR_PTR(status);
|
return ERR_PTR(status);
|
||||||
return nfs_mod->rpc_ops->create_server(mount_info);
|
return ctx->nfs_mod->rpc_ops->create_server(fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -858,7 +857,7 @@ static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_inf
|
||||||
}
|
}
|
||||||
dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", flavor);
|
dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", flavor);
|
||||||
ctx->selected_flavor = flavor;
|
ctx->selected_flavor = flavor;
|
||||||
server = nfs_mod->rpc_ops->create_server(mount_info);
|
server = ctx->nfs_mod->rpc_ops->create_server(fc);
|
||||||
if (!IS_ERR(server))
|
if (!IS_ERR(server))
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
@ -874,7 +873,7 @@ static struct nfs_server *nfs_try_mount_request(struct nfs_mount_info *mount_inf
|
||||||
/* Last chance! Try AUTH_UNIX */
|
/* Last chance! Try AUTH_UNIX */
|
||||||
dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", RPC_AUTH_UNIX);
|
dfprintk(MOUNT, "NFS: attempting to use auth flavor %u\n", RPC_AUTH_UNIX);
|
||||||
ctx->selected_flavor = RPC_AUTH_UNIX;
|
ctx->selected_flavor = RPC_AUTH_UNIX;
|
||||||
return nfs_mod->rpc_ops->create_server(mount_info);
|
return ctx->nfs_mod->rpc_ops->create_server(fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfs_try_get_tree(struct fs_context *fc)
|
int nfs_try_get_tree(struct fs_context *fc)
|
||||||
|
@ -882,9 +881,9 @@ int nfs_try_get_tree(struct fs_context *fc)
|
||||||
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
|
|
||||||
if (ctx->need_mount)
|
if (ctx->need_mount)
|
||||||
ctx->mount_info.server = nfs_try_mount_request(&ctx->mount_info);
|
ctx->server = nfs_try_mount_request(fc);
|
||||||
else
|
else
|
||||||
ctx->mount_info.server = ctx->mount_info.nfs_mod->rpc_ops->create_server(&ctx->mount_info);
|
ctx->server = ctx->nfs_mod->rpc_ops->create_server(fc);
|
||||||
|
|
||||||
return nfs_get_tree_common(fc);
|
return nfs_get_tree_common(fc);
|
||||||
}
|
}
|
||||||
|
@ -966,9 +965,8 @@ EXPORT_SYMBOL_GPL(nfs_reconfigure);
|
||||||
/*
|
/*
|
||||||
* Finish setting up an NFS superblock
|
* Finish setting up an NFS superblock
|
||||||
*/
|
*/
|
||||||
static void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info)
|
static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
|
||||||
{
|
{
|
||||||
struct nfs_fs_context *ctx = mount_info->ctx;
|
|
||||||
struct nfs_server *server = NFS_SB(sb);
|
struct nfs_server *server = NFS_SB(sb);
|
||||||
|
|
||||||
sb->s_blocksize_bits = 0;
|
sb->s_blocksize_bits = 0;
|
||||||
|
@ -1009,13 +1007,14 @@ static void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_
|
||||||
nfs_super_set_maxbytes(sb, server->maxfilesize);
|
nfs_super_set_maxbytes(sb, server->maxfilesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b, int flags)
|
static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b,
|
||||||
|
const struct fs_context *fc)
|
||||||
{
|
{
|
||||||
const struct nfs_server *a = s->s_fs_info;
|
const struct nfs_server *a = s->s_fs_info;
|
||||||
const struct rpc_clnt *clnt_a = a->client;
|
const struct rpc_clnt *clnt_a = a->client;
|
||||||
const struct rpc_clnt *clnt_b = b->client;
|
const struct rpc_clnt *clnt_b = b->client;
|
||||||
|
|
||||||
if ((s->s_flags & NFS_MS_MASK) != (flags & NFS_MS_MASK))
|
if ((s->s_flags & NFS_SB_MASK) != (fc->sb_flags & NFS_SB_MASK))
|
||||||
goto Ebusy;
|
goto Ebusy;
|
||||||
if (a->nfs_client != b->nfs_client)
|
if (a->nfs_client != b->nfs_client)
|
||||||
goto Ebusy;
|
goto Ebusy;
|
||||||
|
@ -1122,7 +1121,7 @@ static int nfs_compare_super(struct super_block *sb, struct fs_context *fc)
|
||||||
return 0;
|
return 0;
|
||||||
if (!nfs_compare_userns(old, server))
|
if (!nfs_compare_userns(old, server))
|
||||||
return 0;
|
return 0;
|
||||||
return nfs_compare_mount_options(sb, server, fc->sb_flags);
|
return nfs_compare_mount_options(sb, server, fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NFS_FSCACHE
|
#ifdef CONFIG_NFS_FSCACHE
|
||||||
|
@ -1177,13 +1176,12 @@ int nfs_get_tree_common(struct fs_context *fc)
|
||||||
{
|
{
|
||||||
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
struct nfs_fs_context *ctx = nfs_fc2context(fc);
|
||||||
struct super_block *s;
|
struct super_block *s;
|
||||||
struct dentry *mntroot = ERR_PTR(-ENOMEM);
|
|
||||||
int (*compare_super)(struct super_block *, struct fs_context *) = nfs_compare_super;
|
int (*compare_super)(struct super_block *, struct fs_context *) = nfs_compare_super;
|
||||||
struct nfs_server *server = ctx->mount_info.server;
|
struct nfs_server *server = ctx->server;
|
||||||
unsigned long kflags = 0, kflags_out = 0;
|
unsigned long kflags = 0, kflags_out = 0;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
ctx->mount_info.server = NULL;
|
ctx->server = NULL;
|
||||||
if (IS_ERR(server))
|
if (IS_ERR(server))
|
||||||
return PTR_ERR(server);
|
return PTR_ERR(server);
|
||||||
|
|
||||||
|
@ -1224,9 +1222,9 @@ int nfs_get_tree_common(struct fs_context *fc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->s_root) {
|
if (!s->s_root) {
|
||||||
unsigned bsize = ctx->mount_info.inherited_bsize;
|
unsigned bsize = ctx->clone_data.inherited_bsize;
|
||||||
/* initial superblock/root creation */
|
/* initial superblock/root creation */
|
||||||
nfs_fill_super(s, &ctx->mount_info);
|
nfs_fill_super(s, ctx);
|
||||||
if (bsize) {
|
if (bsize) {
|
||||||
s->s_blocksize_bits = bsize;
|
s->s_blocksize_bits = bsize;
|
||||||
s->s_blocksize = 1U << bsize;
|
s->s_blocksize = 1U << bsize;
|
||||||
|
@ -1234,13 +1232,11 @@ int nfs_get_tree_common(struct fs_context *fc)
|
||||||
nfs_get_cache_cookie(s, ctx);
|
nfs_get_cache_cookie(s, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
mntroot = nfs_get_root(s, ctx->mount_info.mntfh, fc->source);
|
error = nfs_get_root(s, fc);
|
||||||
if (IS_ERR(mntroot)) {
|
if (error < 0) {
|
||||||
error = PTR_ERR(mntroot);
|
|
||||||
dfprintk(MOUNT, "NFS: Couldn't get root dentry\n");
|
dfprintk(MOUNT, "NFS: Couldn't get root dentry\n");
|
||||||
goto error_splat_super;
|
goto error_splat_super;
|
||||||
}
|
}
|
||||||
fc->root = mntroot;
|
|
||||||
|
|
||||||
if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL)
|
if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL)
|
||||||
kflags |= SECURITY_LSM_NATIVE_LABELS;
|
kflags |= SECURITY_LSM_NATIVE_LABELS;
|
||||||
|
|
|
@ -1722,7 +1722,7 @@ struct nfs_rpc_ops {
|
||||||
struct nfs_client *(*init_client) (struct nfs_client *,
|
struct nfs_client *(*init_client) (struct nfs_client *,
|
||||||
const struct nfs_client_initdata *);
|
const struct nfs_client_initdata *);
|
||||||
void (*free_client) (struct nfs_client *);
|
void (*free_client) (struct nfs_client *);
|
||||||
struct nfs_server *(*create_server)(struct nfs_mount_info *);
|
struct nfs_server *(*create_server)(struct fs_context *);
|
||||||
struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
|
struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
|
||||||
struct nfs_fattr *, rpc_authflavor_t);
|
struct nfs_fattr *, rpc_authflavor_t);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue