Date: Tue, 16 Jan 2018 10:56:35 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328046 - stable/11/sys/ufs/ffs Message-ID: <201801161056.w0GAuZfG011923@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Jan 16 10:56:35 2018 New Revision: 328046 URL: https://svnweb.freebsd.org/changeset/base/328046 Log: MFC r327722: When handling write completion, take SU lock around calls to handle_written_XXX() in case of processing the buffer with an error. Modified: stable/11/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_softdep.c Tue Jan 16 10:54:32 2018 (r328045) +++ stable/11/sys/ufs/ffs/ffs_softdep.c Tue Jan 16 10:56:35 2018 (r328046) @@ -10974,12 +10974,17 @@ softdep_disk_write_complete(bp) struct freeblks *freeblks; struct buf *sbp; + if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) + return; + ump = VFSTOUFS(wk->wk_mp); + /* * If an error occurred while doing the write, then the data * has not hit the disk and the dependencies cannot be processed. * But we do have to go through and roll forward any dependencies * that were rolled back before the disk write. */ + ACQUIRE_LOCK(ump); if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & B_INVAL) == 0) { LIST_FOREACH(wk, &bp->b_dep, wk_list) { switch (wk->wk_type) { @@ -11007,18 +11012,15 @@ softdep_disk_write_complete(bp) continue; } } + FREE_LOCK(ump); return; } - if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) - return; - ump = VFSTOUFS(wk->wk_mp); LIST_INIT(&reattach); /* * This lock must not be released anywhere in this code segment. */ sbp = NULL; owk = NULL; - ACQUIRE_LOCK(ump); while ((wk = LIST_FIRST(&bp->b_dep)) != NULL) { WORKLIST_REMOVE(wk); atomic_add_long(&dep_write[wk->wk_type], 1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801161056.w0GAuZfG011923>