]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
NFSv4: Handle RPC level errors in LAYOUTRETURN
authorTrond Myklebust <trondmy@gmail.com>
Fri, 20 Sep 2019 11:23:43 +0000 (07:23 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 20 Sep 2019 19:39:56 +0000 (15:39 -0400)
Handle RPC level errors by assuming that the RPC call was successful.

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

index a7cecac5a4ecb7a998d3861971ba2ca572c8d6d0..c0bff7ad0c9ff658de2cd177419ad531c960f1e3 100644 (file)
@@ -9051,6 +9051,15 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
        if (!nfs41_sequence_process(task, &lrp->res.seq_res))
                return;
 
+       /*
+        * Was there an RPC level error? Assume the call succeeded,
+        * and that we need to release the layout
+        */
+       if (task->tk_rpc_status != 0 && RPC_WAS_SENT(task)) {
+               lrp->res.lrs_present = 0;
+               return;
+       }
+
        server = NFS_SERVER(lrp->args.inode);
        switch (task->tk_status) {
        case -NFS4ERR_OLD_STATEID:
index 6436047dc999a131e11353bde9ee12391bd51ed8..abc7188f18536526c0d3b1def12d1671856df463 100644 (file)
@@ -1455,6 +1455,21 @@ int pnfs_roc_done(struct rpc_task *task, struct inode *inode,
        case 0:
                retval = 0;
                break;
+       case -NFS4ERR_NOMATCHING_LAYOUT:
+               /* Was there an RPC level error? If not, retry */
+               if (task->tk_rpc_status == 0)
+                       break;
+               /* If the call was not sent, let caller handle it */
+               if (!RPC_WAS_SENT(task))
+                       return 0;
+               /*
+                * Otherwise, assume the call succeeded and
+                * that we need to release the layout
+                */
+               *ret = 0;
+               (*respp)->lrs_present = 0;
+               retval = 0;
+               break;
        case -NFS4ERR_DELAY:
                /* Let the caller handle the retry */
                *ret = -NFS4ERR_NOMATCHING_LAYOUT;