svn commit: r222167 - in head/sys:
cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660
fs/ext2fs fs/hpfs fs/msdosfs fs/nfsserver fs/ntfs fs/nullfs
fs/tmpfs fs/udf fs/unionfs gnu/fs/reiserfs gnu/fs...
Rick Macklem
rmacklem at FreeBSD.org
Sun May 22 01:07:54 UTC 2011
Author: rmacklem
Date: Sun May 22 01:07:54 2011
New Revision: 222167
URL: http://svn.freebsd.org/changeset/base/222167
Log:
Add a lock flags argument to the VFS_FHTOVP() file system
method, so that callers can indicate the minimum vnode
locking requirement. This will allow some file systems to choose
to return a LK_SHARED locked vnode when LK_SHARED is specified
for the flags argument. This patch only adds the flag. It
does not change any file system to use it and all callers
specify LK_EXCLUSIVE, so file system semantics are not changed.
Reviewed by: kib
Modified:
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
head/sys/fs/cd9660/cd9660_vfsops.c
head/sys/fs/ext2fs/ext2_vfsops.c
head/sys/fs/hpfs/hpfs_vfsops.c
head/sys/fs/msdosfs/msdosfs_vfsops.c
head/sys/fs/nfsserver/nfs_nfsdport.c
head/sys/fs/ntfs/ntfs_vfsops.c
head/sys/fs/nullfs/null_vfsops.c
head/sys/fs/tmpfs/tmpfs_vfsops.c
head/sys/fs/udf/udf_vfsops.c
head/sys/fs/unionfs/union_vfsops.c
head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
head/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
head/sys/kern/vfs_default.c
head/sys/kern/vfs_syscalls.c
head/sys/nfsserver/nfs_srvsubs.c
head/sys/nlm/nlm_prot_impl.c
head/sys/sys/mount.h
head/sys/sys/param.h
head/sys/ufs/ffs/ffs_vfsops.c
head/sys/ufs/ufs/ufs_extern.h
head/sys/ufs/ufs/ufs_vfsops.c
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 Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -93,7 +93,7 @@ static int zfs_vget(vfs_t *vfsp, ino_t i
static int zfs_sync(vfs_t *vfsp, int waitfor);
static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp,
struct ucred **credanonp, int *numsecflavors, int **secflavors);
-static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp);
+static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int flags, vnode_t **vpp);
static void zfs_objset_close(zfsvfs_t *zfsvfs);
static void zfs_freevfs(vfs_t *vfsp);
@@ -2007,7 +2007,7 @@ CTASSERT(SHORT_FID_LEN <= sizeof(struct
CTASSERT(LONG_FID_LEN <= sizeof(struct fid));
static int
-zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp)
+zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int flags, vnode_t **vpp)
{
zfsvfs_t *zfsvfs = vfsp->vfs_data;
znode_t *zp;
Modified: head/sys/fs/cd9660/cd9660_vfsops.c
==============================================================================
--- head/sys/fs/cd9660/cd9660_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/cd9660/cd9660_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -586,9 +586,10 @@ cd9660_statfs(mp, sbp)
/* ARGSUSED */
static int
-cd9660_fhtovp(mp, fhp, vpp)
+cd9660_fhtovp(mp, fhp, flags, vpp)
struct mount *mp;
struct fid *fhp;
+ int flags;
struct vnode **vpp;
{
struct ifid ifh;
Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/ext2fs/ext2_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -973,7 +973,7 @@ ext2_vget(struct mount *mp, ino_t ino, i
* those rights via. exflagsp and credanonp
*/
static int
-ext2_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+ext2_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
{
struct inode *ip;
struct ufid *ufhp;
Modified: head/sys/fs/hpfs/hpfs_vfsops.c
==============================================================================
--- head/sys/fs/hpfs/hpfs_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/hpfs/hpfs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -417,6 +417,7 @@ static int
hpfs_fhtovp(
struct mount *mp,
struct fid *fhp,
+ int flags,
struct vnode **vpp)
{
struct vnode *nvp;
Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -963,7 +963,7 @@ loop:
}
static int
-msdosfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+msdosfs_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
{
struct msdosfsmount *pmp = VFSTOMSDOSFS(mp);
struct defid *defhp = (struct defid *) fhp;
Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdport.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/nfsserver/nfs_nfsdport.c Sun May 22 01:07:54 2011 (r222167)
@@ -2551,7 +2551,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_
if (VFS_NEEDSGIANT(mp))
error = ESTALE;
else
- error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp);
+ error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, vpp);
if (error != 0)
/* Make sure the server replies ESTALE to the client. */
error = ESTALE;
@@ -2834,7 +2834,7 @@ nfsvno_getvp(fhandle_t *fhp)
mp = vfs_busyfs(&fhp->fh_fsid);
if (mp == NULL)
return (NULL);
- error = VFS_FHTOVP(mp, &fhp->fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, &vp);
vfs_unbusy(mp);
if (error)
return (NULL);
Modified: head/sys/fs/ntfs/ntfs_vfsops.c
==============================================================================
--- head/sys/fs/ntfs/ntfs_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/ntfs/ntfs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -616,6 +616,7 @@ static int
ntfs_fhtovp(
struct mount *mp,
struct fid *fhp,
+ int flags,
struct vnode **vpp)
{
struct vnode *nvp;
Modified: head/sys/fs/nullfs/null_vfsops.c
==============================================================================
--- head/sys/fs/nullfs/null_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/nullfs/null_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -321,13 +321,15 @@ nullfs_vget(mp, ino, flags, vpp)
}
static int
-nullfs_fhtovp(mp, fidp, vpp)
+nullfs_fhtovp(mp, fidp, flags, vpp)
struct mount *mp;
struct fid *fidp;
+ int flags;
struct vnode **vpp;
{
int error;
- error = VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, vpp);
+ error = VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, LK_EXCLUSIVE,
+ vpp);
if (error)
return (error);
Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -71,7 +71,8 @@ MALLOC_DEFINE(M_TMPFSNAME, "tmpfs name",
static int tmpfs_mount(struct mount *);
static int tmpfs_unmount(struct mount *, int);
static int tmpfs_root(struct mount *, int flags, struct vnode **);
-static int tmpfs_fhtovp(struct mount *, struct fid *, struct vnode **);
+static int tmpfs_fhtovp(struct mount *, struct fid *, int,
+ struct vnode **);
static int tmpfs_statfs(struct mount *, struct statfs *);
/* --------------------------------------------------------------------- */
@@ -341,7 +342,8 @@ tmpfs_root(struct mount *mp, int flags,
/* --------------------------------------------------------------------- */
static int
-tmpfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
+ struct vnode **vpp)
{
boolean_t found;
struct tmpfs_fid *tfhp;
Modified: head/sys/fs/udf/udf_vfsops.c
==============================================================================
--- head/sys/fs/udf/udf_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/udf/udf_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -722,7 +722,7 @@ udf_vget(struct mount *mp, ino_t ino, in
}
static int
-udf_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
{
struct ifid *ifhp;
struct vnode *nvp;
Modified: head/sys/fs/unionfs/union_vfsops.c
==============================================================================
--- head/sys/fs/unionfs/union_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/fs/unionfs/union_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -454,7 +454,8 @@ unionfs_vget(struct mount *mp, ino_t ino
}
static int
-unionfs_fhtovp(struct mount *mp, struct fid *fidp, struct vnode **vpp)
+unionfs_fhtovp(struct mount *mp, struct fid *fidp, int flags,
+ struct vnode **vpp)
{
return (EOPNOTSUPP);
}
Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
==============================================================================
--- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -335,7 +335,8 @@ reiserfs_statfs(struct mount *mp, struct
* those rights via. exflagsp and credanonp
*/
static int
-reiserfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+reiserfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
+ struct vnode **vpp)
{
int error;
struct rfid *rfhp;
Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
==============================================================================
--- head/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c Sun May 22 01:07:54 2011 (r222167)
@@ -370,9 +370,10 @@ _xfs_vget(mp, ino, flags, vpp)
}
static int
-_xfs_fhtovp(mp, fidp, vpp)
+_xfs_fhtovp(mp, fidp, flags, vpp)
struct mount *mp;
struct fid *fidp;
+ int flags;
struct vnode **vpp;
{
printf("xfs_fhtovp\n");
Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/kern/vfs_default.c Sun May 22 01:07:54 2011 (r222167)
@@ -1081,9 +1081,10 @@ vfs_stdvget (mp, ino, flags, vpp)
}
int
-vfs_stdfhtovp (mp, fhp, vpp)
+vfs_stdfhtovp (mp, fhp, flags, vpp)
struct mount *mp;
struct fid *fhp;
+ int flags;
struct vnode **vpp;
{
Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/kern/vfs_syscalls.c Sun May 22 01:07:54 2011 (r222167)
@@ -4405,7 +4405,7 @@ fhopen(td, uap)
return (ESTALE);
vfslocked = VFS_LOCK_GIANT(mp);
/* now give me my vnode, it gets returned to me locked */
- error = VFS_FHTOVP(mp, &fhp.fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fhp.fh_fid, LK_EXCLUSIVE, &vp);
vfs_unbusy(mp);
if (error)
goto out;
@@ -4581,7 +4581,7 @@ fhstat(td, uap)
if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL)
return (ESTALE);
vfslocked = VFS_LOCK_GIANT(mp);
- error = VFS_FHTOVP(mp, &fh.fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp);
vfs_unbusy(mp);
if (error) {
VFS_UNLOCK_GIANT(vfslocked);
@@ -4641,7 +4641,7 @@ kern_fhstatfs(struct thread *td, fhandle
if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL)
return (ESTALE);
vfslocked = VFS_LOCK_GIANT(mp);
- error = VFS_FHTOVP(mp, &fh.fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp);
if (error) {
vfs_unbusy(mp);
VFS_UNLOCK_GIANT(vfslocked);
Modified: head/sys/nfsserver/nfs_srvsubs.c
==============================================================================
--- head/sys/nfsserver/nfs_srvsubs.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/nfsserver/nfs_srvsubs.c Sun May 22 01:07:54 2011 (r222167)
@@ -1128,7 +1128,7 @@ nfsrv_fhtovp(fhandle_t *fhp, int flags,
goto out;
}
}
- error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp);
+ error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, vpp);
if (error) {
/* Make sure the server replies ESTALE to the client. */
error = ESTALE;
Modified: head/sys/nlm/nlm_prot_impl.c
==============================================================================
--- head/sys/nlm/nlm_prot_impl.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/nlm/nlm_prot_impl.c Sun May 22 01:07:54 2011 (r222167)
@@ -1797,7 +1797,7 @@ nlm_get_vfs_state(struct nlm_host *host,
goto out;
}
- error = VFS_FHTOVP(vs->vs_mp, &fhp->fh_fid, &vs->vs_vp);
+ error = VFS_FHTOVP(vs->vs_mp, &fhp->fh_fid, LK_EXCLUSIVE, &vs->vs_vp);
if (error)
goto out;
vs->vs_vnlocked = TRUE;
Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/sys/mount.h Sun May 22 01:07:54 2011 (r222167)
@@ -566,7 +566,8 @@ typedef int vfs_statfs_t(struct mount *m
typedef int vfs_sync_t(struct mount *mp, int waitfor);
typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags,
struct vnode **vpp);
-typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp);
+typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp,
+ int flags, struct vnode **vpp);
typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam,
int *extflagsp, struct ucred **credanonp,
int *numsecflavors, int **secflavors);
@@ -610,8 +611,8 @@ vfs_statfs_t __vfs_statfs;
#define VFS_SYNC(MP, WAIT) (*(MP)->mnt_op->vfs_sync)(MP, WAIT)
#define VFS_VGET(MP, INO, FLAGS, VPP) \
(*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP)
-#define VFS_FHTOVP(MP, FIDP, VPP) \
- (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
+#define VFS_FHTOVP(MP, FIDP, FLAGS, VPP) \
+ (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, FLAGS, VPP)
#define VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC) \
(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC, SEC)
#define VFS_EXTATTRCTL(MP, C, FN, NS, N) \
Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/sys/param.h Sun May 22 01:07:54 2011 (r222167)
@@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 900037 /* Master, propagated to newvers */
+#define __FreeBSD_version 900038 /* Master, propagated to newvers */
#ifdef _KERNEL
#define P_OSREL_SIGSEGV 700004
Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/ufs/ffs/ffs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -1640,9 +1640,10 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
* those rights via. exflagsp and credanonp
*/
static int
-ffs_fhtovp(mp, fhp, vpp)
+ffs_fhtovp(mp, fhp, flags, vpp)
struct mount *mp;
struct fid *fhp;
+ int flags;
struct vnode **vpp;
{
struct ufid *ufhp;
@@ -1653,7 +1654,7 @@ ffs_fhtovp(mp, fhp, vpp)
if (ufhp->ufid_ino < ROOTINO ||
ufhp->ufid_ino >= fs->fs_ncg * fs->fs_ipg)
return (ESTALE);
- return (ufs_fhtovp(mp, ufhp, vpp));
+ return (ufs_fhtovp(mp, ufhp, flags, vpp));
}
/*
Modified: head/sys/ufs/ufs/ufs_extern.h
==============================================================================
--- head/sys/ufs/ufs/ufs_extern.h Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/ufs/ufs/ufs_extern.h Sun May 22 01:07:54 2011 (r222167)
@@ -56,7 +56,7 @@ extern struct vop_vector ufs_vnodeops;
int ufs_bmap(struct vop_bmap_args *);
int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *,
struct buf *, int *, int *);
-int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **);
+int ufs_fhtovp(struct mount *, struct ufid *, int, struct vnode **);
int ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *);
void ufs_dirbad(struct inode *, doff_t, char *);
int ufs_dirbadentry(struct vnode *, struct direct *, int);
Modified: head/sys/ufs/ufs/ufs_vfsops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vfsops.c Sat May 21 22:53:56 2011 (r222166)
+++ head/sys/ufs/ufs/ufs_vfsops.c Sun May 22 01:07:54 2011 (r222167)
@@ -208,9 +208,10 @@ ufs_uninit(vfsp)
* Call the VFS_CHECKEXP beforehand to verify access.
*/
int
-ufs_fhtovp(mp, ufhp, vpp)
+ufs_fhtovp(mp, ufhp, flags, vpp)
struct mount *mp;
struct ufid *ufhp;
+ int flags;
struct vnode **vpp;
{
struct inode *ip;
More information about the svn-src-head
mailing list