From owner-svn-src-projects@freebsd.org Mon Jun 11 01:13:13 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B5AA10083DC for ; Mon, 11 Jun 2018 01:13:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BB182C14; Mon, 11 Jun 2018 01:13:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24714149E2; Mon, 11 Jun 2018 01:13:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5B1DCRA084179; Mon, 11 Jun 2018 01:13:12 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5B1DCnt084178; Mon, 11 Jun 2018 01:13:12 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201806110113.w5B1DCnt084178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 11 Jun 2018 01:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r334937 - in projects/pnfs-planb-server/sys/fs: nfs nfsclient X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/pnfs-planb-server/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 334937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2018 01:13:13 -0000 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);