Commit 01dde76e authored by Anna Schumaker's avatar Anna Schumaker Committed by Trond Myklebust

NFS: Create an nfs4_server_set_init_caps() function

And call it before doing an FSINFO probe to reset to the baseline
capabilities before probing.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 86882c75
...@@ -209,6 +209,7 @@ extern struct nfs_client * ...@@ -209,6 +209,7 @@ 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 fs_context *); extern struct nfs_server *nfs_create_server(struct fs_context *);
extern void nfs4_server_set_init_caps(struct nfs_server *);
extern struct nfs_server *nfs4_create_server(struct fs_context *); extern struct nfs_server *nfs4_create_server(struct fs_context *);
extern struct nfs_server *nfs4_create_referral_server(struct fs_context *); extern struct nfs_server *nfs4_create_referral_server(struct fs_context *);
extern int nfs4_update_server(struct nfs_server *server, const char *hostname, extern int nfs4_update_server(struct nfs_server *server, const char *hostname,
......
...@@ -1059,6 +1059,24 @@ static void nfs4_session_limit_xasize(struct nfs_server *server) ...@@ -1059,6 +1059,24 @@ static void nfs4_session_limit_xasize(struct nfs_server *server)
#endif #endif
} }
void nfs4_server_set_init_caps(struct nfs_server *server)
{
/* Set the basic capabilities */
server->caps |= server->nfs_client->cl_mvops->init_caps;
if (server->flags & NFS_MOUNT_NORDIRPLUS)
server->caps &= ~NFS_CAP_READDIRPLUS;
if (server->nfs_client->cl_proto == XPRT_TRANSPORT_RDMA)
server->caps &= ~NFS_CAP_READ_PLUS;
/*
* Don't use NFS uid/gid mapping if we're using AUTH_SYS or lower
* authentication.
*/
if (nfs4_disable_idmapping &&
server->client->cl_auth->au_flavor == RPC_AUTH_UNIX)
server->caps |= NFS_CAP_UIDGID_NOMAP;
}
static int nfs4_server_common_setup(struct nfs_server *server, static int nfs4_server_common_setup(struct nfs_server *server,
struct nfs_fh *mntfh, bool auth_probe) struct nfs_fh *mntfh, bool auth_probe)
{ {
...@@ -1078,20 +1096,7 @@ static int nfs4_server_common_setup(struct nfs_server *server, ...@@ -1078,20 +1096,7 @@ static int nfs4_server_common_setup(struct nfs_server *server,
if (error < 0) if (error < 0)
goto out; goto out;
/* Set the basic capabilities */ nfs4_server_set_init_caps(server);
server->caps |= server->nfs_client->cl_mvops->init_caps;
if (server->flags & NFS_MOUNT_NORDIRPLUS)
server->caps &= ~NFS_CAP_READDIRPLUS;
if (server->nfs_client->cl_proto == XPRT_TRANSPORT_RDMA)
server->caps &= ~NFS_CAP_READ_PLUS;
/*
* Don't use NFS uid/gid mapping if we're using AUTH_SYS or lower
* authentication.
*/
if (nfs4_disable_idmapping &&
server->client->cl_auth->au_flavor == RPC_AUTH_UNIX)
server->caps |= NFS_CAP_UIDGID_NOMAP;
/* Probe the root fh to retrieve its FSID and filehandle */ /* Probe the root fh to retrieve its FSID and filehandle */
error = nfs4_get_rootfh(server, mntfh, auth_probe); error = nfs4_get_rootfh(server, mntfh, auth_probe);
......
...@@ -3937,6 +3937,8 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) ...@@ -3937,6 +3937,8 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle)
.interruptible = true, .interruptible = true,
}; };
int err; int err;
nfs4_server_set_init_caps(server);
do { do {
err = nfs4_handle_exception(server, err = nfs4_handle_exception(server,
_nfs4_server_capabilities(server, fhandle), _nfs4_server_capabilities(server, fhandle),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment