Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe prevent unconfigure/detach while backgroun...



details:   https://anonhg.NetBSD.org/src/rev/2bf64a5e8384
branches:  trunk
changeset: 812810:2bf64a5e8384
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Jan 04 13:15:17 2016 +0000

description:
prevent unconfigure/detach while background threads are running.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r ef6239282a28 -r 2bf64a5e8384 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Mon Jan 04 11:12:40 2016 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Mon Jan 04 13:15:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $     */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.337 2016/01/04 13:15:17 mlelstv Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.337 2016/01/04 13:15:17 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -967,7 +967,10 @@
 
        raidPtr = &rs->sc_r;
 
-       if (DK_BUSY(dksc, 0))
+       if (DK_BUSY(dksc, 0) ||
+           raidPtr->recon_in_progress != 0 ||
+           raidPtr->parity_rewrite_in_progress != 0 ||
+           raidPtr->copyback_in_progress != 0)
                return EBUSY;
 
        if ((rs->sc_flags & RAIDF_INITED) == 0)
@@ -1180,7 +1183,10 @@
                if ((error = raidlock(rs)) != 0)
                        return (error);
 
-               if (DK_BUSY(dksc, pmask))
+               if (DK_BUSY(dksc, pmask) ||
+                   raidPtr->recon_in_progress != 0 ||
+                   raidPtr->parity_rewrite_in_progress != 0 ||
+                   raidPtr->copyback_in_progress != 0)
                        retcode = EBUSY;
                else {
                        /* detach and free on close */



Home | Main Index | Thread Index | Old Index