From owner-svn-src-all@FreeBSD.ORG Mon May 11 15:33:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 201981065670; Mon, 11 May 2009 15:33:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 099C98FC08; Mon, 11 May 2009 15:33:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BFXRIi095116; Mon, 11 May 2009 15:33:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BFXQ7q095098; Mon, 11 May 2009 15:33:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200905111533.n4BFXQ7q095098@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 May 2009 15:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191990 - in head/sys: cddl/compat/opensolaris/kern cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/coda fs/devfs fs/fdescfs fs/hpfs fs/msdosfs fs/nfs fs/nfsclient fs/nfsserver ... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 15:33:27 -0000 Author: attilio Date: Mon May 11 15:33:26 2009 New Revision: 191990 URL: http://svn.freebsd.org/changeset/base/191990 Log: Remove the thread argument from the FSD (File-System Dependent) parts of the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation. Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/coda/coda_vfsops.c head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_vfsops.c head/sys/fs/devfs/devfs_vnops.c head/sys/fs/fdescfs/fdesc.h head/sys/fs/fdescfs/fdesc_vfsops.c head/sys/fs/fdescfs/fdesc_vnops.c head/sys/fs/hpfs/hpfs_vfsops.c head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/ntfs/ntfs_vfsops.c head/sys/fs/nullfs/null_vfsops.c head/sys/fs/nwfs/nwfs_vfsops.c head/sys/fs/portalfs/portal_vfsops.c head/sys/fs/pseudofs/pseudofs.c head/sys/fs/pseudofs/pseudofs.h head/sys/fs/smbfs/smbfs_vfsops.c head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/fs/udf/udf_vfsops.c head/sys/fs/unionfs/union_vfsops.c head/sys/geom/journal/g_journal.c head/sys/gnu/fs/ext2fs/ext2_vfsops.c head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c head/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c head/sys/kern/kern_acct.c head/sys/kern/uipc_mqueue.c head/sys/kern/vfs_default.c head/sys/kern/vfs_export.c head/sys/kern/vfs_extattr.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/nfs4client/nfs4_vfsops.c head/sys/nfsclient/nfs.h head/sys/nfsclient/nfs_vfsops.c head/sys/nfsserver/nfs_serv.c head/sys/security/audit/audit_worker.c head/sys/sys/mount.h head/sys/sys/param.h head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ufs/extattr.h head/sys/ufs/ufs/ufs_extattr.c head/sys/ufs/ufs/ufs_vfsops.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Mon May 11 15:33:26 2009 (r191990) @@ -66,7 +66,6 @@ lookupnameat(char *dirname, enum uio_seg int traverse(vnode_t **cvpp, int lktype) { - kthread_t *td = curthread; vnode_t *cvp; vnode_t *tvp; vfs_t *vfsp; @@ -101,7 +100,7 @@ traverse(vnode_t **cvpp, int lktype) * The read lock must be held across the call to VFS_ROOT() to * prevent a concurrent unmount from destroying the vfs. */ - error = VFS_ROOT(vfsp, lktype, &tvp, td); + error = VFS_ROOT(vfsp, lktype, &tvp); if (error != 0) return (error); cvp = tvp; Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon May 11 15:33:26 2009 (r191990) @@ -160,14 +160,14 @@ domount(kthread_t *td, vnode_t *vp, cons */ cr = td->td_ucred; td->td_ucred = kcred; - error = VFS_MOUNT(mp, td); + error = VFS_MOUNT(mp); td->td_ucred = cr; if (!error) { if (mp->mnt_opt != NULL) vfs_freeopts(mp->mnt_opt); mp->mnt_opt = mp->mnt_optnew; - (void)VFS_STATFS(mp, &mp->mnt_stat, td); + (void)VFS_STATFS(mp, &mp->mnt_stat); } /* * Prevent external consumers of mount options from reading @@ -192,7 +192,7 @@ domount(kthread_t *td, vnode_t *vp, cons TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); vfs_event_signal(NULL, VQ_MOUNT, 0); - if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp, td)) + if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) panic("mount: lost mount"); mountcheckdirs(vp, mvp); vput(mvp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon May 11 15:33:26 2009 (r191990) @@ -180,7 +180,7 @@ zfsctl_create(zfsvfs_t *zfsvfs) zcp = vp->v_data; zcp->zc_id = ZFSCTL_INO_ROOT; - VERIFY(VFS_ROOT(zfsvfs->z_vfs, LK_EXCLUSIVE, &rvp, curthread) == 0); + VERIFY(VFS_ROOT(zfsvfs->z_vfs, LK_EXCLUSIVE, &rvp) == 0); ZFS_TIME_DECODE(&zcp->zc_cmtime, VTOZ(rvp)->z_phys->zp_crtime); VN_URELE(rvp); @@ -415,7 +415,7 @@ zfsctl_root_lookup(vnode_t *dvp, char *n ZFS_ENTER(zfsvfs); if (strcmp(nm, "..") == 0) { - err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp, curthread); + err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp); if (err == 0) VOP_UNLOCK(*vpp, 0); } else { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -91,12 +91,12 @@ static int zfs_version_zpl = ZPL_VERSION SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, "ZPL_VERSION"); -static int zfs_mount(vfs_t *vfsp, kthread_t *td); -static int zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td); -static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp, kthread_t *td); -static int zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td); +static int zfs_mount(vfs_t *vfsp); +static int zfs_umount(vfs_t *vfsp, int fflag); +static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); +static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); -static int zfs_sync(vfs_t *vfsp, int waitfor, kthread_t *td); +static int zfs_sync(vfs_t *vfsp, int waitfor); static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp); static void zfs_objset_close(zfsvfs_t *zfsvfs); static void zfs_freevfs(vfs_t *vfsp); @@ -122,7 +122,7 @@ static uint32_t zfs_active_fs_count = 0; /*ARGSUSED*/ static int -zfs_sync(vfs_t *vfsp, int waitfor, kthread_t *td) +zfs_sync(vfs_t *vfsp, int waitfor) { /* @@ -139,7 +139,7 @@ zfs_sync(vfs_t *vfsp, int waitfor, kthre zfsvfs_t *zfsvfs = vfsp->vfs_data; int error; - error = vfs_stdsync(vfsp, waitfor, td); + error = vfs_stdsync(vfsp, waitfor); if (error != 0) return (error); @@ -688,8 +688,9 @@ zfs_unregister_callbacks(zfsvfs_t *zfsvf /*ARGSUSED*/ static int -zfs_mount(vfs_t *vfsp, kthread_t *td) +zfs_mount(vfs_t *vfsp) { + kthread_t *td = curthread; vnode_t *mvp = vfsp->mnt_vnodecovered; cred_t *cr = td->td_ucred; char *osname; @@ -782,7 +783,7 @@ out: } static int -zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td) +zfs_statfs(vfs_t *vfsp, struct statfs *statp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; uint64_t refdbytes, availbytes, usedobjs, availobjs; @@ -840,7 +841,7 @@ zfs_statfs(vfs_t *vfsp, struct statfs *s } static int -zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp, kthread_t *td) +zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; znode_t *rootzp; @@ -957,11 +958,11 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea /*ARGSUSED*/ static int -zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td) +zfs_umount(vfs_t *vfsp, int fflag) { zfsvfs_t *zfsvfs = vfsp->vfs_data; objset_t *os; - cred_t *cr = td->td_ucred; + cred_t *cr = curthread->td_ucred; int ret; if (fflag & MS_FORCE) { @@ -992,7 +993,7 @@ zfs_umount(vfs_t *vfsp, int fflag, kthre if (zfsvfs->z_ctldir != NULL) { if ((ret = zfsctl_umount_snapshots(vfsp, fflag, cr)) != 0) return (ret); - ret = vflush(vfsp, 0, 0, td); + ret = vflush(vfsp, 0, 0, curthread); ASSERT(ret == EBUSY); if (!(fflag & MS_FORCE)) { if (zfsvfs->z_ctldir->v_count > 1) @@ -1006,7 +1007,7 @@ zfs_umount(vfs_t *vfsp, int fflag, kthre /* * Flush all the files. */ - ret = vflush(vfsp, 1, (fflag & MS_FORCE) ? FORCECLOSE : 0, td); + ret = vflush(vfsp, 1, (fflag & MS_FORCE) ? FORCECLOSE : 0, curthread); if (ret != 0) { if (!zfsvfs->z_issnap) { zfsctl_create(zfsvfs); Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/cd9660/cd9660_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -95,7 +95,7 @@ static int iso_mountfs(struct vnode *dev */ static int -cd9660_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +cd9660_cmount(struct mntarg *ma, void *data, int flags) { struct iso_args args; int error; @@ -123,15 +123,18 @@ cd9660_cmount(struct mntarg *ma, void *d } static int -cd9660_mount(struct mount *mp, struct thread *td) +cd9660_mount(struct mount *mp) { struct vnode *devvp; + struct thread *td; char *fspec; int error; accmode_t accmode; struct nameidata ndp; struct iso_mnt *imp = 0; + td = curthread; + /* * Unconditionally mount as read-only. */ @@ -490,17 +493,16 @@ out: * unmount system call */ static int -cd9660_unmount(mp, mntflags, td) +cd9660_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct iso_mnt *isomp; int error, flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - if ((error = vflush(mp, 0, flags, td))) + if ((error = vflush(mp, 0, flags, curthread))) return (error); isomp = VFSTOISOFS(mp); @@ -530,11 +532,10 @@ cd9660_unmount(mp, mntflags, td) * Return root of a filesystem */ static int -cd9660_root(mp, flags, vpp, td) +cd9660_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct iso_mnt *imp = VFSTOISOFS(mp); struct iso_directory_record *dp = @@ -553,10 +554,9 @@ cd9660_root(mp, flags, vpp, td) * Get filesystem statistics. */ static int -cd9660_statfs(mp, sbp, td) +cd9660_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { struct iso_mnt *isomp; Modified: head/sys/fs/coda/coda_vfsops.c ============================================================================== --- head/sys/fs/coda/coda_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/coda/coda_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -106,7 +106,7 @@ static const char *coda_opts[] = { "from */ /*ARGSUSED*/ int -coda_mount(struct mount *vfsp, struct thread *td) +coda_mount(struct mount *vfsp) { struct vnode *dvp; struct cnode *cp; @@ -136,7 +136,7 @@ coda_mount(struct mount *vfsp, struct th /* * Validate mount device. Similar to getmdev(). */ - NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, from, td); + NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, from, curthread); error = namei(&ndp); dvp = ndp.ni_vp; if (error) { @@ -206,7 +206,7 @@ coda_mount(struct mount *vfsp, struct th } int -coda_unmount(struct mount *vfsp, int mntflags, struct thread *td) +coda_unmount(struct mount *vfsp, int mntflags) { struct coda_mntinfo *mi = vftomi(vfsp); int active, error = 0; @@ -232,7 +232,7 @@ coda_unmount(struct mount *vfsp, int mnt vrele(coda_ctlvp); coda_ctlvp = NULL; active = coda_kill(vfsp, NOT_DOWNCALL); - error = vflush(mi->mi_vfsp, 0, FORCECLOSE, td); + error = vflush(mi->mi_vfsp, 0, FORCECLOSE, curthread); #ifdef CODA_VERBOSE printf("coda_unmount: active = %d, vflush active %d\n", active, error); @@ -262,15 +262,17 @@ coda_unmount(struct mount *vfsp, int mnt * Find root of cfs. */ int -coda_root(struct mount *vfsp, int flags, struct vnode **vpp, - struct thread *td) +coda_root(struct mount *vfsp, int flags, struct vnode **vpp) { struct coda_mntinfo *mi = vftomi(vfsp); int error; - struct proc *p = td->td_proc; + struct proc *p; + struct thread *td; CodaFid VFid; static const CodaFid invalfid = INVAL_FID; + td = curthread; + p = td->td_proc; ENTRY; MARK_ENTRY(CODA_ROOT_STATS); if (vfsp == mi->mi_vfsp) { @@ -345,7 +347,7 @@ coda_root(struct mount *vfsp, int flags, * Get filesystem statistics. */ int -coda_statfs(struct mount *vfsp, struct statfs *sbp, struct thread *td) +coda_statfs(struct mount *vfsp, struct statfs *sbp) { ENTRY; @@ -377,7 +379,7 @@ coda_statfs(struct mount *vfsp, struct s * Flush any pending I/O. */ int -coda_sync(struct mount *vfsp, int waitfor, struct thread *td) +coda_sync(struct mount *vfsp, int waitfor) { ENTRY; Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/devfs/devfs.h Mon May 11 15:33:26 2009 (r191990) @@ -172,7 +172,8 @@ extern unsigned devfs_rule_depth; void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de); void devfs_rules_cleanup (struct devfs_mount *dm); int devfs_rules_ioctl(struct devfs_mount *dm, u_long cmd, caddr_t data, struct thread *td); -int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); +int devfs_allocv (struct devfs_dirent *de, struct mount *mp, + struct vnode **vpp); void devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int vp_locked); void devfs_dirent_free(struct devfs_dirent *de); void devfs_populate (struct devfs_mount *dm); Modified: head/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- head/sys/fs/devfs/devfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/devfs/devfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -60,7 +60,7 @@ static vfs_statfs_t devfs_statfs; * Mount the filesystem */ static int -devfs_mount(struct mount *mp, struct thread *td) +devfs_mount(struct mount *mp) { int error; struct devfs_mount *fmp; @@ -92,7 +92,7 @@ devfs_mount(struct mount *mp, struct thr fmp->dm_rootdir = devfs_vmkdir(fmp, NULL, 0, NULL, DEVFS_ROOTINO); - error = devfs_root(mp, LK_EXCLUSIVE, &rvp, td); + error = devfs_root(mp, LK_EXCLUSIVE, &rvp); if (error) { sx_destroy(&fmp->dm_lock); free_unr(devfs_unr, fmp->dm_idx); @@ -115,7 +115,7 @@ devfs_unmount_final(struct devfs_mount * } static int -devfs_unmount(struct mount *mp, int mntflags, struct thread *td) +devfs_unmount(struct mount *mp, int mntflags) { int error; int flags = 0; @@ -127,7 +127,7 @@ devfs_unmount(struct mount *mp, int mntf KASSERT(fmp->dm_mount != NULL, ("devfs_unmount unmounted devfs_mount")); /* There is 1 extra root vnode reference from devfs_mount(). */ - error = vflush(mp, 1, flags, td); + error = vflush(mp, 1, flags, curthread); if (error) return (error); sx_xlock(&fmp->dm_lock); @@ -147,7 +147,7 @@ devfs_unmount(struct mount *mp, int mntf /* Return locked reference to root. */ static int -devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +devfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; struct vnode *vp; @@ -155,7 +155,7 @@ devfs_root(struct mount *mp, int flags, dmp = VFSTODEVFS(mp); sx_xlock(&dmp->dm_lock); - error = devfs_allocv(dmp->dm_rootdir, mp, &vp, td); + error = devfs_allocv(dmp->dm_rootdir, mp, &vp); if (error) return (error); vp->v_vflag |= VV_ROOT; @@ -164,7 +164,7 @@ devfs_root(struct mount *mp, int flags, } static int -devfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +devfs_statfs(struct mount *mp, struct statfs *sbp) { sbp->f_flags = 0; Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/devfs/devfs_vnops.c Mon May 11 15:33:26 2009 (r191990) @@ -330,14 +330,13 @@ devfs_insmntque_dtr(struct vnode *vp, vo * it on return. */ int -devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td) +devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp) { int error; struct vnode *vp; struct cdev *dev; struct devfs_mount *dmp; - KASSERT(td == curthread, ("devfs_allocv: td != curthread")); dmp = VFSTODEVFS(mp); if (de->de_flags & DE_DOOMED) { sx_xunlock(&dmp->dm_lock); @@ -351,7 +350,7 @@ devfs_allocv(struct devfs_dirent *de, st VI_LOCK(vp); mtx_unlock(&devfs_de_interlock); sx_xunlock(&dmp->dm_lock); - error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td); + error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread); sx_xlock(&dmp->dm_lock); if (devfs_allocv_drop_refs(0, dmp, de)) { if (error == 0) @@ -761,7 +760,7 @@ devfs_lookupx(struct vop_lookup_args *ap de = TAILQ_FIRST(&dd->de_dlist); /* "." */ de = TAILQ_NEXT(de, de_list); /* ".." */ de = de->de_dir; - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); *dm_unlock = 0; vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); return (error); @@ -844,7 +843,7 @@ devfs_lookupx(struct vop_lookup_args *ap return (0); } } - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); *dm_unlock = 0; return (error); } @@ -870,7 +869,6 @@ devfs_mknod(struct vop_mknod_args *ap) { struct componentname *cnp; struct vnode *dvp, **vpp; - struct thread *td; struct devfs_dirent *dd, *de; struct devfs_mount *dmp; int error; @@ -886,7 +884,6 @@ devfs_mknod(struct vop_mknod_args *ap) cnp = ap->a_cnp; vpp = ap->a_vpp; - td = cnp->cn_thread; dd = dvp->v_data; error = ENOENT; @@ -904,7 +901,7 @@ devfs_mknod(struct vop_mknod_args *ap) if (de == NULL) goto notfound; de->de_flags &= ~DE_WHITEOUT; - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); return (error); notfound: sx_xunlock(&dmp->dm_lock); @@ -1427,12 +1424,8 @@ devfs_symlink(struct vop_symlink_args *a struct devfs_dirent *dd; struct devfs_dirent *de; struct devfs_mount *dmp; - struct thread *td; - - td = ap->a_cnp->cn_thread; - KASSERT(td == curthread, ("devfs_symlink: td != curthread")); - error = priv_check(td, PRIV_DEVFS_SYMLINK); + error = priv_check(curthread, PRIV_DEVFS_SYMLINK); if (error) return(error); dmp = VFSTODEVFS(ap->a_dvp->v_mount); @@ -1451,7 +1444,7 @@ devfs_symlink(struct vop_symlink_args *a mac_devfs_create_symlink(ap->a_cnp->cn_cred, dmp->dm_mount, dd, de); #endif TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); - return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp, td)); + return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp)); } static int Modified: head/sys/fs/fdescfs/fdesc.h ============================================================================== --- head/sys/fs/fdescfs/fdesc.h Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/fdescfs/fdesc.h Mon May 11 15:33:26 2009 (r191990) @@ -65,5 +65,5 @@ extern struct mtx fdesc_hashmtx; extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, - struct vnode **, struct thread *); + struct vnode **); #endif /* _KERNEL */ Modified: head/sys/fs/fdescfs/fdesc_vfsops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/fdescfs/fdesc_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -64,7 +64,7 @@ static vfs_root_t fdesc_root; * Compatibility shim for old mount(2) system call. */ int -fdesc_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +fdesc_cmount(struct mntarg *ma, void *data, int flags) { return kernel_mount(ma, flags); } @@ -73,7 +73,7 @@ fdesc_cmount(struct mntarg *ma, void *da * Mount the per-process file descriptors (/dev/fd) */ static int -fdesc_mount(struct mount *mp, struct thread *td) +fdesc_mount(struct mount *mp) { int error = 0; struct fdescmount *fmp; @@ -94,7 +94,7 @@ fdesc_mount(struct mount *mp, struct thr */ mp->mnt_data = (qaddr_t) fmp; fmp->flags = 0; - error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp, td); + error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp); if (error) { free(fmp, M_FDESCMNT); mp->mnt_data = 0; @@ -116,10 +116,9 @@ fdesc_mount(struct mount *mp, struct thr } static int -fdesc_unmount(mp, mntflags, td) +fdesc_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct fdescmount *fmp; caddr_t data; @@ -143,7 +142,7 @@ fdesc_unmount(mp, mntflags, td) * There is 1 extra root vnode reference corresponding * to f_root. */ - if ((error = vflush(mp, 1, flags, td)) != 0) + if ((error = vflush(mp, 1, flags, curthread)) != 0) return (error); /* @@ -160,11 +159,10 @@ fdesc_unmount(mp, mntflags, td) } static int -fdesc_root(mp, flags, vpp, td) +fdesc_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct vnode *vp; @@ -172,23 +170,25 @@ fdesc_root(mp, flags, vpp, td) * Return locked reference to root. */ vp = VFSTOFDESC(mp)->f_root; - vget(vp, LK_EXCLUSIVE | LK_RETRY, td); + vget(vp, LK_EXCLUSIVE | LK_RETRY, curthread); *vpp = vp; return (0); } static int -fdesc_statfs(mp, sbp, td) +fdesc_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { + struct thread *td; struct filedesc *fdp; int lim; int i; int last; int freefd; + td = curthread; + /* * Compute number of free file descriptors. * [ Strange results will ensue if the open file Modified: head/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vnops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/fdescfs/fdesc_vnops.c Mon May 11 15:33:26 2009 (r191990) @@ -145,20 +145,21 @@ fdesc_remove_entry(struct fdescnode *fd) } int -fdesc_allocvp(ftype, fd_fd, ix, mp, vpp, td) +fdesc_allocvp(ftype, fd_fd, ix, mp, vpp) fdntype ftype; unsigned fd_fd; int ix; struct mount *mp; struct vnode **vpp; - struct thread *td; { struct fdescmount *fmp; struct fdhashhead *fc; struct fdescnode *fd, *fd2; struct vnode *vp, *vp2; + struct thread *td; int error = 0; + td = curthread; fc = FD_NHASH(ix); loop: mtx_lock(&fdesc_hashmtx); @@ -328,7 +329,7 @@ fdesc_lookup(ap) vhold(dvp); VOP_UNLOCK(dvp, 0); error = fdesc_allocvp(Fdesc, fd, FD_DESC + fd, dvp->v_mount, - &fvp, td); + &fvp); fdrop(fp, td); /* * The root vnode must be locked last to prevent deadlock condition. Modified: head/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- head/sys/fs/hpfs/hpfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/hpfs/hpfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -73,8 +73,7 @@ static int hpfs_cmount ( struct mntarg *ma, void *data, - int flags, - struct thread *td ) + int flags) { struct hpfs_args args; int error; @@ -103,16 +102,16 @@ static const char *hpfs_opts[] = { }; static int -hpfs_mount ( - struct mount *mp, - struct thread *td ) +hpfs_mount (struct mount *mp) { int err = 0, error; struct vnode *devvp; + struct thread *td; struct nameidata ndp; struct export_args export; char *from; + td = curthread; dprintf(("hpfs_omount():\n")); /* *** @@ -299,7 +298,7 @@ hpfs_mountfs(devvp, mp, td) goto failed; } - error = hpfs_root(mp, LK_EXCLUSIVE, &vp, td); + error = hpfs_root(mp, LK_EXCLUSIVE, &vp); if (error) { hpfs_cpdeinit(hpmp); hpfs_bmdeinit(hpmp); @@ -331,8 +330,7 @@ failed: static int hpfs_unmount( struct mount *mp, - int mntflags, - struct thread *td) + int mntflags) { int error, flags; register struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -345,7 +343,7 @@ hpfs_unmount( dprintf(("hpfs_unmount: vflushing...\n")); - error = vflush(mp, 0, flags, td); + error = vflush(mp, 0, flags, curthread); if (error) { printf("hpfs_unmount: vflush failed: %d\n",error); return (error); @@ -375,8 +373,7 @@ static int hpfs_root( struct mount *mp, int flags, - struct vnode **vpp, - struct thread *td ) + struct vnode **vpp) { int error = 0; struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -394,8 +391,7 @@ hpfs_root( static int hpfs_statfs( struct mount *mp, - struct statfs *sbp, - struct thread *td) + struct statfs *sbp) { struct hpfsmount *hpmp = VFSTOHPFS(mp); Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/msdosfs/msdosfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -184,7 +184,7 @@ update_mp(struct mount *mp, struct threa pmp->pm_flags |= MSDOSFSMNT_LONGNAME; else { if ((error = - msdosfs_root(mp, LK_EXCLUSIVE, &rootvp, td)) != 0) + msdosfs_root(mp, LK_EXCLUSIVE, &rootvp)) != 0) return error; pmp->pm_flags |= findwin95(VTODE(rootvp)) ? MSDOSFSMNT_LONGNAME : MSDOSFSMNT_SHORTNAME; @@ -195,7 +195,7 @@ update_mp(struct mount *mp, struct threa } static int -msdosfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +msdosfs_cmount(struct mntarg *ma, void *data, int flags) { struct msdosfs_args args; int error; @@ -233,9 +233,10 @@ msdosfs_cmount(struct mntarg *ma, void * * special file to treat as a filesystem. */ static int -msdosfs_mount(struct mount *mp, struct thread *td) +msdosfs_mount(struct mount *mp) { struct vnode *devvp; /* vnode for blk device to mount */ + struct thread *td; /* msdosfs specific mount control block */ struct msdosfsmount *pmp = NULL; struct nameidata ndp; @@ -243,6 +244,7 @@ msdosfs_mount(struct mount *mp, struct t accmode_t accmode; char *from; + td = curthread; if (vfs_filteropt(mp->mnt_optnew, msdosfs_opts)) return (EINVAL); @@ -265,7 +267,7 @@ msdosfs_mount(struct mount *mp, struct t } if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { - error = VFS_SYNC(mp, MNT_WAIT, td); + error = VFS_SYNC(mp, MNT_WAIT); if (error) return (error); flags = WRITECLOSE; @@ -392,7 +394,7 @@ msdosfs_mount(struct mount *mp, struct t error = update_mp(mp, td); if (error) { if ((mp->mnt_flag & MNT_UPDATE) == 0) - msdosfs_unmount(mp, MNT_FORCE, td); + msdosfs_unmount(mp, MNT_FORCE); return error; } @@ -774,7 +776,7 @@ error_exit: * Unmount the filesystem described by mp. */ static int -msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td) +msdosfs_unmount(struct mount *mp, int mntflags) { struct msdosfsmount *pmp; int error, flags; @@ -782,7 +784,7 @@ msdosfs_unmount(struct mount *mp, int mn flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - error = vflush(mp, 0, flags, td); + error = vflush(mp, 0, flags, curthread); if (error && error != ENXIO) return error; pmp = VFSTOMSDOSFS(mp); @@ -844,7 +846,7 @@ msdosfs_unmount(struct mount *mp, int mn } static int -msdosfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +msdosfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); struct denode *ndep; @@ -861,7 +863,7 @@ msdosfs_root(struct mount *mp, int flags } static int -msdosfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +msdosfs_statfs(struct mount *mp, struct statfs *sbp) { struct msdosfsmount *pmp; @@ -877,13 +879,16 @@ msdosfs_statfs(struct mount *mp, struct } static int -msdosfs_sync(struct mount *mp, int waitfor, struct thread *td) +msdosfs_sync(struct mount *mp, int waitfor) { struct vnode *vp, *nvp; + struct thread *td; struct denode *dep; struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); int error, allerror = 0; + td = curthread; + /* * If we ever switch to not updating all of the fats all the time, * this would be the place to update them from the first one. Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/nfs/nfs_commonsubs.c Mon May 11 15:33:26 2009 (r191990) @@ -1446,7 +1446,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bhardlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1475,7 +1475,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bsoftlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1501,7 +1501,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = dqb.dqb_curblocks; p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1943,7 +1943,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd * Get the VFS_STATFS(), since some attributes need them. */ if (NFSISSETSTATFS_ATTRBIT(retbitp)) { - error = VFS_STATFS(vnode_mount(vp), &fs, p); + error = VFS_STATFS(vnode_mount(vp), &fs); if (error != 0) { if (reterr) { nd->nd_repstat = NFSERR_ACCES; @@ -2138,7 +2138,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes, freenum); p->p_cred->p_ruid = savuid; @@ -2245,7 +2245,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bhardlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -2269,7 +2269,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bsoftlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -2290,7 +2290,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = dqb.dqb_curblocks; p->p_cred->p_ruid = savuid; #endif /* QUOTA */ Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/nfs/nfs_var.h Mon May 11 15:33:26 2009 (r191990) @@ -558,7 +558,7 @@ int nfsvno_rename(struct nameidata *, st int nfsvno_link(struct nameidata *, vnode_t, struct ucred *, NFSPROC_T *, struct nfsexstuff *); int nfsvno_fsync(vnode_t, u_int64_t, int, struct ucred *, NFSPROC_T *); -int nfsvno_statfs(vnode_t, struct statfs *, struct ucred *, NFSPROC_T *); +int nfsvno_statfs(vnode_t, struct statfs *); void nfsvno_getfs(struct nfsfsinfo *, int); void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t, nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, u_char *, Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -244,9 +244,10 @@ nfs_convert_diskless(void) * nfs statfs call */ static int -nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +nfs_statfs(struct mount *mp, struct statfs *sbp) { struct vnode *vp; + struct thread *td; struct nfsmount *nmp = VFSTONFS(mp); struct nfsvattr nfsva; struct nfsfsinfo fs; @@ -254,6 +255,8 @@ nfs_statfs(struct mount *mp, struct stat int error = 0, attrflag, gotfsinfo = 0, ret; struct nfsnode *np; + td = curthread; + error = vfs_busy(mp, MBF_NOWAIT); if (error) return (error); @@ -659,7 +662,7 @@ static const char *nfs_opts[] = { "from" */ /* ARGSUSED */ static int -nfs_mount(struct mount *mp, struct thread *td) +nfs_mount(struct mount *mp) { struct nfs_args args = { .version = NFS_ARGSVERSION, @@ -689,6 +692,7 @@ nfs_mount(struct mount *mp, struct threa int error; struct sockaddr *nam; struct vnode *vp; + struct thread *td; char hst[MNAMELEN]; size_t len; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; @@ -698,6 +702,7 @@ nfs_mount(struct mount *mp, struct threa goto out; } + td = curthread; if ((mp->mnt_flag & (MNT_ROOTFS | MNT_UPDATE)) == MNT_ROOTFS) { error = ncl_mountroot(mp, td); goto out; @@ -835,7 +840,7 @@ out: */ /* ARGSUSED */ static int -nfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +nfs_cmount(struct mntarg *ma, void *data, int flags) { int error; struct nfs_args args; @@ -1069,11 +1074,14 @@ bad: * unmount system call */ static int -nfs_unmount(struct mount *mp, int mntflags, struct thread *td) +nfs_unmount(struct mount *mp, int mntflags) { + struct thread *td; struct nfsmount *nmp; int error, flags = 0, trycnt = 0; + td = curthread; + if (mntflags & MNT_FORCE) flags |= FORCECLOSE; nmp = VFSTONFS(mp); @@ -1120,7 +1128,7 @@ out: * Return root of a filesystem */ static int -nfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +nfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct vnode *vp; struct nfsmount *nmp; @@ -1153,11 +1161,14 @@ nfs_root(struct mount *mp, int flags, st */ /* ARGSUSED */ static int -nfs_sync(struct mount *mp, int waitfor, struct thread *td) +nfs_sync(struct mount *mp, int waitfor) { struct vnode *vp, *mvp; + struct thread *td; int error, allerror = 0; + td = curthread; + /* * Force stale buffer cache information to be flushed. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***