diff options
author | Trond Myklebust <trondmy@gmail.com> | 2019-04-24 17:46:43 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2019-04-26 16:11:54 -0400 |
commit | 1a58e8a0e5c1f188a80eb9e505bc77d78a31a4ec (patch) | |
tree | 0dc31db3ea8ca7ac3b598a7d7fef30a6496b23ac /fs/nfs/client.c | |
parent | 79caa5fad47c69874f9efc4ac3128cc3f6d36f6e (diff) |
NFS: Store the credential of the mount process in the nfs_server
Store the credential of the mount process so that we can determine
information such as the user namespace.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index a843cf3f6340..e3baa9f1da76 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -500,7 +500,7 @@ int nfs_create_rpc_client(struct nfs_client *clp, | |||
500 | .program = &nfs_program, | 500 | .program = &nfs_program, |
501 | .version = clp->rpc_ops->version, | 501 | .version = clp->rpc_ops->version, |
502 | .authflavor = flavor, | 502 | .authflavor = flavor, |
503 | .cred = current_cred(), | 503 | .cred = cl_init->cred, |
504 | }; | 504 | }; |
505 | 505 | ||
506 | if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags)) | 506 | if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags)) |
@@ -655,6 +655,7 @@ static int nfs_init_server(struct nfs_server *server, | |||
655 | .proto = data->nfs_server.protocol, | 655 | .proto = data->nfs_server.protocol, |
656 | .net = data->net, | 656 | .net = data->net, |
657 | .timeparms = &timeparms, | 657 | .timeparms = &timeparms, |
658 | .cred = server->cred, | ||
658 | }; | 659 | }; |
659 | struct nfs_client *clp; | 660 | struct nfs_client *clp; |
660 | int error; | 661 | int error; |
@@ -923,6 +924,7 @@ void nfs_free_server(struct nfs_server *server) | |||
923 | ida_destroy(&server->lockowner_id); | 924 | ida_destroy(&server->lockowner_id); |
924 | ida_destroy(&server->openowner_id); | 925 | ida_destroy(&server->openowner_id); |
925 | nfs_free_iostats(server->io_stats); | 926 | nfs_free_iostats(server->io_stats); |
927 | put_cred(server->cred); | ||
926 | kfree(server); | 928 | kfree(server); |
927 | nfs_release_automount_timer(); | 929 | nfs_release_automount_timer(); |
928 | } | 930 | } |
@@ -943,6 +945,8 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info, | |||
943 | if (!server) | 945 | if (!server) |
944 | return ERR_PTR(-ENOMEM); | 946 | return ERR_PTR(-ENOMEM); |
945 | 947 | ||
948 | server->cred = get_cred(current_cred()); | ||
949 | |||
946 | error = -ENOMEM; | 950 | error = -ENOMEM; |
947 | fattr = nfs_alloc_fattr(); | 951 | fattr = nfs_alloc_fattr(); |
948 | if (fattr == NULL) | 952 | if (fattr == NULL) |
@@ -1009,6 +1013,8 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, | |||
1009 | if (!server) | 1013 | if (!server) |
1010 | return ERR_PTR(-ENOMEM); | 1014 | return ERR_PTR(-ENOMEM); |
1011 | 1015 | ||
1016 | server->cred = get_cred(source->cred); | ||
1017 | |||
1012 | error = -ENOMEM; | 1018 | error = -ENOMEM; |
1013 | fattr_fsinfo = nfs_alloc_fattr(); | 1019 | fattr_fsinfo = nfs_alloc_fattr(); |
1014 | if (fattr_fsinfo == NULL) | 1020 | if (fattr_fsinfo == NULL) |