Merge branch 'for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu
[linux-2.6-microblaze.git] / fs / lockd / host.c
index f0b5c98..7d46faf 100644 (file)
@@ -60,6 +60,7 @@ struct nlm_lookup_host_info {
        const size_t            hostname_len;   /* it's length */
        const int               noresvport;     /* use non-priv port */
        struct net              *net;           /* network namespace to bind */
+       const struct cred       *cred;
 };
 
 /*
@@ -162,6 +163,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni,
        host->h_nsmhandle  = nsm;
        host->h_addrbuf    = nsm->sm_addrbuf;
        host->net          = ni->net;
+       host->h_cred       = get_cred(ni->cred),
        strlcpy(host->nodename, utsname()->nodename, sizeof(host->nodename));
 
 out:
@@ -188,6 +190,7 @@ static void nlm_destroy_host_locked(struct nlm_host *host)
        clnt = host->h_rpcclnt;
        if (clnt != NULL)
                rpc_shutdown_client(clnt);
+       put_cred(host->h_cred);
        kfree(host);
 
        ln->nrhosts--;
@@ -202,6 +205,8 @@ static void nlm_destroy_host_locked(struct nlm_host *host)
  * @version: NLM protocol version
  * @hostname: '\0'-terminated hostname of server
  * @noresvport: 1 if non-privileged port should be used
+ * @net: pointer to net namespace
+ * @cred: pointer to cred
  *
  * Returns an nlm_host structure that matches the passed-in
  * [server address, transport protocol, NLM version, server hostname].
@@ -214,7 +219,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
                                     const u32 version,
                                     const char *hostname,
                                     int noresvport,
-                                    struct net *net)
+                                    struct net *net,
+                                    const struct cred *cred)
 {
        struct nlm_lookup_host_info ni = {
                .server         = 0,
@@ -226,6 +232,7 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
                .hostname_len   = strlen(hostname),
                .noresvport     = noresvport,
                .net            = net,
+               .cred           = cred,
        };
        struct hlist_head *chain;
        struct nlm_host *host;
@@ -458,6 +465,7 @@ nlm_bind_host(struct nlm_host *host)
                        .authflavor     = RPC_AUTH_UNIX,
                        .flags          = (RPC_CLNT_CREATE_NOPING |
                                           RPC_CLNT_CREATE_AUTOBIND),
+                       .cred           = host->h_cred,
                };
 
                /*