pNFS/flexfiles: When checking for available DSes, conditionally check for MDS io
authorTom Haynes <loghyr@primarydata.com>
Tue, 17 May 2016 16:28:37 +0000 (12:28 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 17 May 2016 19:48:08 +0000 (15:48 -0400)
Whenever we check to see if we have the needed number of DSes for the
action, we may also have to check to see whether IO is allowed to go to
the MDS or not.

[jlayton: fix merge conflict due to lack of localio patches here]

Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/flexfilelayout/flexfilelayout.h
fs/nfs/flexfilelayout/flexfilelayoutdev.c

index b6e0e32b60537f4c7d2cb4af8a06720cb9fa59e1..a835b75f85ab6383f200001e9607a203e41aad33 100644 (file)
@@ -1102,8 +1102,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
                rpc_wake_up(&tbl->slot_tbl_waitq);
                /* fall through */
        default:
-               if (ff_layout_no_fallback_to_mds(lseg) ||
-                   ff_layout_has_available_ds(lseg))
+               if (ff_layout_avoid_mds_available_ds(lseg))
                        return -NFS4ERR_RESET_TO_PNFS;
 reset:
                dprintk("%s Retry through MDS. Error %d\n", __func__,
@@ -1765,7 +1764,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
        return PNFS_ATTEMPTED;
 
 out_failed:
-       if (ff_layout_has_available_ds(lseg))
+       if (ff_layout_avoid_mds_available_ds(lseg))
                return PNFS_TRY_AGAIN;
        return PNFS_NOT_ATTEMPTED;
 }
index 1318c77aeb35ab292621644021cc386d3ed7c80c..b540581226473e82114423d073b753a86a2081c7 100644 (file)
@@ -191,4 +191,5 @@ nfs4_ff_find_or_create_ds_client(struct pnfs_layout_segment *lseg,
 struct rpc_cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg,
                                       u32 ds_idx, struct rpc_cred *mdscred);
 bool ff_layout_has_available_ds(struct pnfs_layout_segment *lseg);
+bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg);
 #endif /* FS_NFS_NFS4FLEXFILELAYOUT_H */
index eeef89359ad22223100a7437d6db40572d4642ef..8242ab327feed0dc87f8824254e15c37b4f5c44a 100644 (file)
@@ -541,6 +541,12 @@ bool ff_layout_has_available_ds(struct pnfs_layout_segment *lseg)
        return ff_rw_layout_has_available_ds(lseg);
 }
 
+bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg)
+{
+       return ff_layout_no_fallback_to_mds(lseg) ||
+              ff_layout_has_available_ds(lseg);
+}
+
 module_param(dataserver_retrans, uint, 0644);
 MODULE_PARM_DESC(dataserver_retrans, "The  number of times the NFSv4.1 client "
                        "retries a request before it attempts further "