svn commit: r323158 - projects/pnfs-planb-server-stable11/sys/fs/nfsserver

Rick Macklem rmacklem at FreeBSD.org
Mon Sep 4 20:23:41 UTC 2017


Author: rmacklem
Date: Mon Sep  4 20:23:39 2017
New Revision: 323158
URL: https://svnweb.freebsd.org/changeset/base/323158

Log:
  Fix handling of the case where one of the mirrors is no longer online.
  One small step towards handling failure/recovery of a mirror.

Modified:
  projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdport.c

Modified: projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdport.c	Mon Sep  4 20:19:36 2017	(r323157)
+++ projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdport.c	Mon Sep  4 20:23:39 2017	(r323158)
@@ -4174,7 +4174,7 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
 	struct nfsdevice *ds, *mds;
 	struct pnfsdsfile *pf;
 	uint32_t dsdir;
-	int done, error, fhiszero, gotone, i, j, mirrorcnt;
+	int done, error, fhiszero, gotone, i, mirrorcnt;
 
 	*mirrorcntp = 1;
 	fhiszero = 0;
@@ -4226,7 +4226,6 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
 			}
 			NFSDDSUNLOCK();
 			if (ds != NULL) {
-				gotone = 1;
 				if (dvpp != NULL || fhiszero != 0) {
 					dvp = ds->nfsdev_dsdir[dsdir];
 					error = vn_lock(dvp, lktype);
@@ -4250,6 +4249,7 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
 					devid += NFSX_V4DEVICEID;
 				}
 				if (error == 0) {
+					gotone++;
 					if (dvpp != NULL) {
 						*tdvpp++ = dvp;
 						*nmpp++ = nmp;
@@ -4271,14 +4271,14 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
 		error = ENOENT;
 
 	if (error == 0)
-		*mirrorcntp = mirrorcnt;
-	else if (i > 1 && dvpp != NULL && gotone != 0) {
+		*mirrorcntp = gotone;
+	else if (gotone > 0 && dvpp != NULL) {
 		/*
 		 * If the error didn't occur on the first one and dvpp != NULL,
 		 * the one(s) prior to the failure will have locked dvp's that
 		 * need to be unlocked.
 		 */
-		for (j = 1; j < i; j++) {
+		for (i = 0; i < gotone; i++) {
 			NFSVOPUNLOCK(*dvpp, 0);
 			*dvpp++ = NULL;
 		}


More information about the svn-src-projects mailing list