Module Name: src Committed By: mlelstv Date: Sun Aug 13 21:00:58 UTC 2017
Modified Files: src/sys/ufs/ffs: ffs_alloc.c Log Message: Don't time out the discard work queue here. Either destroying a work queue with pending work items panics or accessing freed resources from the work item will crash. The timeout needs to be handled gracefully by the driver that implements the discard operation. Fixes parts of PR 50725. To generate a diff of this commit: cvs rdiff -u -r1.157 -r1.158 src/sys/ufs/ffs/ffs_alloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/ffs/ffs_alloc.c diff -u src/sys/ufs/ffs/ffs_alloc.c:1.157 src/sys/ufs/ffs/ffs_alloc.c:1.158 --- src/sys/ufs/ffs/ffs_alloc.c:1.157 Wed Jul 12 09:30:16 2017 +++ src/sys/ufs/ffs/ffs_alloc.c Sun Aug 13 21:00:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.157 2017/07/12 09:30:16 hannken Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.158 2017/08/13 21:00:58 mlelstv Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.157 2017/07/12 09:30:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.158 2017/08/13 21:00:58 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -1659,17 +1659,14 @@ ffs_discard_finish(void *vts, int flags) { struct discarddata *ts = vts; struct discardopdata *td = NULL; - int res = 0; /* wait for workqueue to drain */ mutex_enter(&ts->wqlk); if (ts->wqcnt) { ts->wqdraining = 1; - res = cv_timedwait(&ts->wqcv, &ts->wqlk, mstohz(5000)); + cv_wait(&ts->wqcv, &ts->wqlk); } mutex_exit(&ts->wqlk); - if (res) - printf("ffs_discarddata drain timeout\n"); mutex_enter(&ts->entrylk); if (ts->entry) {