pnfs: fix bad error handling in send_layoutget
authorJeff Layton <jlayton@poochiereds.net>
Tue, 17 May 2016 16:28:45 +0000 (12:28 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 17 May 2016 19:48:11 +0000 (15:48 -0400)
Currently, the code will clear the fail bit if we get back a fatal
error. I don't think that's correct -- we want to clear that bit
if we do not get a fatal error.

Fixes: 0bcbf039f6 (nfs: handle request add failure properly)
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/pnfs.c

index 21ff53fe7a9e949f05de67fde8ac3128bc781ad7..e3e9973b5f762b2ff0640be3ba9c2ca1135791eb 100644 (file)
@@ -876,11 +876,16 @@ send_layoutget(struct pnfs_layout_hdr *lo,
                lseg = nfs4_proc_layoutget(lgp, gfp_flags);
        } while (lseg == ERR_PTR(-EAGAIN));
 
-       if (IS_ERR(lseg) && !nfs_error_is_fatal(PTR_ERR(lseg)))
-               lseg = NULL;
-       else
+       if (IS_ERR(lseg)) {
+               if (!nfs_error_is_fatal(PTR_ERR(lseg))) {
+                       pnfs_layout_clear_fail_bit(lo,
+                                       pnfs_iomode_to_fail_bit(range->iomode));
+                       lseg = NULL;
+               }
+       } else {
                pnfs_layout_clear_fail_bit(lo,
                                pnfs_iomode_to_fail_bit(range->iomode));
+       }
 
        return lseg;
 }