Source-Changes-HG archive

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

[src/netbsd-6-1]: src/sys/dev Pull up following revision(s) (requested by han...



details:   https://anonhg.NetBSD.org/src/rev/e6ec59c1ef81
branches:  netbsd-6-1
changeset: 776149:e6ec59c1ef81
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Aug 27 14:48:50 2016 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #1399):
        sys/dev/fss.c: revision 1.95
Disestablish COW handler on error.  No need to do further copies after
the snapshot device failed.
Should fix PR kern/51377: fss(4) panic if snapshot mounted read/write

diffstat:

 sys/dev/fss.c |  24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diffs (65 lines):

diff -r 803dee909c3f -r e6ec59c1ef81 sys/dev/fss.c
--- a/sys/dev/fss.c     Sat Aug 27 14:42:02 2016 +0000
+++ b/sys/dev/fss.c     Sat Aug 27 14:48:50 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fss.c,v 1.81.4.3 2013/02/11 20:39:28 riz Exp $ */
+/*     $NetBSD: fss.c,v 1.81.4.3.2.1 2016/08/27 14:48:50 bouyer Exp $  */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.81.4.3 2013/02/11 20:39:28 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.81.4.3.2.1 2016/08/27 14:48:50 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -430,17 +430,20 @@
 
 /*
  * An error occurred reading or writing the snapshot or backing store.
- * If it is the first error log to console.
+ * If it is the first error log to console and disestablish cow handler.
  * The caller holds the mutex.
  */
 static inline void
 fss_error(struct fss_softc *sc, const char *msg)
 {
 
-       if ((sc->sc_flags & (FSS_ACTIVE|FSS_ERROR)) == FSS_ACTIVE)
-               aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
-       if ((sc->sc_flags & FSS_ACTIVE) == FSS_ACTIVE)
-               sc->sc_flags |= FSS_ERROR;
+       if ((sc->sc_flags & (FSS_ACTIVE | FSS_ERROR)) != FSS_ACTIVE)
+               return;
+
+       aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
+       if ((sc->sc_flags & FSS_PERSISTENT) == 0)
+               fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
+       sc->sc_flags |= FSS_ERROR;
 }
 
 /*
@@ -560,9 +563,8 @@
                if ((sc = device_lookup_private(&fss_cd, i)) == NULL)
                        continue;
                mutex_enter(&sc->sc_slock);
-               if ((sc->sc_flags & FSS_ACTIVE) != 0 &&
-                   sc->sc_mount == mp)
-                       fss_error(sc, "forced unmount");
+               if ((sc->sc_flags & FSS_ACTIVE) != 0 && sc->sc_mount == mp)
+                       fss_error(sc, "forced by unmount");
                mutex_exit(&sc->sc_slock);
        }
        mutex_exit(&fss_device_lock);
@@ -888,7 +890,7 @@
 fss_delete_snapshot(struct fss_softc *sc, struct lwp *l)
 {
 
-       if ((sc->sc_flags & FSS_PERSISTENT) == 0)
+       if ((sc->sc_flags & (FSS_PERSISTENT | FSS_ERROR)) == 0)
                fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
 
        mutex_enter(&sc->sc_slock);



Home | Main Index | Thread Index | Old Index