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

Rick Macklem rmacklem at FreeBSD.org
Fri Jun 22 00:36:43 UTC 2018


Author: rmacklem
Date: Fri Jun 22 00:36:41 2018
New Revision: 335522
URL: https://svnweb.freebsd.org/changeset/base/335522

Log:
  This patch is actually all client side changes and does not affect the server.
  
  Get rid of newnfs_canceldspreqs(), since it causes problems when there are
  multiple DSs on the same machine and they share a TCP connection.
  
  Add a wakeup() plus fill in error information for Layoutreturns, so that
  a layoutreturn with the error information gets sent to the MDS quickly.
  
  Make a slight change so that a layoutreturn with error information is
  returned to the MDS for all errors except EACCES. Also, pass the error
  back to the MDS instead of just EIO so that the MDS can decide what to
  do w.r.t. it.

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

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c	Fri Jun 22 00:30:24 2018	(r335521)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c	Fri Jun 22 00:36:41 2018	(r335522)
@@ -1198,32 +1198,6 @@ lookformore:
 }
 
 /*
- * Sinilar to newnfs_nmcancelreqs(), except that it is called for a
- * single DS's dsp.
- * It also marks the session defunct.
- */
-void
-newnfs_canceldspreq(struct nfsclds *dsp)
-{
-#ifdef notnow
-	struct __rpc_client *cl;
-
-	NFSLOCKDS(dsp);
-	if ((dsp->nfsclds_flags & NFSCLDS_CLOSED) == 0 &&
-	    dsp->nfsclds_sockp != NULL &&
-	    dsp->nfsclds_sockp->nr_client != NULL) {
-		dsp->nfsclds_flags |= NFSCLDS_CLOSED;
-		dsp->nfsclds_sess.nfsess_defunct = 1;
-		cl = dsp->nfsclds_sockp->nr_client;
-		NFSUNLOCKDS(dsp);
-		CLNT_CLOSE(cl);
-		return;
-	}
-	NFSUNLOCKDS(dsp);
-#endif
-}
-
-/*
  * Any signal that can interrupt an NFS operation in an intr mount
  * should be added to this set. SIGSTOP and SIGKILL cannot be masked.
  */

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h	Fri Jun 22 00:30:24 2018	(r335521)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h	Fri Jun 22 00:36:41 2018	(r335522)
@@ -601,8 +601,8 @@ int nfscl_layout(struct nfsmount *, vnode_t, u_int8_t 
     NFSPROC_T *);
 struct nfscllayout *nfscl_getlayout(struct nfsclclient *, uint8_t *, int,
     uint64_t, struct nfsclflayout **, int *);
-void nfscl_dserr(uint32_t, struct nfscldevinfo *, struct nfscllayout *,
-    struct nfsclds *);
+void nfscl_dserr(uint32_t, uint32_t, struct nfscldevinfo *,
+    struct nfscllayout *, struct nfsclds *);
 void nfscl_rellayout(struct nfscllayout *, int);
 struct nfscldevinfo *nfscl_getdevinfo(struct nfsclclient *, uint8_t *,
     struct nfscldevinfo *);
@@ -718,7 +718,6 @@ int nfsrv_setacl(struct vnode *, NFSACL_T *, struct uc
 
 /* nfs_commonkrpc.c */
 int newnfs_nmcancelreqs(struct nfsmount *);
-void newnfs_canceldspreq(struct nfsclds *);
 void newnfs_set_sigmask(struct thread *, sigset_t *);
 void newnfs_restore_sigmask(struct thread *, sigset_t *);
 int newnfs_msleep(struct thread *, void *, struct mtx *, int, char *, int);

Modified: projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c	Fri Jun 22 00:30:24 2018	(r335521)
+++ projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clrpcops.c	Fri Jun 22 00:36:41 2018	(r335522)
@@ -6040,11 +6040,11 @@ 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);
-				if (nfsds_failerr(error)) {
+				if (error != 0 && error != EACCES) {
 					NFSCL_DEBUG(4,
 					    "DS layreterr for commit\n");
-					nfscl_dserr(NFSV4OP_COMMIT, dp, lyp,
-					    *dspp);
+					nfscl_dserr(NFSV4OP_COMMIT, error, dp,
+					    lyp, *dspp);
 				}
 			}
 			NFSCL_DEBUG(4, "aft nfsio_commitds=%d\n", error);
@@ -6065,9 +6065,10 @@ 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 (nfsds_failerr(error)) {
+			if (error != 0 && error != EACCES) {
 				NFSCL_DEBUG(4, "DS layreterr for read\n");
-				nfscl_dserr(NFSV4OP_READ, dp, lyp, *dspp);
+				nfscl_dserr(NFSV4OP_READ, error, dp, lyp,
+				    *dspp);
 			}
 		} else {
 			if (flp->nfsfl_mirrorcnt == 1) {
@@ -6100,11 +6101,11 @@ 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 (nfsds_failerr(error)) {
+				if (error != 0 && error != EACCES) {
 					NFSCL_DEBUG(4,
 					    "DS layreterr for write\n");
-					nfscl_dserr(NFSV4OP_WRITE, dp, lyp,
-					    *dspp);
+					nfscl_dserr(NFSV4OP_WRITE, error, dp,
+					    lyp, *dspp);
 				}
 			}
 		}

Modified: projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clstate.c	Fri Jun 22 00:30:24 2018	(r335521)
+++ projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clstate.c	Fri Jun 22 00:36:41 2018	(r335522)
@@ -4974,8 +4974,8 @@ nfscl_retoncloselayout(vnode_t vp, struct nfsclclient 
  * Also, disable the dsp from further use.
  */
 void
-nfscl_dserr(uint32_t op, struct nfscldevinfo *dp, struct nfscllayout *lyp,
-    struct nfsclds *dsp)
+nfscl_dserr(uint32_t op, uint32_t stat, struct nfscldevinfo *dp,
+    struct nfscllayout *lyp, __unused struct nfsclds *dsp)
 {
 	struct nfsclrecalllayout *recallp;
 	uint32_t iomode;
@@ -4990,17 +4990,14 @@ nfscl_dserr(uint32_t op, struct nfscldevinfo *dp, stru
 		if (!LIST_EMPTY(&lyp->nfsly_flayrw))
 			iomode |= NFSLAYOUTIOMODE_RW;
 		(void)nfscl_layoutrecall(NFSLAYOUTRETURN_FILE, lyp, iomode,
-		    0, UINT64_MAX, lyp->nfsly_stateid.seqid, NFSERR_IO, op,
+		    0, UINT64_MAX, lyp->nfsly_stateid.seqid, stat, op,
 		    dp->nfsdi_deviceid, recallp);
 		NFSUNLOCKCLSTATE();
-		NFSCL_DEBUG(4, "retoncls recall iomode=%d\n", iomode);
+		NFSCL_DEBUG(4, "nfscl_dserr recall iomode=%d\n", iomode);
 	} else {
 		NFSUNLOCKCLSTATE();
 		free(recallp, M_NFSLAYRECALL);
 	}
-
-	/* Disable the dsp. */
-	newnfs_canceldspreq(dsp);
 }
 
 /*
@@ -5253,6 +5250,19 @@ nfscl_layoutrecall(int recalltype, struct nfscllayout 
 			LIST_INSERT_BEFORE(rp, recallp, nfsrecly_list);
 			break;
 		}
+
+		/*
+		 * Put any error return on all the file returns that will
+		 * preceed this one.
+		 */
+		if (rp->nfsrecly_recalltype == NFSLAYOUTRETURN_FILE &&
+		   stat != 0 && rp->nfsrecly_stat == 0) {
+			rp->nfsrecly_stat = stat;
+			rp->nfsrecly_op = op;
+			if (devid != NULL)
+				NFSBCOPY(devid, rp->nfsrecly_devid,
+				    NFSX_V4DEVICEID);
+		}
 	}
 	if (rp == NULL) {
 		if (orp == NULL)
@@ -5262,6 +5272,7 @@ nfscl_layoutrecall(int recalltype, struct nfscllayout 
 			LIST_INSERT_AFTER(orp, recallp, nfsrecly_list);
 	}
 	lyp->nfsly_flags |= NFSLY_RECALL;
+	wakeup(lyp->nfsly_clp);
 	return (0);
 }
 


More information about the svn-src-projects mailing list