aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c8
-rw-r--r--sys/kern/vfs_subr.c46
2 files changed, 25 insertions, 29 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 6355dd0e5990..e4433be4a602 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -297,8 +297,14 @@ int
soabort(so)
struct socket *so;
{
+ int error;
- return (*so->so_proto->pr_usrreqs->pru_abort)(so);
+ error = (*so->so_proto->pr_usrreqs->pru_abort)(so);
+ if (error) {
+ sofree(so);
+ return error;
+ }
+ return (0);
}
int
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 7d61a1864a23..a528d8783769 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -328,40 +328,31 @@ vfs_getvfs(fsid)
}
/*
- * Get a new unique fsid. Try to make its val[0] unique mod 2^16, since
- * this value may be used to create fake device numbers for stat(), and
- * some emulators only support 16-bit device numbers.
+ * Get a new unique fsid. Try to make its val[0] unique, since this value
+ * will be used to create fake device numbers for stat(). Also try (but
+ * not so hard) make its val[0] unique mod 2^16, since some emulators only
+ * support 16-bit device numbers. We end up with unique val[0]'s for the
+ * first 2^16 calls and unique val[0]'s mod 2^16 for the first 2^8 calls.
*
* Keep in mind that several mounts may be running in parallel. Starting
- * the search one past where the previous search terminated (mod 0x10) is
- * both a micro-optimization and (incomplete) defense against returning
- * the same fsid to different mounts.
+ * the search one past where the previous search terminated is both a
+ * micro-optimization and a defense against returning the same fsid to
+ * different mounts.
*/
void
vfs_getnewfsid(mp)
struct mount *mp;
{
- static u_int mntid_base;
+ static u_int16_t mntid_base;
fsid_t tfsid;
- u_int i;
- int mtype, mynor;
+ int mtype;
simple_lock(&mntid_slock);
mtype = mp->mnt_vfc->vfc_typenum;
tfsid.val[1] = mtype;
- for (i = 0; ; i++) {
- /*
- * mtype needs to be uniquely encoded in the minor number
- * so that uniqueness of the full fsid implies uniqueness
- * of the device number. We are short of bits and only
- * guarantee uniqueness of the device number mod 2^16 if
- * mtype is always < 16 and there are never more than
- * 16 mounts per vfs type.
- */
- mynor = ((mntid_base++ & 0xFFFFF) << 4) | (mtype & 0xF);
- if (i < 0x10)
- mynor &= 0xFF;
- tfsid.val[0] = makeudev(255, mynor);
+ mtype = (mtype & 0xFF) << 16;
+ for (;;) {
+ tfsid.val[0] = makeudev(255, mtype | mntid_base++);
if (vfs_getvfs(&tfsid) == NULL)
break;
}
@@ -1119,7 +1110,6 @@ pbrelvp(bp)
KASSERT(bp->b_vp != NULL, ("pbrelvp: NULL"));
-#if !defined(MAX_PERF)
/* XXX REMOVE ME */
if (bp->b_vnbufs.tqe_next != NULL) {
panic(
@@ -1128,7 +1118,6 @@ pbrelvp(bp)
(int)bp->b_flags
);
}
-#endif
bp->b_vp = (struct vnode *) 0;
bp->b_flags &= ~B_PAGING;
}
@@ -1138,14 +1127,12 @@ pbreassignbuf(bp, newvp)
struct buf *bp;
struct vnode *newvp;
{
-#if !defined(MAX_PERF)
if ((bp->b_flags & B_PAGING) == 0) {
panic(
"pbreassignbuf() on non phys bp %p",
bp
);
}
-#endif
bp->b_vp = newvp;
}
@@ -1169,14 +1156,12 @@ reassignbuf(bp, newvp)
}
++reassignbufcalls;
-#if !defined(MAX_PERF)
/*
* B_PAGING flagged buffers cannot be reassigned because their vp
* is not fully linked in.
*/
if (bp->b_flags & B_PAGING)
panic("cannot reassign paging buffer");
-#endif
s = splbio();
/*
@@ -2924,6 +2909,11 @@ vn_isdisk(vp, errp)
*errp = ENOTBLK;
return (0);
}
+ if (vp->v_rdev == NULL) {
+ if (errp != NULL)
+ *errp = ENXIO;
+ return (0);
+ }
if (!devsw(vp->v_rdev)) {
if (errp != NULL)
*errp = ENXIO;