From owner-svn-src-projects@freebsd.org Sun May 13 23:55:12 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 72EDCFDAF7C for ; Sun, 13 May 2018 23:55:12 +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 1CCDA6F818; Sun, 13 May 2018 23:55:12 +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 F30D71475D; Sun, 13 May 2018 23:55:11 +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 w4DNtBLk012824; Sun, 13 May 2018 23:55:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4DNtBgm012823; Sun, 13 May 2018 23:55:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805132355.w4DNtBgm012823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 13 May 2018 23:55:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333593 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Commit-Revision: 333593 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.25 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: Sun, 13 May 2018 23:55:12 -0000 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); } /*