From owner-svn-src-all@freebsd.org Mon Feb 3 17:47:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FCF922996C; Mon, 3 Feb 2020 17:47:15 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48BFdZ6PNjz3Lyg; Mon, 3 Feb 2020 17:47:14 +0000 (UTC) (envelope-from chs@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 D271447CE; Mon, 3 Feb 2020 17:47:14 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 013HlEbM001075; Mon, 3 Feb 2020 17:47:14 GMT (envelope-from chs@FreeBSD.org) Received: (from chs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 013HlEBR001073; Mon, 3 Feb 2020 17:47:14 GMT (envelope-from chs@FreeBSD.org) Message-Id: <202002031747.013HlEBR001073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chs set sender to chs@FreeBSD.org using -f From: Chuck Silvers Date: Mon, 3 Feb 2020 17:47:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357456 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: chs X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 357456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2020 17:47:15 -0000 Author: chs Date: Mon Feb 3 17:47:14 2020 New Revision: 357456 URL: https://svnweb.freebsd.org/changeset/base/357456 Log: With INVARIANTS, track all softdep dependency structures centrally so that we can find them in dumps. Approved by: mckusick (mentor) Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/softdep.h Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Mon Feb 3 17:35:11 2020 (r357455) +++ head/sys/ufs/ffs/ffs_softdep.c Mon Feb 3 17:47:14 2020 (r357456) @@ -1208,6 +1208,9 @@ workitem_free(item, type) ump->um_fs->fs_fsmnt, TYPENAME(item->wk_type))); atomic_subtract_long(&dep_current[item->wk_type], 1); ump->softdep_curdeps[item->wk_type] -= 1; +#ifdef INVARIANTS + LIST_REMOVE(item, wk_all); +#endif free(item, DtoM(type)); } @@ -1234,6 +1237,9 @@ workitem_alloc(item, type, mp) ump->softdep_curdeps[type] += 1; ump->softdep_deps++; ump->softdep_accdeps++; +#ifdef INVARIANTS + LIST_INSERT_HEAD(&ump->softdep_alldeps[type], item, wk_all); +#endif FREE_LOCK(ump); } @@ -2532,6 +2538,10 @@ softdep_mount(devvp, mp, fs, cred) ump->indir_hash_size = i - 1; for (i = 0; i <= ump->indir_hash_size; i++) TAILQ_INIT(&ump->indir_hashtbl[i]); +#ifdef INVARIANTS + for (i = 0; i <= D_LAST; i++) + LIST_INIT(&ump->softdep_alldeps[i]); +#endif ACQUIRE_GBLLOCK(&lk); TAILQ_INSERT_TAIL(&softdepmounts, sdp, sd_next); FREE_GBLLOCK(&lk); @@ -2638,10 +2648,14 @@ softdep_unmount(mp) ump->bmsafemap_hash_size); free(ump->indir_hashtbl, M_FREEWORK); #ifdef INVARIANTS - for (i = 0; i <= D_LAST; i++) + for (i = 0; i <= D_LAST; i++) { KASSERT(ump->softdep_curdeps[i] == 0, ("Unmount %s: Dep type %s != 0 (%ld)", ump->um_fs->fs_fsmnt, TYPENAME(i), ump->softdep_curdeps[i])); + KASSERT(LIST_EMPTY(&ump->softdep_alldeps[i]), + ("Unmount %s: Dep type %s not empty (%p)", ump->um_fs->fs_fsmnt, + TYPENAME(i), LIST_FIRST(&ump->softdep_alldeps[i]))); + } #endif free(ump->um_softdep, M_MOUNTDATA); } Modified: head/sys/ufs/ffs/softdep.h ============================================================================== --- head/sys/ufs/ffs/softdep.h Mon Feb 3 17:35:11 2020 (r357455) +++ head/sys/ufs/ffs/softdep.h Mon Feb 3 17:47:14 2020 (r357456) @@ -216,6 +216,7 @@ struct worklist { #ifdef INVARIANTS const char *wk_func; /* func where added / removed */ int wk_line; /* line where added / removed */ + LIST_ENTRY(worklist) wk_all; /* list of deps of this type */ #endif }; #define WK_DATA(wk) ((void *)(wk)) @@ -1073,6 +1074,9 @@ struct mount_softdeps { TAILQ_ENTRY(mount_softdeps) sd_next; /* List of softdep filesystem */ struct ufsmount *sd_ump; /* our ufsmount structure */ u_long sd_curdeps[D_LAST + 1]; /* count of current deps */ +#ifdef INVARIANTS + struct workhead sd_alldeps[D_LAST + 1];/* Lists of all deps */ +#endif }; /* * Flags for communicating with the syncer thread. @@ -1113,3 +1117,4 @@ struct mount_softdeps { #define softdep_flags um_softdep->sd_flags #define softdep_flushtd um_softdep->sd_flushtd #define softdep_curdeps um_softdep->sd_curdeps +#define softdep_alldeps um_softdep->sd_alldeps