Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Lookup the block device mounted on from the specfs_h...
details: https://anonhg.NetBSD.org/src/rev/3371f54e1ded
branches: trunk
changeset: 784705:3371f54e1ded
user: hannken <hannken%NetBSD.org@localhost>
date: Wed Feb 06 09:33:16 2013 +0000
description:
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 912ebd3d08c1 -r 3371f54e1ded sys/dev/fss.c
--- a/sys/dev/fss.c Wed Feb 06 09:29:46 2013 +0000
+++ b/sys/dev/fss.c Wed Feb 06 09:33:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.84 2013/02/06 09:29:46 hannken Exp $ */
+/* $NetBSD: fss.c,v 1.85 2013/02/06 09:33:16 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.84 2013/02/06 09:29:46 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.85 2013/02/06 09:33:16 hannken 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