svn commit: r327722 - head/sys/ufs/ffs
Konstantin Belousov
kib at FreeBSD.org
Tue Jan 9 10:44:18 UTC 2018
Author: kib
Date: Tue Jan 9 10:44:17 2018
New Revision: 327722
URL: https://svnweb.freebsd.org/changeset/base/327722
Log:
When handling write completion, take SU lock around calls to
handle_written_XXX() in case of processing the buffer with an error.
Tested by: pho (as part of the bigger patch)
Reviewed by: mckusick (as part of the bigger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/ufs/ffs/ffs_softdep.c
Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c Tue Jan 9 10:33:11 2018 (r327721)
+++ head/sys/ufs/ffs/ffs_softdep.c Tue Jan 9 10:44:17 2018 (r327722)
@@ -10978,12 +10978,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) {
@@ -11011,18 +11016,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);
More information about the svn-src-head
mailing list