Date: Sun, 13 May 2018 23:55:11 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333593 - projects/pnfs-planb-server/sys/fs/nfsserver Message-ID: <201805132355.w4DNtBgm012823@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Sun May 13 23:55:11 2018 New Revision: 333593 URL: https://svnweb.freebsd.org/changeset/base/333593 Log: Fix nfsrv_deleteds() for the case of more than two way mirrors with the first mirror already disabled when the main DS is disabled. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sun May 13 23:38:01 2018 (r333592) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sun May 13 23:55:11 2018 (r333593) @@ -7284,18 +7284,22 @@ nfsrv_deleteds(struct nfsdevice *fndds, struct nfsdevi return; } - if (TAILQ_EMPTY(&fndds->nfsdev_mirrors)) { + NFSD_DEBUG(4, "deleteds: deleting main ds\n"); + /* Search for a usable mirror. If none found, return. */ + TAILQ_FOREACH(mds, &fndds->nfsdev_mirrors, nfsdev_list) { + if (mds->nfsdev_nmp != NULL) + break; + } + if (mds == NULL) { printf("nfsrv_deleteds: empty mirror\n"); return; } /* - * The fndds is the first one, so make the first entry in the + * The fndds is the first one, so make the first valid entry in the * mirror list the first one. */ - NFSD_DEBUG(4, "deleteds: deleting main ds\n"); TAILQ_REMOVE(&nfsrv_devidhead, fndds, nfsdev_list); - mds = TAILQ_FIRST(&fndds->nfsdev_mirrors); TAILQ_REMOVE(&fndds->nfsdev_mirrors, mds, nfsdev_list); TAILQ_INIT(&mds->nfsdev_mirrors); @@ -7304,7 +7308,7 @@ nfsrv_deleteds(struct nfsdevice *fndds, struct nfsdevi while (nds != NULL) { NFSD_DEBUG(4, "shifting mirror up\n"); TAILQ_REMOVE(&fndds->nfsdev_mirrors, nds, nfsdev_list); - TAILQ_INSERT_HEAD(&mds->nfsdev_mirrors, nds, nfsdev_list); + TAILQ_INSERT_TAIL(&mds->nfsdev_mirrors, nds, nfsdev_list); nds = TAILQ_FIRST(&fndds->nfsdev_mirrors); } @@ -7314,7 +7318,7 @@ nfsrv_deleteds(struct nfsdevice *fndds, struct nfsdevi /* Put fndds in the mirror list with nfsdev_nmp == NULL. */ fndds->nfsdev_nmp = NULL; TAILQ_INIT(&fndds->nfsdev_mirrors); - TAILQ_INSERT_HEAD(&mds->nfsdev_mirrors, fndds, nfsdev_list); + TAILQ_INSERT_TAIL(&mds->nfsdev_mirrors, fndds, nfsdev_list); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805132355.w4DNtBgm012823>