Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/714d6958e90e
branches:  netbsd-6
changeset: 775673:714d6958e90e
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Feb 11 20:39:28 2013 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #810):
        sys/dev/fss.c: revision 1.85
Lookup the block device mounted on from the specfs_hash table.
This doesn't belong here but makes it possible to pullup.
Fixes PR kern/47020 (fss(4) panic)

diffstat:

 sys/dev/fss.c |  38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)

diffs (72 lines):

diff -r 3aab94153663 -r 714d6958e90e sys/dev/fss.c
--- a/sys/dev/fss.c     Mon Feb 11 04:22:15 2013 +0000
+++ b/sys/dev/fss.c     Mon Feb 11 20:39:28 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fss.c,v 1.81.4.2 2013/02/10 23:57:25 riz Exp $ */
+/*     $NetBSD: fss.c,v 1.81.4.3 2013/02/11 20:39:28 riz 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.2 2013/02/10 23:57:25 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.81.4.3 2013/02/11 20:39:28 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -620,7 +620,7 @@
 fss_create_files(struct fss_softc *sc, struct fss_set *fss,
     off_t *bsize, struct lwp *l)
 {
-       int error, bits, fsbsize;
+       int i, error, bits, fsbsize;
        uint64_t numsec;
        unsigned int secsize;
        struct timespec ts;
@@ -691,25 +691,31 @@
        vrele(vp);
 
        /*
-        * Get the block device it is mounted on.
+        * Get the block device it is mounted on and its size.
         */
 
-       error = namei_simple_kernel(sc->sc_mount->mnt_stat.f_mntfromname,
-                               NSM_FOLLOW_NOEMULROOT, &vp);
-       if (error != 0)
-               return error;
-
-       if (vp->v_type != VBLK) {
-               vrele(vp);
+       mutex_enter(&device_lock);
+       for (i = 0; i < SPECHSZ; i++) {
+               for (vp = specfs_hash[i]; vp; vp = vp->v_specnext) {
+                       if (vp->v_type == VBLK &&
+                           vp == vp->v_specnode->sn_dev->sd_bdevvp &&
+                           vp->v_specmountpoint == sc->sc_mount)
+                               break;
+               }
+               if (vp != NULL)
+                       break;
+       }
+       if (vp == NULL) {
+               mutex_exit(&device_lock);
                return EINVAL;
        }
-
+       mutex_enter(vp->v_interlock);
+       mutex_exit(&device_lock);
+       error = vget(vp, 0);
+       if (error)
+               return error;
        sc->sc_bdev = vp->v_rdev;
 
-       /*
-        * Get the block device size.
-        */
-
        error = getdisksize(vp, &numsec, &secsize);
        vrele(vp);
        if (error)



Home | Main Index | Thread Index | Old Index