svn commit: r334937 - in projects/pnfs-planb-server/sys/fs: nfs nfsclient

Rick Macklem rmacklem at FreeBSD.org
Mon Jun 11 01:13:13 UTC 2018


Author: rmacklem
Date: Mon Jun 11 01:13:12 2018
New Revision: 334937
URL: https://svnweb.freebsd.org/changeset/base/334937

Log:
  Use a macro to check if an error should disable a DS. This allows the set
  of errors to be changed easily, if needed.

Modified:
  projects/pnfs-planb-server/sys/fs/nfs/nfsport.h
  projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsport.h
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfsport.h	Mon Jun 11 01:06:27 2018	(r334936)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfsport.h	Mon Jun 11 01:13:12 2018	(r334937)
@@ -1045,6 +1045,15 @@ struct nfsreq {
  */
 extern const char nfs_vnode_tag[];
 
+/*
+ * Check for the errors that indicate a DS should be disabled.
+ * ENXIO indicates that the krpc cannot do an RPC on the DS.
+ * EIO is returned by the RPC as an indication of I/O problems on the
+ * server.
+ * Are there other fatal errors?
+ */
+#define	nfsds_failerr(e)	((e) == ENXIO || (e) == EIO)
+
 #endif	/* _KERNEL */
 
 #endif	/* _NFS_NFSPORT_H */

Modified: projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c	Mon Jun 11 01:06:27 2018	(r334936)
+++ projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c	Mon Jun 11 01:13:12 2018	(r334937)
@@ -6040,14 +6040,7 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int *
 					    *dspp, fhp, dp->nfsdi_vers,
 					    dp->nfsdi_minorvers, tcred, p);
 				NFSCL_DEBUG(4, "commitds=%d\n", error);
-				/*
-				 * ENXIO indicates that the krpc cannot do
-				 * an RPC on the DS.  EIO is returned by the
-				 * RPC as an indication of I/O problems on the
-				 * server.
-				 * Are there other fatal errors?
-				 */
-				if (error == ENXIO || error == EIO) {
+				if (nfsds_failerr(error)) {
 					NFSCL_DEBUG(4,
 					    "DS layreterr for commit\n");
 					nfscl_dserr(NFSV4OP_COMMIT, dp, lyp);
@@ -6071,14 +6064,7 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int *
 			    off, xfer, fhp, 1, dp->nfsdi_vers,
 			    dp->nfsdi_minorvers, tcred, p);
 			NFSCL_DEBUG(4, "readds=%d\n", error);
-			if (error == ENXIO || error == EIO) {
-				/*
-				 * ENXIO indicates that the krpc cannot do
-				 * an RPC on the DS.  EIO is returned by the
-				 * RPC as an indication of I/O problems on the
-				 * server.
-				 * Are there other fatal errors?
-				 */
+			if (nfsds_failerr(error)) {
 				NFSCL_DEBUG(4, "DS layreterr for read\n");
 				nfscl_dserr(NFSV4OP_READ, dp, lyp);
 			}
@@ -6113,14 +6099,7 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int *
 					    xfer, fhp, m, dp->nfsdi_vers,
 					    dp->nfsdi_minorvers, tcred, p);
 				NFSCL_DEBUG(4, "nfsio_writedsmir=%d\n", error);
-				if (error == ENXIO || error == EIO) {
-					/*
-					 * ENXIO indicates that the krpc cannot
-					 * do an RPC on the DS.  EIO is returned
-					 * by the RPC as an indication of I/O
-					 * problems on the server.
-					 * Are there other fatal errors?
-					 */
+				if (nfsds_failerr(error)) {
 					NFSCL_DEBUG(4,
 					    "DS layreterr for write\n");
 					nfscl_dserr(NFSV4OP_WRITE, dp, lyp);


More information about the svn-src-projects mailing list