aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2019-04-09 12:13:37 -0400
committerJ. Bruce Fields <bfields@redhat.com>2019-04-24 09:46:35 -0400
commit4df493a260d4c1844437b28009013d5dc408d0df (patch)
tree82fe51b97a8743281bbf7d40cdbeef9af50614bf /fs/lockd
parentnfsd: Allow containers to set supported nfs versions (diff)
downloadlinux-dev-4df493a260d4c1844437b28009013d5dc408d0df.tar.xz
linux-dev-4df493a260d4c1844437b28009013d5dc408d0df.zip
SUNRPC: Cache the process user cred in the RPC server listener
In order to be able to interpret uids and gids correctly in knfsd, we should cache the user namespace of the process that created the RPC server's listener. To do so, we refcount the credential of that process. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/svc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 96bb74c919f9..82aa0f35e43d 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -190,12 +190,13 @@ static int create_lockd_listener(struct svc_serv *serv, const char *name,
struct net *net, const int family,
const unsigned short port)
{
+ const struct cred *cred = current_cred();
struct svc_xprt *xprt;
xprt = svc_find_xprt(serv, name, net, family, 0);
if (xprt == NULL)
return svc_create_xprt(serv, name, net, family, port,
- SVC_SOCK_DEFAULTS);
+ SVC_SOCK_DEFAULTS, cred);
svc_xprt_put(xprt);
return 0;
}