Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Make FSS_ERROR a flag to prevent bogus fscow_disesta...



details:   https://anonhg.NetBSD.org/src/rev/37a7f638f81b
branches:  trunk
changeset: 997066:37a7f638f81b
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Feb 20 10:03:25 2019 +0000

description:
Make FSS_ERROR a flag to prevent bogus fscow_disestablish() after error.

diffstat:

 sys/dev/fss.c    |  14 +++++++-------
 sys/dev/fssvar.h |   6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (83 lines):

diff -r c91a42034a97 -r 37a7f638f81b sys/dev/fss.c
--- a/sys/dev/fss.c     Wed Feb 20 10:02:51 2019 +0000
+++ b/sys/dev/fss.c     Wed Feb 20 10:03:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fss.c,v 1.106 2018/08/29 09:04:40 hannken Exp $        */
+/*     $NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $        */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.106 2018/08/29 09:04:40 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -398,8 +398,7 @@
                mutex_enter(&sc->sc_slock);
                if ((flag & FWRITE) == 0) {
                        error = EPERM;
-               } else if (sc->sc_state != FSS_ACTIVE &&
-                   sc->sc_state != FSS_ERROR) {
+               } else if (sc->sc_state != FSS_ACTIVE) {
                        error = EBUSY;
                } else {
                        sc->sc_state = FSS_DESTROYING;
@@ -509,7 +508,7 @@
 
        KASSERT(mutex_owned(&sc->sc_slock));
 
-       if (sc->sc_state == FSS_ERROR)
+       if ((sc->sc_flags & FSS_ERROR))
                return;
 
        aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
@@ -518,7 +517,7 @@
                fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
                mutex_enter(&sc->sc_slock);
        }
-       sc->sc_state = FSS_ERROR;
+       sc->sc_flags |= FSS_ERROR;
 }
 
 /*
@@ -944,7 +943,8 @@
 {
 
        mutex_enter(&sc->sc_slock);
-       if ((sc->sc_flags & FSS_PERSISTENT) == 0 && sc->sc_state != FSS_ERROR) {
+       if ((sc->sc_flags & FSS_PERSISTENT) == 0 &&
+           (sc->sc_flags & FSS_ERROR) == 0) {
                mutex_exit(&sc->sc_slock);
                fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
        } else {
diff -r c91a42034a97 -r 37a7f638f81b sys/dev/fssvar.h
--- a/sys/dev/fssvar.h  Wed Feb 20 10:02:51 2019 +0000
+++ b/sys/dev/fssvar.h  Wed Feb 20 10:03:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fssvar.h,v 1.31 2018/08/29 09:04:40 hannken Exp $      */
+/*     $NetBSD: fssvar.h,v 1.32 2019/02/20 10:03:25 hannken Exp $      */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -137,8 +137,7 @@
        FSS_IDLE,                       /* Device is unconfigured */
        FSS_CREATING,                   /* Device is currently configuring */
        FSS_ACTIVE,                     /* Device is configured */
-       FSS_DESTROYING,                 /* Device is currently unconfiguring */
-       FSS_ERROR                       /* Device had errors */
+       FSS_DESTROYING                  /* Device is currently unconfiguring */
 } fss_state_t;
 
 struct fss_softc {
@@ -148,6 +147,7 @@
        kcondvar_t      sc_cache_cv;    /* Signals free cache slot */
        fss_state_t     sc_state;       /* Current state */
        volatile int    sc_flags;       /* Flags */
+#define FSS_ERROR      0x01            /* Device had errors. */
 #define FSS_BS_THREAD  0x04            /* Kernel thread is running */
 #define FSS_PERSISTENT 0x20            /* File system internal snapshot */
 #define FSS_CDEV_OPEN  0x40            /* character device open */



Home | Main Index | Thread Index | Old Index