]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFSv4: Avoid unnecessary credential references in layoutget
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 8 Feb 2020 00:40:14 +0000 (19:40 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 16 Mar 2020 12:34:29 +0000 (08:34 -0400)
Layoutget is just using the credential attached to the open context.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4proc.c
fs/nfs/pnfs.c

index a7fe64b93852fd2545f8176146fd985138721f26..22dca497c5deede373fe56d4c2aff0bf7c28e15c 100644 (file)
@@ -9177,7 +9177,7 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, long *timeout)
                .rpc_message = &msg,
                .callback_ops = &nfs4_layoutget_call_ops,
                .callback_data = lgp,
-               .flags = RPC_TASK_ASYNC,
+               .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,
        };
        struct pnfs_layout_segment *lseg = NULL;
        struct nfs4_exception exception = {
index b21eb488284622785e72ea13e2d8b6aa5179a1a6..cb99ac95468864f07d2c0e8f4b24b40f7425c367 100644 (file)
@@ -1073,7 +1073,7 @@ pnfs_alloc_init_layoutget_args(struct inode *ino,
        lgp->args.ctx = get_nfs_open_context(ctx);
        nfs4_stateid_copy(&lgp->args.stateid, stateid);
        lgp->gfp_flags = gfp_flags;
-       lgp->cred = get_cred(ctx->cred);
+       lgp->cred = ctx->cred;
        return lgp;
 }
 
@@ -1084,7 +1084,6 @@ void pnfs_layoutget_free(struct nfs4_layoutget *lgp)
        nfs4_free_pages(lgp->args.layout.pages, max_pages);
        if (lgp->args.inode)
                pnfs_put_layout_hdr(NFS_I(lgp->args.inode)->layout);
-       put_cred(lgp->cred);
        put_nfs_open_context(lgp->args.ctx);
        kfree(lgp);
 }