From ba4ad1fceab8c8580845aa2006c51598a2573117 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 10 Jan 2000 12:04:27 +0000 Subject: [PATCH] Give vn_isdisk() a second argument where it can return a suitable errno. Suggested by: bde --- sys/contrib/softupdates/ffs_softdep.c | 7 ++++--- sys/dev/ccd/ccd.c | 4 +--- sys/dev/vinum/vinumio.c | 7 +++---- sys/fs/cd9660/cd9660_vfsops.c | 4 ++-- sys/fs/hpfs/hpfs_vfsops.c | 4 +--- sys/fs/msdosfs/msdosfs_vfsops.c | 4 ++-- sys/fs/ntfs/ntfs_vfsops.c | 4 +--- sys/fs/specfs/spec_vnops.c | 11 ++++++----- sys/geom/geom_ccd.c | 4 +--- sys/gnu/ext2fs/ext2_vfsops.c | 4 ++-- sys/gnu/fs/ext2fs/ext2_vfsops.c | 4 ++-- sys/isofs/cd9660/cd9660_vfsops.c | 4 ++-- sys/kern/vfs_aio.c | 4 ++-- sys/kern/vfs_bio.c | 6 +++--- sys/kern/vfs_export.c | 24 ++++++++++++++++++------ sys/kern/vfs_subr.c | 24 ++++++++++++++++++------ sys/kern/vfs_vnops.c | 4 +--- sys/miscfs/devfs/devfs_vnops.c | 2 +- sys/miscfs/specfs/spec_vnops.c | 11 ++++++----- sys/msdosfs/msdosfs_vfsops.c | 4 ++-- sys/ntfs/ntfs_vfsops.c | 4 +--- sys/sys/vnode.h | 2 +- sys/ufs/ffs/ffs_softdep.c | 7 ++++--- sys/ufs/ffs/ffs_vfsops.c | 8 +++----- sys/ufs/ffs/ffs_vnops.c | 5 ++--- sys/vm/vm_swap.c | 3 +-- 26 files changed, 90 insertions(+), 79 deletions(-) diff --git a/sys/contrib/softupdates/ffs_softdep.c b/sys/contrib/softupdates/ffs_softdep.c index 8f7e3f297707..46495f3e5817 100644 --- a/sys/contrib/softupdates/ffs_softdep.c +++ b/sys/contrib/softupdates/ffs_softdep.c @@ -3744,7 +3744,7 @@ softdep_fsync_mountdev(vp) struct buf *bp, *nbp; struct worklist *wk; - if (!vn_isdisk(vp)) + if (!vn_isdisk(vp, NULL)) panic("softdep_fsync_mountdev: vnode not a disk"); ACQUIRE_LOCK(&lk); for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { @@ -3806,7 +3806,7 @@ softdep_sync_metadata(ap) * Check whether this vnode is involved in a filesystem * that is doing soft dependency processing. */ - if (!vn_isdisk(vp)) { + if (!vn_isdisk(vp, NULL)) { if (!DOINGSOFTDEP(vp)) return (0); } else @@ -4031,7 +4031,8 @@ softdep_sync_metadata(ap) * way to accomplish this is to sync the entire filesystem (luckily * this happens rarely). */ - if (vn_isdisk(vp) && vp->v_specmountpoint && !VOP_ISLOCKED(vp, NULL) && + if (vn_isdisk(vp, NULL) && + vp->v_specmountpoint && !VOP_ISLOCKED(vp, NULL) && (error = VFS_SYNC(vp->v_specmountpoint, MNT_WAIT, ap->a_cred, ap->a_p)) != 0) return (error); diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 7109468d015b..c2a960de31a9 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -1603,10 +1603,8 @@ ccdlookup(path, p, vpp) goto bad; } - if (!vn_isdisk(vp)) { - error = ENOTBLK; + if (!vn_isdisk(vp, &error)) goto bad; - } #ifdef DEBUG if (ccddebug & CCDB_VNODE) diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c index 1dbc2cf1350a..929ec01e34e0 100644 --- a/sys/dev/vinum/vinumio.c +++ b/sys/dev/vinum/vinumio.c @@ -77,16 +77,15 @@ open_drive(struct drive *drive, struct proc *p, int verbose) drive->devicename, drive->vp->v_usecount); } - if (!vn_isdisk(drive->vp)) { /* only consider disks */ - NDFREE(&nd, NDF_ONLY_PNBUF); + if (!vn_isdisk(drive->vp, &drive->lasterror)) { /* only consider disks */ + NDFREE(&nd, NDF_ONLY_PNBUF); VOP_UNLOCK(drive->vp, 0, drive->p); close_drive(drive); - drive->lasterror = ENOTBLK; if (verbose) log(LOG_WARNING, "vinum open_drive %s: Not a block device\n", drive->devicename); - return ENOTBLK; + return drive->lasterror; } drive->vp->v_numoutput = 0; VOP_UNLOCK(drive->vp, 0, drive->p); diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 16d51e7a5c64..5a7e880e77d0 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -220,9 +220,9 @@ cd9660_mount(mp, path, data, ndp, p) vrele(devvp); return (ENXIO); } - if (!vn_isdisk(devvp)) { + if (!vn_isdisk(devvp, &error)) { vrele(devvp); - return (ENOTBLK); + return (error); } /* diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 1a7f85caf865..efbd013f2d60 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -238,10 +238,8 @@ hpfs_mount ( devvp = ndp->ni_vp; #if defined(__FreeBSD__) - if (!vn_isdisk(devvp)) { - err = ENOTBLK; + if (!vn_isdisk(devvp, &err)) goto error_2; - } #else /* defined(__NetBSD__) */ if (devvp->v_type != VBLK) { err = ENOTBLK; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 13272af03619..94578e8e846e 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -291,9 +291,9 @@ msdosfs_mount(mp, path, data, ndp, p) devvp = ndp->ni_vp; NDFREE(ndp, NDF_ONLY_PNBUF); - if (!vn_isdisk(devvp)) { + if (!vn_isdisk(devvp, &error)) { vrele(devvp); - return (ENOTBLK); + return (error); } /* * If mount by non-root, then verify that user has necessary diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index d4883be95e19..089c6ebf23a6 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -321,10 +321,8 @@ ntfs_mount ( devvp = ndp->ni_vp; #if defined(__FreeBSD__) - if (!vn_isdisk(devvp)) { - err = ENOTBLK; + if (!vn_isdisk(devvp, &err)) goto error_2; - } #else if (devvp->v_type != VBLK) { err = ENOTBLK; diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 4f8488eebb54..9641897a75bb 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -159,7 +159,8 @@ spec_open(ap) * XXX: take this into account, and consequently they need to * XXX: live in the diskslicing code. Some checks do. */ - if (vn_isdisk(vp) && ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) { + if (vn_isdisk(vp, NULL) && ap->a_cred != FSCRED && + (ap->a_mode & FWRITE)) { /* * Never allow opens for write if the device is mounted R/W */ @@ -204,7 +205,7 @@ spec_open(ap) } } - if (vn_isdisk(vp)) { + if (vn_isdisk(vp, NULL)) { if (!dev->si_bsize_phys) dev->si_bsize_phys = DEV_BSIZE; } @@ -337,7 +338,7 @@ spec_fsync(ap) struct buf *nbp; int s; - if (!vn_isdisk(vp)) + if (!vn_isdisk(vp, NULL)) return (0); /* @@ -415,7 +416,7 @@ spec_strategy(ap) * and write counts for disks that have associated filesystems. */ vp = ap->a_vp; - if (vn_isdisk(vp) && (mp = vp->v_specmountpoint) != NULL) { + if (vn_isdisk(vp, NULL) && (mp = vp->v_specmountpoint) != NULL) { if ((bp->b_flags & B_READ) == 0) { if (bp->b_lock.lk_lockholder == LK_KERNPROC) mp->mnt_stat.f_asyncwrites++; @@ -640,7 +641,7 @@ spec_getpages(ap) * block device is mounted. However, we can use v_rdev. */ - if (vn_isdisk(vp)) + if (vn_isdisk(vp, NULL)) blksiz = vp->v_rdev->si_bsize_phys; else blksiz = DEV_BSIZE; diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 7109468d015b..c2a960de31a9 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -1603,10 +1603,8 @@ ccdlookup(path, p, vpp) goto bad; } - if (!vn_isdisk(vp)) { - error = ENOTBLK; + if (!vn_isdisk(vp, &error)) goto bad; - } #ifdef DEBUG if (ccddebug & CCDB_VNODE) diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index 1865dbb187a9..ac30793a1c64 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -268,9 +268,9 @@ ext2_mount(mp, path, data, ndp, p) NDFREE(ndp, NDF_ONLY_PNBUF); devvp = ndp->ni_vp; - if (!vn_isdisk(devvp)) { + if (!vn_isdisk(devvp, &error)) { vrele(devvp); - return (ENOTBLK); + return (error); } /* diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 1865dbb187a9..ac30793a1c64 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -268,9 +268,9 @@ ext2_mount(mp, path, data, ndp, p) NDFREE(ndp, NDF_ONLY_PNBUF); devvp = ndp->ni_vp; - if (!vn_isdisk(devvp)) { + if (!vn_isdisk(devvp, &error)) { vrele(devvp); - return (ENOTBLK); + return (error); } /* diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 16d51e7a5c64..5a7e880e77d0 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -220,9 +220,9 @@ cd9660_mount(mp, path, data, ndp, p) vrele(devvp); return (ENXIO); } - if (!vn_isdisk(devvp)) { + if (!vn_isdisk(devvp, &error)) { vrele(devvp); - return (ENOTBLK); + return (error); } /* diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index fd632a9ca730..aba8a8270d17 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -934,8 +934,8 @@ aio_qphysio(p, aiocbe) vp = (struct vnode *)fp->f_data; - if (!vn_isdisk(vp)) - return (-1); + if (!vn_isdisk(vp, &error)) + return (error); if (cb->aio_nbytes % vp->v_rdev->si_bsize_phys) return (-1); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index f12316ba6a8f..2ef57c568f8a 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1016,7 +1016,7 @@ brelse(struct buf * bp) */ if ((bp->b_flags & B_VMIO) && !(bp->b_vp->v_tag == VT_NFS && - !vn_isdisk(bp->b_vp) && + !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI) && (bp->b_xflags & BX_BKGRDINPROG)) ) { @@ -2230,7 +2230,7 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo) int bsize, maxsize, vmio; off_t offset; - if (vn_isdisk(vp)) + if (vn_isdisk(vp, NULL)) bsize = DEV_BSIZE; else if (vp->v_mountedhere) bsize = vp->v_mountedhere->mnt_stat.f_iosize; @@ -2817,7 +2817,7 @@ biodone(register struct buf * bp) (int) m->pindex, (int)(foff >> 32), (int) foff & 0xffffffff, resid, i); #endif - if (!vn_isdisk(vp)) + if (!vn_isdisk(vp, NULL)) #if !defined(MAX_PERF) printf(" iosize: %ld, lblkno: %d, flags: 0x%lx, npages: %d\n", bp->b_vp->v_mount->mnt_stat.f_iosize, diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 4e6123e2c397..97d62510b83e 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -1012,7 +1012,7 @@ sched_sync(void) * slot we are safe. */ if (TAILQ_EMPTY(&vp->v_dirtyblkhd) && - !vn_isdisk(vp)) + !vn_isdisk(vp, NULL)) panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag); /* * Put us back on the worklist. The worklist @@ -2516,7 +2516,7 @@ vfs_object_create(vp, p, cred) vm_object_t object; int error = 0; - if (!vn_isdisk(vp) && vn_canvmio(vp) == FALSE) + if (!vn_isdisk(vp, NULL) && vn_canvmio(vp) == FALSE) return 0; retry: @@ -2875,15 +2875,27 @@ vn_todev(vp) * Check if vnode represents a disk device */ int -vn_isdisk(vp) +vn_isdisk(vp, errp) struct vnode *vp; + int *errp; { - if (vp->v_type != VBLK && vp->v_type != VCHR) + if (vp->v_type != VBLK && vp->v_type != VCHR) { + if (errp != NULL) + *errp = ENOTBLK; return (0); - if (!devsw(vp->v_rdev)) + } + if (!devsw(vp->v_rdev)) { + if (errp != NULL) + *errp = ENXIO; return (0); - if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) + } + if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) { + if (errp != NULL) + *errp = ENOTBLK; return (0); + } + if (errp != NULL) + *errp = 0; return (1); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 4e6123e2c397..97d62510b83e 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1012,7 +1012,7 @@ sched_sync(void) * slot we are safe. */ if (TAILQ_EMPTY(&vp->v_dirtyblkhd) && - !vn_isdisk(vp)) + !vn_isdisk(vp, NULL)) panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag); /* * Put us back on the worklist. The worklist @@ -2516,7 +2516,7 @@ vfs_object_create(vp, p, cred) vm_object_t object; int error = 0; - if (!vn_isdisk(vp) && vn_canvmio(vp) == FALSE) + if (!vn_isdisk(vp, NULL) && vn_canvmio(vp) == FALSE) return 0; retry: @@ -2875,15 +2875,27 @@ vn_todev(vp) * Check if vnode represents a disk device */ int -vn_isdisk(vp) +vn_isdisk(vp, errp) struct vnode *vp; + int *errp; { - if (vp->v_type != VBLK && vp->v_type != VCHR) + if (vp->v_type != VBLK && vp->v_type != VCHR) { + if (errp != NULL) + *errp = ENOTBLK; return (0); - if (!devsw(vp->v_rdev)) + } + if (!devsw(vp->v_rdev)) { + if (errp != NULL) + *errp = ENXIO; return (0); - if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) + } + if (!(devsw(vp->v_rdev)->d_flags & D_DISK)) { + if (errp != NULL) + *errp = ENOTBLK; return (0); + } + if (errp != NULL) + *errp = 0; return (1); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index edbf7b1073a5..bb390aeb7999 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -473,9 +473,7 @@ vn_stat(vp, sb, p) if (vap->va_type == VREG) { sb->st_blksize = vap->va_blocksize; - } else if ((vp->v_type == VBLK || vp->v_type == VCHR) && - devsw(vp->v_rdev) && (devsw(vp->v_rdev)->d_flags & D_DISK)) { - /* XXX use vn_isdisk() above once VCHR is also disk */ + } else if (vn_isdisk(vp, NULL)) { sb->st_blksize = vp->v_rdev->si_bsize_best; if (sb->st_blksize < vp->v_rdev->si_bsize_phys) sb->st_blksize = vp->v_rdev->si_bsize_phys; diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index 4d1c8bdf57d9..51315c7fcf18 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -1316,7 +1316,7 @@ devfs_open( struct vop_open_args *ap) if ( (dsw == NULL) || (dsw->d_open == NULL)) return ENXIO; if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE) && - vn_isdisk(vp)) { + vn_isdisk(vp, NULL)) { /* * When running in very secure mode, do not allow * opens for writing of any disk devices. diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 4f8488eebb54..9641897a75bb 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -159,7 +159,8 @@ spec_open(ap) * XXX: take this into account, and consequently they need to * XXX: live in the diskslicing code. Some checks do. */ - if (vn_isdisk(vp) && ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) { + if (vn_isdisk(vp, NULL) && ap->a_cred != FSCRED && + (ap->a_mode & FWRITE)) { /* * Never allow opens for write if the device is mounted R/W */ @@ -204,7 +205,7 @@ spec_open(ap) } } - if (vn_isdisk(vp)) { + if (vn_isdisk(vp, NULL)) { if (!dev->si_bsize_phys) dev->si_bsize_phys = DEV_BSIZE; } @@ -337,7 +338,7 @@ spec_fsync(ap) struct buf *nbp; int s; - if (!vn_isdisk(vp)) + if (!vn_isdisk(vp, NULL)) return (0); /* @@ -415,7 +416,7 @@ spec_strategy(ap) * and write counts for disks that have associated filesystems. */ vp = ap->a_vp; - if (vn_isdisk(vp) && (mp = vp->v_specmountpoint) != NULL) { + if (vn_isdisk(vp, NULL) && (mp = vp->v_specmountpoint) != NULL) { if ((bp->b_flags & B_READ) == 0) { if (bp->b_lock.lk_lockholder == LK_KERNPROC) mp->mnt_stat.f_asyncwrites++; @@ -640,7 +641,7 @@ spec_getpages(ap) * block device is mounted. However, we can use v_rdev. */ - if (vn_isdisk(vp)) + if (vn_isdisk(vp, NULL)) blksiz = vp->v_rdev->si_bsize_phys; else blksiz = DEV_BSIZE; diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index 13272af03619..94578e8e846e 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -291,9 +291,9 @@ msdosfs_mount(mp, path, data, ndp, p) devvp = ndp->ni_vp; NDFREE(ndp, NDF_ONLY_PNBUF); - if (!vn_isdisk(devvp)) { + if (!vn_isdisk(devvp, &error)) { vrele(devvp); - return (ENOTBLK); + return (error); } /* * If mount by non-root, then verify that user has necessary diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c index d4883be95e19..089c6ebf23a6 100644 --- a/sys/ntfs/ntfs_vfsops.c +++ b/sys/ntfs/ntfs_vfsops.c @@ -321,10 +321,8 @@ ntfs_mount ( devvp = ndp->ni_vp; #if defined(__FreeBSD__) - if (!vn_isdisk(devvp)) { - err = ENOTBLK; + if (!vn_isdisk(devvp, &err)) goto error_2; - } #else if (devvp->v_type != VBLK) { err = ENOTBLK; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index e37035a82084..376a21c197e2 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -569,7 +569,7 @@ int vrecycle __P((struct vnode *vp, struct simplelock *inter_lkp, struct proc *p)); int vn_close __P((struct vnode *vp, int flags, struct ucred *cred, struct proc *p)); -int vn_isdisk __P((struct vnode *vp)); +int vn_isdisk __P((struct vnode *vp, int *errp)); int vn_lock __P((struct vnode *vp, int flags, struct proc *p)); #ifdef DEBUG_LOCKS int debug_vn_lock __P((struct vnode *vp, int flags, struct proc *p, diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 8f7e3f297707..46495f3e5817 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3744,7 +3744,7 @@ softdep_fsync_mountdev(vp) struct buf *bp, *nbp; struct worklist *wk; - if (!vn_isdisk(vp)) + if (!vn_isdisk(vp, NULL)) panic("softdep_fsync_mountdev: vnode not a disk"); ACQUIRE_LOCK(&lk); for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { @@ -3806,7 +3806,7 @@ softdep_sync_metadata(ap) * Check whether this vnode is involved in a filesystem * that is doing soft dependency processing. */ - if (!vn_isdisk(vp)) { + if (!vn_isdisk(vp, NULL)) { if (!DOINGSOFTDEP(vp)) return (0); } else @@ -4031,7 +4031,8 @@ softdep_sync_metadata(ap) * way to accomplish this is to sync the entire filesystem (luckily * this happens rarely). */ - if (vn_isdisk(vp) && vp->v_specmountpoint && !VOP_ISLOCKED(vp, NULL) && + if (vn_isdisk(vp, NULL) && + vp->v_specmountpoint && !VOP_ISLOCKED(vp, NULL) && (error = VFS_SYNC(vp->v_specmountpoint, MNT_WAIT, ap->a_cred, ap->a_p)) != 0) return (error); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 77e821f53a9a..511c827440cf 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -280,10 +280,8 @@ ffs_mount( mp, path, data, ndp, p) NDFREE(ndp, NDF_ONLY_PNBUF); devvp = ndp->ni_vp; - if (!vn_isdisk(devvp)) { - err = ENOTBLK; + if (!vn_isdisk(devvp, &err)) goto error_2; - } /* * If mount by non-root, then verify that user has necessary @@ -442,7 +440,7 @@ ffs_reload(mp, cred, p) * Only VMIO the backing device if the backing device is a real * block device. See ffs_mountmfs() for more details. */ - if (devvp->v_tag != VT_MFS && vn_isdisk(devvp)) { + if (devvp->v_tag != VT_MFS && vn_isdisk(devvp, NULL)) { vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); vfs_object_create(devvp, p, p->p_ucred); simple_lock(&devvp->v_interlock); @@ -599,7 +597,7 @@ ffs_mountfs(devvp, mp, p, malloctype) * Note that it is optional that the backing device be VMIOed. This * increases the opportunity for metadata caching. */ - if (devvp->v_tag != VT_MFS && vn_isdisk(devvp)) { + if (devvp->v_tag != VT_MFS && vn_isdisk(devvp, NULL)) { vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); vfs_object_create(devvp, p, p->p_ucred); simple_lock(&devvp->v_interlock); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 6087d81dbdd3..5a7ce0baec4e 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -126,9 +126,8 @@ ffs_fsync(ap) int s, error, wait, passes, skipmeta; daddr_t lbn; - wait = (ap->a_waitfor == MNT_WAIT); - if (vn_isdisk(vp)) { + if (vn_isdisk(vp, NULL)) { lbn = INT_MAX; if (vp->v_specmountpoint != NULL && (vp->v_specmountpoint->mnt_flag & MNT_SOFTDEP)) @@ -265,7 +264,7 @@ ffs_fsync(ap) goto loop; } #ifdef DIAGNOSTIC - if (!vn_isdisk(vp)) + if (!vn_isdisk(vp, NULL)) vprint("ffs_fsync: dirty", vp); #endif } diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index 23bddade445c..9577c599979a 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -202,8 +202,7 @@ swapon(p, uap) NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; - if (!vn_isdisk(vp)) - error = ENOTBLK; + vn_isdisk(vp, &error); if (!error) error = swaponvp(p, vp, vp->v_rdev, 0);