Module Name: src Committed By: hannken Date: Sun Jun 4 08:00:27 UTC 2017
Modified Files: src/sys/kern: vnode_if.c src/sys/rump/include/rump: rumpvnode_if.h src/sys/rump/librump/rumpvfs: rumpvnode_if.c src/sys/sys: vnode_if.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/kern/vnode_if.c cvs rdiff -u -r1.28 -r1.29 src/sys/rump/include/rump/rumpvnode_if.h cvs rdiff -u -r1.28 -r1.29 src/sys/rump/librump/rumpvfs/rumpvnode_if.c cvs rdiff -u -r1.99 -r1.100 src/sys/sys/vnode_if.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vnode_if.c diff -u src/sys/kern/vnode_if.c:1.104 src/sys/kern/vnode_if.c:1.105 --- src/sys/kern/vnode_if.c:1.104 Fri May 26 14:21:54 2017 +++ src/sys/kern/vnode_if.c Sun Jun 4 08:00:27 2017 @@ -1,13 +1,13 @@ -/* $NetBSD: vnode_if.c,v 1.104 2017/05/26 14:21:54 riastradh Exp $ */ +/* $NetBSD: vnode_if.c,v 1.105 2017/06/04 08:00:27 hannken Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.75 2017/05/26 14:21:00 riastradh Exp + * NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.64 2017/04/16 17:18:28 riastradh Exp + * NetBSD: vnode_if.sh,v 1.65 2017/06/04 07:59:17 hannken Exp */ /* @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.104 2017/05/26 14:21:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.105 2017/06/04 08:00:27 hannken Exp $"); #include <sys/param.h> #include <sys/mount.h> @@ -49,6 +49,57 @@ __KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v #include <sys/lock.h> #include <sys/fstrans.h> +enum fst_op { FST_NO, FST_YES, FST_TRY }; + +static inline int +vop_pre(vnode_t *vp, struct mount **mp, bool *mpsafe, enum fst_op op) +{ + int error; + + *mpsafe = (vp->v_vflag & VV_MPSAFE); + + if (!*mpsafe) { + KERNEL_LOCK(1, curlwp); + } + + if (op == FST_YES || op == FST_TRY) { + for (;;) { + *mp = vp->v_mount; + if (op == FST_TRY) { + error = fstrans_start_nowait(*mp, FSTRANS_SHARED); + if (error) { + if (!*mpsafe) { + KERNEL_UNLOCK_ONE(curlwp); + } + return error; + } + } else { + fstrans_start(*mp, FSTRANS_SHARED); + } + if (__predict_true(*mp == vp->v_mount)) + break; + fstrans_done(*mp); + } + } else { + *mp = vp->v_mount; + } + + return 0; +} + +static inline void +vop_post(vnode_t *vp, struct mount *mp, bool mpsafe, enum fst_op op) +{ + + if (op == FST_YES) { + fstrans_done(mp); + } + + if (!mpsafe) { + KERNEL_UNLOCK_ONE(curlwp); + } +} + const struct vnodeop_desc vop_default_desc = { 0, "default", @@ -80,16 +131,15 @@ VOP_BWRITE(struct vnode *vp, int error; bool mpsafe; struct vop_bwrite_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_bwrite); a.a_vp = vp; a.a_bp = bp; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_bwrite), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -114,14 +164,16 @@ VOP_LOOKUP(struct vnode *dvp, int error; bool mpsafe; struct vop_lookup_v2_args a; + struct mount *mp; a.a_desc = VDESC(vop_lookup); a.a_dvp = dvp; a.a_vpp = vpp; a.a_cnp = cnp; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_lookup), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); #ifdef DIAGNOSTIC if (error == 0) KASSERT((*vpp)->v_size != VSIZENOTSET @@ -152,15 +204,17 @@ VOP_CREATE(struct vnode *dvp, int error; bool mpsafe; struct vop_create_v3_args a; + struct mount *mp; a.a_desc = VDESC(vop_create); a.a_dvp = dvp; a.a_vpp = vpp; a.a_cnp = cnp; a.a_vap = vap; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_create), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); #ifdef DIAGNOSTIC if (error == 0) KASSERT((*vpp)->v_size != VSIZENOTSET @@ -191,15 +245,17 @@ VOP_MKNOD(struct vnode *dvp, int error; bool mpsafe; struct vop_mknod_v3_args a; + struct mount *mp; a.a_desc = VDESC(vop_mknod); a.a_dvp = dvp; a.a_vpp = vpp; a.a_cnp = cnp; a.a_vap = vap; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_mknod), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); #ifdef DIAGNOSTIC if (error == 0) KASSERT((*vpp)->v_size != VSIZENOTSET @@ -229,14 +285,16 @@ VOP_OPEN(struct vnode *vp, int error; bool mpsafe; struct vop_open_args a; + struct mount *mp; a.a_desc = VDESC(vop_open); a.a_vp = vp; a.a_mode = mode; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_open), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -261,14 +319,16 @@ VOP_CLOSE(struct vnode *vp, int error; bool mpsafe; struct vop_close_args a; + struct mount *mp; a.a_desc = VDESC(vop_close); a.a_vp = vp; a.a_fflag = fflag; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_close), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -293,14 +353,16 @@ VOP_ACCESS(struct vnode *vp, int error; bool mpsafe; struct vop_access_args a; + struct mount *mp; a.a_desc = VDESC(vop_access); a.a_vp = vp; a.a_mode = mode; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_access), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -325,14 +387,16 @@ VOP_GETATTR(struct vnode *vp, int error; bool mpsafe; struct vop_getattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_getattr); a.a_vp = vp; a.a_vap = vap; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_getattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -357,14 +421,16 @@ VOP_SETATTR(struct vnode *vp, int error; bool mpsafe; struct vop_setattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_setattr); a.a_vp = vp; a.a_vap = vap; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_setattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -390,15 +456,17 @@ VOP_READ(struct vnode *vp, int error; bool mpsafe; struct vop_read_args a; + struct mount *mp; a.a_desc = VDESC(vop_read); a.a_vp = vp; a.a_uio = uio; a.a_ioflag = ioflag; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_read), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -424,15 +492,17 @@ VOP_WRITE(struct vnode *vp, int error; bool mpsafe; struct vop_write_args a; + struct mount *mp; a.a_desc = VDESC(vop_write); a.a_vp = vp; a.a_uio = uio; a.a_ioflag = ioflag; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_write), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -457,14 +527,16 @@ VOP_FALLOCATE(struct vnode *vp, int error; bool mpsafe; struct vop_fallocate_args a; + struct mount *mp; a.a_desc = VDESC(vop_fallocate); a.a_vp = vp; a.a_pos = pos; a.a_len = len; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_fallocate), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -489,14 +561,16 @@ VOP_FDISCARD(struct vnode *vp, int error; bool mpsafe; struct vop_fdiscard_args a; + struct mount *mp; a.a_desc = VDESC(vop_fdiscard); a.a_vp = vp; a.a_pos = pos; a.a_len = len; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_fdiscard), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -523,16 +597,18 @@ VOP_IOCTL(struct vnode *vp, int error; bool mpsafe; struct vop_ioctl_args a; + struct mount *mp; a.a_desc = VDESC(vop_ioctl); a.a_vp = vp; a.a_command = command; a.a_data = data; a.a_fflag = fflag; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_ioctl), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -559,16 +635,18 @@ VOP_FCNTL(struct vnode *vp, int error; bool mpsafe; struct vop_fcntl_args a; + struct mount *mp; a.a_desc = VDESC(vop_fcntl); a.a_vp = vp; a.a_command = command; a.a_data = data; a.a_fflag = fflag; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_fcntl), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -592,16 +670,15 @@ VOP_POLL(struct vnode *vp, int error; bool mpsafe; struct vop_poll_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_poll); a.a_vp = vp; a.a_events = events; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_poll), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -625,16 +702,15 @@ VOP_KQFILTER(struct vnode *vp, int error; bool mpsafe; struct vop_kqfilter_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_kqfilter); a.a_vp = vp; a.a_kn = kn; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_kqfilter), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -658,13 +734,15 @@ VOP_REVOKE(struct vnode *vp, int error; bool mpsafe; struct vop_revoke_args a; + struct mount *mp; a.a_desc = VDESC(vop_revoke); a.a_vp = vp; a.a_flags = flags; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_revoke), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -689,17 +767,16 @@ VOP_MMAP(struct vnode *vp, int error; bool mpsafe; struct vop_mmap_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_mmap); a.a_vp = vp; a.a_prot = prot; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_mmap), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -726,16 +803,18 @@ VOP_FSYNC(struct vnode *vp, int error; bool mpsafe; struct vop_fsync_args a; + struct mount *mp; a.a_desc = VDESC(vop_fsync); a.a_vp = vp; a.a_cred = cred; a.a_flags = flags; a.a_offlo = offlo; a.a_offhi = offhi; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_fsync), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -761,18 +840,17 @@ VOP_SEEK(struct vnode *vp, int error; bool mpsafe; struct vop_seek_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_seek); a.a_vp = vp; a.a_oldoff = oldoff; a.a_newoff = newoff; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_seek), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -798,14 +876,16 @@ VOP_REMOVE(struct vnode *dvp, int error; bool mpsafe; struct vop_remove_v2_args a; + struct mount *mp; a.a_desc = VDESC(vop_remove); a.a_dvp = dvp; a.a_vp = vp; a.a_cnp = cnp; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_remove), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); return error; } @@ -831,14 +911,16 @@ VOP_LINK(struct vnode *dvp, int error; bool mpsafe; struct vop_link_v2_args a; + struct mount *mp; a.a_desc = VDESC(vop_link); a.a_dvp = dvp; a.a_vp = vp; a.a_cnp = cnp; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_link), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); return error; } @@ -869,7 +951,7 @@ VOP_RENAME(struct vnode *fdvp, int error; bool mpsafe; struct vop_rename_args a; - struct mount *mp = fdvp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_rename); a.a_fdvp = fdvp; a.a_fvp = fvp; @@ -877,12 +959,11 @@ VOP_RENAME(struct vnode *fdvp, a.a_tdvp = tdvp; a.a_tvp = tvp; a.a_tcnp = tcnp; - mpsafe = (fdvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(fdvp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(fdvp, VOFFSET(vop_rename), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(fdvp, mp, mpsafe, FST_YES); return error; } @@ -908,15 +989,17 @@ VOP_MKDIR(struct vnode *dvp, int error; bool mpsafe; struct vop_mkdir_v3_args a; + struct mount *mp; a.a_desc = VDESC(vop_mkdir); a.a_dvp = dvp; a.a_vpp = vpp; a.a_cnp = cnp; a.a_vap = vap; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_mkdir), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); #ifdef DIAGNOSTIC if (error == 0) KASSERT((*vpp)->v_size != VSIZENOTSET @@ -947,14 +1030,16 @@ VOP_RMDIR(struct vnode *dvp, int error; bool mpsafe; struct vop_rmdir_v2_args a; + struct mount *mp; a.a_desc = VDESC(vop_rmdir); a.a_dvp = dvp; a.a_vp = vp; a.a_cnp = cnp; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_rmdir), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); return error; } @@ -981,16 +1066,18 @@ VOP_SYMLINK(struct vnode *dvp, int error; bool mpsafe; struct vop_symlink_v3_args a; + struct mount *mp; a.a_desc = VDESC(vop_symlink); a.a_dvp = dvp; a.a_vpp = vpp; a.a_cnp = cnp; a.a_vap = vap; a.a_target = target; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_symlink), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); #ifdef DIAGNOSTIC if (error == 0) KASSERT((*vpp)->v_size != VSIZENOTSET @@ -1023,6 +1110,7 @@ VOP_READDIR(struct vnode *vp, int error; bool mpsafe; struct vop_readdir_args a; + struct mount *mp; a.a_desc = VDESC(vop_readdir); a.a_vp = vp; a.a_uio = uio; @@ -1030,10 +1118,11 @@ VOP_READDIR(struct vnode *vp, a.a_eofflag = eofflag; a.a_cookies = cookies; a.a_ncookies = ncookies; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_readdir), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1058,14 +1147,16 @@ VOP_READLINK(struct vnode *vp, int error; bool mpsafe; struct vop_readlink_args a; + struct mount *mp; a.a_desc = VDESC(vop_readlink); a.a_vp = vp; a.a_uio = uio; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_readlink), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1089,16 +1180,15 @@ VOP_ABORTOP(struct vnode *dvp, int error; bool mpsafe; struct vop_abortop_args a; - struct mount *mp = dvp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_abortop); a.a_dvp = dvp; a.a_cnp = cnp; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(dvp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_abortop), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_YES); return error; } @@ -1122,13 +1212,15 @@ VOP_INACTIVE(struct vnode *vp, int error; bool mpsafe; struct vop_inactive_v2_args a; + struct mount *mp; a.a_desc = VDESC(vop_inactive); a.a_vp = vp; a.a_recycle = recycle; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_inactive), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1151,12 +1243,14 @@ VOP_RECLAIM(struct vnode *vp) int error; bool mpsafe; struct vop_reclaim_v2_args a; + struct mount *mp; a.a_desc = VDESC(vop_reclaim); a.a_vp = vp; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_reclaim), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1180,13 +1274,15 @@ VOP_LOCK(struct vnode *vp, int error; bool mpsafe; struct vop_lock_args a; + struct mount *mp; a.a_desc = VDESC(vop_lock); a.a_vp = vp; a.a_flags = flags; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, (flags & LK_NOWAIT ? FST_TRY : FST_YES)); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_lock), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, (error ? FST_YES : FST_NO)); return error; } @@ -1209,12 +1305,14 @@ VOP_UNLOCK(struct vnode *vp) int error; bool mpsafe; struct vop_unlock_args a; + struct mount *mp; a.a_desc = VDESC(vop_unlock); a.a_vp = vp; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_unlock), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -1241,19 +1339,18 @@ VOP_BMAP(struct vnode *vp, int error; bool mpsafe; struct vop_bmap_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_bmap); a.a_vp = vp; a.a_bn = bn; a.a_vpp = vpp; a.a_bnp = bnp; a.a_runp = runp; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_bmap), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -1277,16 +1374,15 @@ VOP_STRATEGY(struct vnode *vp, int error; bool mpsafe; struct vop_strategy_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_strategy); a.a_vp = vp; a.a_bp = bp; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_strategy), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -1309,15 +1405,14 @@ VOP_PRINT(struct vnode *vp) int error; bool mpsafe; struct vop_print_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_print); a.a_vp = vp; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_print), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -1340,12 +1435,14 @@ VOP_ISLOCKED(struct vnode *vp) int error; bool mpsafe; struct vop_islocked_args a; + struct mount *mp; a.a_desc = VDESC(vop_islocked); a.a_vp = vp; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_islocked), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1370,14 +1467,16 @@ VOP_PATHCONF(struct vnode *vp, int error; bool mpsafe; struct vop_pathconf_args a; + struct mount *mp; a.a_desc = VDESC(vop_pathconf); a.a_vp = vp; a.a_name = name; a.a_retval = retval; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_pathconf), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1404,19 +1503,18 @@ VOP_ADVLOCK(struct vnode *vp, int error; bool mpsafe; struct vop_advlock_args a; - struct mount *mp = vp->v_mount; + struct mount *mp; a.a_desc = VDESC(vop_advlock); a.a_vp = vp; a.a_id = id; a.a_op = op; a.a_fl = fl; a.a_flags = flags; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } - fstrans_start(mp, FSTRANS_SHARED); + error = vop_pre(vp, &mp, &mpsafe, FST_YES); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_advlock), &a)); - fstrans_done(mp); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_YES); return error; } @@ -1441,14 +1539,16 @@ VOP_WHITEOUT(struct vnode *dvp, int error; bool mpsafe; struct vop_whiteout_args a; + struct mount *mp; a.a_desc = VDESC(vop_whiteout); a.a_dvp = dvp; a.a_cnp = cnp; a.a_flags = flags; - mpsafe = (dvp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(dvp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(dvp, VOFFSET(vop_whiteout), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(dvp, mp, mpsafe, FST_NO); return error; } @@ -1478,6 +1578,7 @@ VOP_GETPAGES(struct vnode *vp, int error; bool mpsafe; struct vop_getpages_args a; + struct mount *mp; a.a_desc = VDESC(vop_getpages); a.a_vp = vp; a.a_offset = offset; @@ -1487,10 +1588,11 @@ VOP_GETPAGES(struct vnode *vp, a.a_access_type = access_type; a.a_advice = advice; a.a_flags = flags; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_getpages), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1516,15 +1618,17 @@ VOP_PUTPAGES(struct vnode *vp, int error; bool mpsafe; struct vop_putpages_args a; + struct mount *mp; a.a_desc = VDESC(vop_putpages); a.a_vp = vp; a.a_offlo = offlo; a.a_offhi = offhi; a.a_flags = flags; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_putpages), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1549,14 +1653,16 @@ VOP_CLOSEEXTATTR(struct vnode *vp, int error; bool mpsafe; struct vop_closeextattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_closeextattr); a.a_vp = vp; a.a_commit = commit; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_closeextattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1584,6 +1690,7 @@ VOP_GETEXTATTR(struct vnode *vp, int error; bool mpsafe; struct vop_getextattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_getextattr); a.a_vp = vp; a.a_attrnamespace = attrnamespace; @@ -1591,10 +1698,11 @@ VOP_GETEXTATTR(struct vnode *vp, a.a_uio = uio; a.a_size = size; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_getextattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1622,6 +1730,7 @@ VOP_LISTEXTATTR(struct vnode *vp, int error; bool mpsafe; struct vop_listextattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_listextattr); a.a_vp = vp; a.a_attrnamespace = attrnamespace; @@ -1629,10 +1738,11 @@ VOP_LISTEXTATTR(struct vnode *vp, a.a_size = size; a.a_flag = flag; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_listextattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1656,13 +1766,15 @@ VOP_OPENEXTATTR(struct vnode *vp, int error; bool mpsafe; struct vop_openextattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_openextattr); a.a_vp = vp; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_openextattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1688,15 +1800,17 @@ VOP_DELETEEXTATTR(struct vnode *vp, int error; bool mpsafe; struct vop_deleteextattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_deleteextattr); a.a_vp = vp; a.a_attrnamespace = attrnamespace; a.a_name = name; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_deleteextattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } @@ -1723,16 +1837,18 @@ VOP_SETEXTATTR(struct vnode *vp, int error; bool mpsafe; struct vop_setextattr_args a; + struct mount *mp; a.a_desc = VDESC(vop_setextattr); a.a_vp = vp; a.a_attrnamespace = attrnamespace; a.a_name = name; a.a_uio = uio; a.a_cred = cred; - mpsafe = (vp->v_vflag & VV_MPSAFE); - if (!mpsafe) { KERNEL_LOCK(1, curlwp); } + error = vop_pre(vp, &mp, &mpsafe, FST_NO); + if (error) + return error; error = (VCALL(vp, VOFFSET(vop_setextattr), &a)); - if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } + vop_post(vp, mp, mpsafe, FST_NO); return error; } Index: src/sys/rump/include/rump/rumpvnode_if.h diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.28 src/sys/rump/include/rump/rumpvnode_if.h:1.29 --- src/sys/rump/include/rump/rumpvnode_if.h:1.28 Fri May 26 14:21:54 2017 +++ src/sys/rump/include/rump/rumpvnode_if.h Sun Jun 4 08:00:27 2017 @@ -1,13 +1,13 @@ -/* $NetBSD: rumpvnode_if.h,v 1.28 2017/05/26 14:21:54 riastradh Exp $ */ +/* $NetBSD: rumpvnode_if.h,v 1.29 2017/06/04 08:00:27 hannken Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.75 2017/05/26 14:21:00 riastradh Exp + * NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.64 2017/04/16 17:18:28 riastradh Exp + * NetBSD: vnode_if.sh,v 1.65 2017/06/04 07:59:17 hannken Exp */ /* Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.28 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.29 --- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.28 Fri May 26 14:21:54 2017 +++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c Sun Jun 4 08:00:27 2017 @@ -1,13 +1,13 @@ -/* $NetBSD: rumpvnode_if.c,v 1.28 2017/05/26 14:21:54 riastradh Exp $ */ +/* $NetBSD: rumpvnode_if.c,v 1.29 2017/06/04 08:00:27 hannken Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.75 2017/05/26 14:21:00 riastradh Exp + * NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.64 2017/04/16 17:18:28 riastradh Exp + * NetBSD: vnode_if.sh,v 1.65 2017/06/04 07:59:17 hannken Exp */ /* @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.28 2017/05/26 14:21:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.29 2017/06/04 08:00:27 hannken Exp $"); #include <sys/param.h> #include <sys/mount.h> Index: src/sys/sys/vnode_if.h diff -u src/sys/sys/vnode_if.h:1.99 src/sys/sys/vnode_if.h:1.100 --- src/sys/sys/vnode_if.h:1.99 Fri May 26 14:21:55 2017 +++ src/sys/sys/vnode_if.h Sun Jun 4 08:00:27 2017 @@ -1,13 +1,13 @@ -/* $NetBSD: vnode_if.h,v 1.99 2017/05/26 14:21:55 riastradh Exp $ */ +/* $NetBSD: vnode_if.h,v 1.100 2017/06/04 08:00:27 hannken Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.75 2017/05/26 14:21:00 riastradh Exp + * NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.64 2017/04/16 17:18:28 riastradh Exp + * NetBSD: vnode_if.sh,v 1.65 2017/06/04 07:59:17 hannken Exp */ /*