Date: Sat, 21 Apr 2018 20:48:04 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r332863 - projects/pnfs-planb-server/sys/fs/nfsclient Message-ID: <201804212048.w3LKm4eI065402@repo.freebsd.org>
index | next in thread | raw e-mail
Author: rmacklem Date: Sat Apr 21 20:48:03 2018 New Revision: 332863 URL: https://svnweb.freebsd.org/changeset/base/332863 Log: Fix nfsrpc_layoutreturn() and nfscl_dofflayoutio() for the Flexible File Layout returns/recalls and I/O errors against the DS. Modified: projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c Modified: projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c Sat Apr 21 19:54:06 2018 (r332862) +++ projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c Sat Apr 21 20:48:03 2018 (r332863) @@ -5202,10 +5202,11 @@ int nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh, int fhlen, int reclaim, int layouttype, uint32_t iomode, int layoutreturn, uint64_t offset, uint64_t len, nfsv4stateid_t *stateidp, struct ucred *cred, NFSPROC_T *p, - void *stuff) + uint32_t stat, uint32_t op, char *devid) { uint32_t *tl; struct nfsrv_descript nfsd, *nd = &nfsd; + uint64_t tu64; int error; nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL, @@ -5233,11 +5234,32 @@ nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh, if (layouttype == NFSLAYOUT_NFSV4_1_FILES) *tl = txdr_unsigned(0); else if (layouttype == NFSLAYOUT_FLEXFILE) { - *tl = txdr_unsigned(2 * NFSX_UNSIGNED); - NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); - /* No ioerrs or stats yet. */ - *tl++ = 0; - *tl = 0; + if (stat != 0) { + *tl = txdr_unsigned(2 * NFSX_HYPER + + NFSX_STATEID + NFSX_V4DEVICEID + 5 * + NFSX_UNSIGNED); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + + NFSX_STATEID + NFSX_V4DEVICEID + 5 * + NFSX_UNSIGNED); + *tl++ = txdr_unsigned(1); /* One error. */ + tu64 = 0; /* Offset. */ + txdr_hyper(tu64, tl); tl += 2; + tu64 = UINT64_MAX; /* Length. */ + txdr_hyper(tu64, tl); tl += 2; + NFSBCOPY(stateidp, tl, NFSX_STATEID); + tl += (NFSX_STATEID / NFSX_UNSIGNED); + *tl++ = txdr_unsigned(1); /* One error. */ + NFSBCOPY(devid, tl, NFSX_V4DEVICEID); + tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); + *tl++ = txdr_unsigned(stat); + *tl++ = txdr_unsigned(op); + } else { + *tl = txdr_unsigned(2 * NFSX_UNSIGNED); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + /* No ioerrs. */ + *tl++ = 0; + } + *tl = 0; /* No stats yet. */ } } nd->nd_flag |= ND_USEGSSNAME; @@ -6016,6 +6038,13 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int * error = nfsrpc_commitds(vp, off, xfer, *dspp, fhp, dp->nfsdi_vers, dp->nfsdi_minorvers, tcred, p); + NFSCL_DEBUG(4, "commitds=%d\n", error); + /* ENXIO indicates a problem with the DS. */ + if (error == ENXIO) { + NFSCL_DEBUG(4, + "DS layreterr for commit\n"); + nfscl_dserr(NFSV4OP_COMMIT, dp, lyp); + } } NFSCL_DEBUG(4, "aft nfsio_commitds=%d\n", error); if (error == 0) { @@ -6030,11 +6059,17 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int * np->n_flag &= ~NDSCOMMIT; mtx_unlock(&np->n_mtx); } - } else if (rwflag == NFSV4OPEN_ACCESSREAD) + } else if (rwflag == NFSV4OPEN_ACCESSREAD) { error = nfsrpc_readds(vp, uiop, stateidp, eofp, *dspp, off, xfer, fhp, 1, dp->nfsdi_vers, dp->nfsdi_minorvers, tcred, p); - else { + NFSCL_DEBUG(4, "readds=%d\n", error); + if (error == ENXIO) { + /* ENXIO indicates a problem with the DS. */ + NFSCL_DEBUG(4, "DS layreterr for read\n"); + nfscl_dserr(NFSV4OP_READ, dp, lyp); + } + } else { if (flp->nfsfl_mirrorcnt == 1) { error = nfsrpc_writeds(vp, uiop, iomode, must_commit, stateidp, *dspp, off, xfer, @@ -6065,6 +6100,12 @@ 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) { + /* ENXIO indicates a DS problem. */ + NFSCL_DEBUG(4, + "DS layreterr for write\n"); + nfscl_dserr(NFSV4OP_WRITE, dp, lyp); + } } } NFSCL_DEBUG(4, "aft read/writeds=%d\n", error);help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804212048.w3LKm4eI065402>
