Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs Don't time out the discard work queue here. Eith...



details:   https://anonhg.NetBSD.org/src/rev/95df26b553cc
branches:  trunk
changeset: 826074:95df26b553cc
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Aug 13 21:00:58 2017 +0000

description:
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.

diffstat:

 sys/ufs/ffs/ffs_alloc.c |  9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r e00efc3a574c -r 95df26b553cc sys/ufs/ffs/ffs_alloc.c
--- a/sys/ufs/ffs/ffs_alloc.c   Sun Aug 13 19:18:08 2017 +0000
+++ b/sys/ufs/ffs/ffs_alloc.c   Sun Aug 13 21:00:58 2017 +0000
@@ -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 @@
 {
        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) {



Home | Main Index | Thread Index | Old Index