Date: Mon, 3 Feb 2020 17:47:14 +0000 (UTC) From: Chuck Silvers <chs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357456 - head/sys/ufs/ffs Message-ID: <202002031747.013HlEBR001073@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002031747.013HlEBR001073>