smbfs_vfsops.c revision 87798
175374Sbp/*
275374Sbp * Copyright (c) 2000-2001, Boris Popov
375374Sbp * All rights reserved.
475374Sbp *
575374Sbp * Redistribution and use in source and binary forms, with or without
675374Sbp * modification, are permitted provided that the following conditions
775374Sbp * are met:
875374Sbp * 1. Redistributions of source code must retain the above copyright
975374Sbp *    notice, this list of conditions and the following disclaimer.
1075374Sbp * 2. Redistributions in binary form must reproduce the above copyright
1175374Sbp *    notice, this list of conditions and the following disclaimer in the
1275374Sbp *    documentation and/or other materials provided with the distribution.
1375374Sbp * 3. All advertising materials mentioning features or use of this software
1475374Sbp *    must display the following acknowledgement:
1575374Sbp *    This product includes software developed by Boris Popov.
1675374Sbp * 4. Neither the name of the author nor the names of any co-contributors
1775374Sbp *    may be used to endorse or promote products derived from this software
1875374Sbp *    without specific prior written permission.
1975374Sbp *
2075374Sbp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2175374Sbp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2275374Sbp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2375374Sbp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2475374Sbp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2575374Sbp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2675374Sbp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2775374Sbp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2875374Sbp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2975374Sbp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3075374Sbp * SUCH DAMAGE.
3175374Sbp *
3275374Sbp * $FreeBSD: head/sys/fs/smbfs/smbfs_vfsops.c 87798 2001-12-13 13:08:34Z sheldonh $
3375374Sbp */
3475374Sbp#include "opt_netsmb.h"
3575374Sbp#ifndef NETSMB
3675374Sbp#error "SMBFS requires option NETSMB"
3775374Sbp#endif
3875374Sbp
3975374Sbp#include <sys/param.h>
4075374Sbp#include <sys/systm.h>
4175374Sbp#include <sys/proc.h>
4275374Sbp#include <sys/bio.h>
4375374Sbp#include <sys/buf.h>
4475374Sbp#include <sys/kernel.h>
4575374Sbp#include <sys/sysctl.h>
4675374Sbp#include <sys/vnode.h>
4775374Sbp#include <sys/mount.h>
4875374Sbp#include <sys/stat.h>
4975374Sbp#include <sys/malloc.h>
5087798Ssheldonh#include <sys/module.h>
5175374Sbp
5275374Sbp
5375374Sbp#include <netsmb/smb.h>
5475374Sbp#include <netsmb/smb_conn.h>
5575374Sbp#include <netsmb/smb_subr.h>
5675374Sbp#include <netsmb/smb_dev.h>
5775374Sbp
5875374Sbp#include <fs/smbfs/smbfs.h>
5975374Sbp#include <fs/smbfs/smbfs_node.h>
6075374Sbp#include <fs/smbfs/smbfs_subr.h>
6175374Sbp
6275374Sbpint smbfs_debuglevel = 0;
6375374Sbp
6475374Sbpstatic int smbfs_version = SMBFS_VERSION;
6575374Sbp
6675374Sbp#ifdef SMBFS_USEZONE
6775374Sbp#include <vm/vm.h>
6875374Sbp#include <vm/vm_extern.h>
6975374Sbp#include <vm/vm_zone.h>
7075374Sbp
7175374Sbpvm_zone_t smbfsmount_zone;
7275374Sbp#endif
7375374Sbp
7475374SbpSYSCTL_NODE(_vfs, OID_AUTO, smbfs, CTLFLAG_RW, 0, "SMB/CIFS file system");
7575374SbpSYSCTL_INT(_vfs_smbfs, OID_AUTO, version, CTLFLAG_RD, &smbfs_version, 0, "");
7675374SbpSYSCTL_INT(_vfs_smbfs, OID_AUTO, debuglevel, CTLFLAG_RW, &smbfs_debuglevel, 0, "");
7775374Sbp
7875374Sbpstatic MALLOC_DEFINE(M_SMBFSHASH, "SMBFS hash", "SMBFS hash table");
7975374Sbp
8075374Sbp
8175374Sbpstatic int smbfs_mount(struct mount *, char *, caddr_t,
8287194Sbp			struct nameidata *, struct thread *);
8387194Sbpstatic int smbfs_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *);
8475374Sbpstatic int smbfs_root(struct mount *, struct vnode **);
8587194Sbpstatic int smbfs_start(struct mount *, int, struct thread *);
8687194Sbpstatic int smbfs_statfs(struct mount *, struct statfs *, struct thread *);
8787194Sbpstatic int smbfs_sync(struct mount *, int, struct ucred *, struct thread *);
8887194Sbpstatic int smbfs_unmount(struct mount *, int, struct thread *);
8975374Sbpstatic int smbfs_init(struct vfsconf *vfsp);
9075374Sbpstatic int smbfs_uninit(struct vfsconf *vfsp);
9175374Sbp
9275374Sbp#if __FreeBSD_version < 400009
9375374Sbpstatic int smbfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp);
9475374Sbpstatic int smbfs_fhtovp(struct mount *, struct fid *,
9575374Sbp			struct sockaddr *, struct vnode **, int *,
9675374Sbp			struct ucred **);
9775374Sbpstatic int smbfs_vptofh(struct vnode *, struct fid *);
9875374Sbp#endif
9975374Sbp
10075374Sbpstatic struct vfsops smbfs_vfsops = {
10175374Sbp	smbfs_mount,
10275374Sbp	smbfs_start,
10375374Sbp	smbfs_unmount,
10475374Sbp	smbfs_root,
10575374Sbp	smbfs_quotactl,
10675374Sbp	smbfs_statfs,
10775374Sbp	smbfs_sync,
10875374Sbp#if __FreeBSD_version > 400008
10975374Sbp	vfs_stdvget,
11075374Sbp	vfs_stdfhtovp,		/* shouldn't happen */
11175374Sbp	vfs_stdcheckexp,
11275374Sbp	vfs_stdvptofh,		/* shouldn't happen */
11375374Sbp#else
11475374Sbp	smbfs_vget,
11575374Sbp	smbfs_fhtovp,
11675374Sbp	smbfs_vptofh,
11775374Sbp#endif
11875374Sbp	smbfs_init,
11975374Sbp	smbfs_uninit,
12075374Sbp#ifndef FB_RELENG3
12175374Sbp	vfs_stdextattrctl,
12275374Sbp#else
12375374Sbp#define	M_USE_RESERVE	M_KERNEL
12475374Sbp	&sysctl___vfs_smbfs
12575374Sbp#endif
12675374Sbp};
12775374Sbp
12875374Sbp
12975374SbpVFS_SET(smbfs_vfsops, smbfs, VFCF_NETWORK);
13075374Sbp
13175374SbpMODULE_DEPEND(smbfs, netsmb, NSMB_VERSION, NSMB_VERSION, NSMB_VERSION);
13275374SbpMODULE_DEPEND(smbfs, libiconv, 1, 1, 1);
13387798SsheldonhMODULE_DEPEND(smbfs, libmchain, 1, 1, 1);
13475374Sbp
13575374Sbpint smbfs_pbuf_freecnt = -1;	/* start out unlimited */
13675374Sbp
13775374Sbpstatic int
13875374Sbpsmbfs_mount(struct mount *mp, char *path, caddr_t data,
13987194Sbp	struct nameidata *ndp, struct thread *td)
14075374Sbp{
14175374Sbp	struct smbfs_args args; 	  /* will hold data from mount request */
14275374Sbp	struct smbmount *smp = NULL;
14375374Sbp	struct smb_vc *vcp;
14475374Sbp	struct smb_share *ssp = NULL;
14575374Sbp	struct vnode *vp;
14675374Sbp	struct smb_cred scred;
14775374Sbp#ifndef	FB_CURRENT
14875374Sbp	size_t size;
14975374Sbp#endif
15075374Sbp	int error;
15175374Sbp	char *pc, *pe;
15275374Sbp
15375374Sbp	if (data == NULL) {
15475374Sbp		printf("missing data argument\n");
15575374Sbp		return EINVAL;
15675374Sbp	}
15775374Sbp	if (mp->mnt_flag & MNT_UPDATE) {
15875374Sbp		printf("MNT_UPDATE not implemented");
15975374Sbp		return EOPNOTSUPP;
16075374Sbp	}
16175374Sbp	error = copyin(data, (caddr_t)&args, sizeof(struct smbfs_args));
16275374Sbp	if (error)
16375374Sbp		return error;
16475374Sbp	if (args.version != SMBFS_VERSION) {
16575374Sbp		printf("mount version mismatch: kernel=%d, mount=%d\n",
16675374Sbp		    SMBFS_VERSION, args.version);
16775374Sbp		return EINVAL;
16875374Sbp	}
16987194Sbp	smb_makescred(&scred, td, td->td_proc->p_ucred);
17075374Sbp	error = smb_dev2share(args.dev, SMBM_EXEC, &scred, &ssp);
17175374Sbp	if (error) {
17275374Sbp		printf("invalid device handle %d (%d)\n", args.dev, error);
17375374Sbp		return error;
17475374Sbp	}
17575374Sbp	vcp = SSTOVC(ssp);
17687194Sbp	smb_share_unlock(ssp, 0, td);
17775374Sbp	mp->mnt_stat.f_iosize = SSTOVC(ssp)->vc_txmax;
17875374Sbp
17975374Sbp#ifdef SMBFS_USEZONE
18075374Sbp	smp = zalloc(smbfsmount_zone);
18175374Sbp#else
18275374Sbp        MALLOC(smp, struct smbmount*, sizeof(*smp), M_SMBFSDATA, M_USE_RESERVE);
18375374Sbp#endif
18475374Sbp        if (smp == NULL) {
18575374Sbp                printf("could not alloc smbmount\n");
18675374Sbp                error = ENOMEM;
18775374Sbp		goto bad;
18875374Sbp        }
18975374Sbp	bzero(smp, sizeof(*smp));
19075374Sbp        mp->mnt_data = (qaddr_t)smp;
19175374Sbp	smp->sm_hash = hashinit(desiredvnodes, M_SMBFSHASH, &smp->sm_hashlen);
19275374Sbp	if (smp->sm_hash == NULL)
19375374Sbp		goto bad;
19475374Sbp	lockinit(&smp->sm_hashlock, PVFS, "smbfsh", 0, 0);
19575374Sbp	smp->sm_share = ssp;
19675374Sbp	smp->sm_root = NULL;
19775374Sbp        smp->sm_args = args;
19875374Sbp	smp->sm_caseopt = args.caseopt;
19975374Sbp	smp->sm_args.file_mode = (smp->sm_args.file_mode &
20075374Sbp			    (S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFREG;
20175374Sbp	smp->sm_args.dir_mode  = (smp->sm_args.dir_mode &
20275374Sbp			    (S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
20375374Sbp
20475374Sbp/*	simple_lock_init(&smp->sm_npslock);*/
20575374Sbp#ifndef	FB_CURRENT
20675374Sbp	error = copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
20775374Sbp	if (error)
20875374Sbp		goto bad;
20975374Sbp	bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
21075374Sbp#endif
21175374Sbp	pc = mp->mnt_stat.f_mntfromname;
21275374Sbp	pe = pc + sizeof(mp->mnt_stat.f_mntfromname);
21375374Sbp	bzero(pc, MNAMELEN);
21475374Sbp	*pc++ = '/';
21575374Sbp	*pc++ = '/';
21675374Sbp	pc=index(strncpy(pc, vcp->vc_username, pe - pc - 2), 0);
21775374Sbp	if (pc < pe-1) {
21875374Sbp		*(pc++) = '@';
21975374Sbp		pc = index(strncpy(pc, vcp->vc_srvname, pe - pc - 2), 0);
22075374Sbp		if (pc < pe - 1) {
22175374Sbp			*(pc++) = '/';
22275374Sbp			strncpy(pc, ssp->ss_name, pe - pc - 2);
22375374Sbp		}
22475374Sbp	}
22575374Sbp	/* protect against invalid mount points */
22675374Sbp	smp->sm_args.mount_point[sizeof(smp->sm_args.mount_point) - 1] = '\0';
22775374Sbp	vfs_getnewfsid(mp);
22875374Sbp	error = smbfs_root(mp, &vp);
22975374Sbp	if (error)
23075374Sbp		goto bad;
23187194Sbp	VOP_UNLOCK(vp, 0, td);
23275374Sbp	SMBVDEBUG("root.v_usecount = %d\n", vp->v_usecount);
23375374Sbp
23475374Sbp#ifdef DIAGNOSTICS
23575374Sbp	SMBERROR("mp=%p\n", mp);
23675374Sbp#endif
23775374Sbp	return error;
23875374Sbpbad:
23975374Sbp        if (smp) {
24075374Sbp		if (smp->sm_hash)
24175374Sbp			free(smp->sm_hash, M_SMBFSHASH);
24275374Sbp		lockdestroy(&smp->sm_hashlock);
24375374Sbp#ifdef SMBFS_USEZONE
24475374Sbp		zfree(smbfsmount_zone, smp);
24575374Sbp#else
24675374Sbp		free(smp, M_SMBFSDATA);
24775374Sbp#endif
24875374Sbp	}
24975374Sbp	if (ssp)
25075374Sbp		smb_share_put(ssp, &scred);
25175374Sbp        return error;
25275374Sbp}
25375374Sbp
25475374Sbp/* Unmount the filesystem described by mp. */
25575374Sbpstatic int
25687194Sbpsmbfs_unmount(struct mount *mp, int mntflags, struct thread *td)
25775374Sbp{
25875374Sbp	struct smbmount *smp = VFSTOSMBFS(mp);
25975374Sbp	struct smb_cred scred;
26075374Sbp	int error, flags;
26175374Sbp
26275374Sbp	SMBVDEBUG("smbfs_unmount: flags=%04x\n", mntflags);
26375374Sbp	flags = 0;
26475374Sbp	if (mntflags & MNT_FORCE)
26575374Sbp		flags |= FORCECLOSE;
26676688Siedowse	/* There is 1 extra root vnode reference from smbfs_mount(). */
26776688Siedowse	error = vflush(mp, 1, flags);
26875374Sbp	if (error)
26975374Sbp		return error;
27087194Sbp	smb_makescred(&scred, td, td->td_proc->p_ucred);
27175374Sbp	smb_share_put(smp->sm_share, &scred);
27275374Sbp	mp->mnt_data = (qaddr_t)0;
27375374Sbp
27475374Sbp	if (smp->sm_hash)
27575374Sbp		free(smp->sm_hash, M_SMBFSHASH);
27675374Sbp	lockdestroy(&smp->sm_hashlock);
27775374Sbp#ifdef SMBFS_USEZONE
27875374Sbp	zfree(smbfsmount_zone, smp);
27975374Sbp#else
28075374Sbp	free(smp, M_SMBFSDATA);
28175374Sbp#endif
28275374Sbp	mp->mnt_flag &= ~MNT_LOCAL;
28375374Sbp	return error;
28475374Sbp}
28575374Sbp
28675374Sbp/*
28775374Sbp * Return locked root vnode of a filesystem
28875374Sbp */
28975374Sbpstatic int
29075374Sbpsmbfs_root(struct mount *mp, struct vnode **vpp)
29175374Sbp{
29275374Sbp	struct smbmount *smp = VFSTOSMBFS(mp);
29375374Sbp	struct vnode *vp;
29475374Sbp	struct smbnode *np;
29575374Sbp	struct smbfattr fattr;
29687194Sbp	struct thread *td = curthread;
29787194Sbp	struct ucred *cred = td->td_proc->p_ucred;
29875374Sbp	struct smb_cred scred;
29975374Sbp	int error;
30075374Sbp
30175374Sbp	if (smp == NULL) {
30275374Sbp		SMBERROR("smp == NULL (bug in umount)\n");
30375374Sbp		return EINVAL;
30475374Sbp	}
30575374Sbp	if (smp->sm_root) {
30675374Sbp		*vpp = SMBTOV(smp->sm_root);
30787194Sbp		return vget(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
30875374Sbp	}
30987194Sbp	smb_makescred(&scred, td, cred);
31075374Sbp	error = smbfs_smb_lookup(NULL, NULL, 0, &fattr, &scred);
31175374Sbp	if (error)
31275374Sbp		return error;
31375374Sbp	error = smbfs_nget(mp, NULL, "TheRooT", 7, &fattr, &vp);
31475374Sbp	if (error)
31575374Sbp		return error;
31675374Sbp	vp->v_flag |= VROOT;
31775374Sbp	np = VTOSMB(vp);
31875374Sbp	smp->sm_root = np;
31975374Sbp	*vpp = vp;
32075374Sbp	return 0;
32175374Sbp}
32275374Sbp
32375374Sbp/*
32475374Sbp * Vfs start routine, a no-op.
32575374Sbp */
32675374Sbp/* ARGSUSED */
32775374Sbpstatic int
32887194Sbpsmbfs_start(mp, flags, td)
32975374Sbp	struct mount *mp;
33075374Sbp	int flags;
33187194Sbp	struct thread *td;
33275374Sbp{
33375374Sbp	SMBVDEBUG("flags=%04x\n", flags);
33475374Sbp	return 0;
33575374Sbp}
33675374Sbp
33775374Sbp/*
33875374Sbp * Do operations associated with quotas, not supported
33975374Sbp */
34075374Sbp/* ARGSUSED */
34175374Sbpstatic int
34287194Sbpsmbfs_quotactl(mp, cmd, uid, arg, td)
34375374Sbp	struct mount *mp;
34475374Sbp	int cmd;
34575374Sbp	uid_t uid;
34675374Sbp	caddr_t arg;
34787194Sbp	struct thread *td;
34875374Sbp{
34975374Sbp	SMBVDEBUG("return EOPNOTSUPP\n");
35075374Sbp	return EOPNOTSUPP;
35175374Sbp}
35275374Sbp
35375374Sbp/*ARGSUSED*/
35475374Sbpint
35575374Sbpsmbfs_init(struct vfsconf *vfsp)
35675374Sbp{
35775374Sbp#ifndef SMP
35875374Sbp	int name[2];
35975374Sbp	int olen, ncpu, plen, error;
36075374Sbp
36175374Sbp	name[0] = CTL_HW;
36275374Sbp	name[1] = HW_NCPU;
36387194Sbp	error = kernel_sysctl(curthread, name, 2, &ncpu, &olen, NULL, 0, &plen);
36475374Sbp	if (error == 0 && ncpu > 1)
36575374Sbp		printf("warning: smbfs module compiled without SMP support.");
36675374Sbp#endif
36775374Sbp
36875374Sbp#ifdef SMBFS_USEZONE
36975374Sbp	smbfsmount_zone = zinit("SMBFSMOUNT", sizeof(struct smbmount), 0, 0, 1);
37075374Sbp#endif
37175374Sbp	smbfs_pbuf_freecnt = nswbuf / 2 + 1;
37275374Sbp	SMBVDEBUG("done.\n");
37375374Sbp	return 0;
37475374Sbp}
37575374Sbp
37675374Sbp/*ARGSUSED*/
37775374Sbpint
37875374Sbpsmbfs_uninit(struct vfsconf *vfsp)
37975374Sbp{
38075374Sbp
38175374Sbp	SMBVDEBUG("done.\n");
38275374Sbp	return 0;
38375374Sbp}
38475374Sbp
38575374Sbp/*
38675374Sbp * smbfs_statfs call
38775374Sbp */
38875374Sbpint
38987194Sbpsmbfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
39075374Sbp{
39175374Sbp	struct smbmount *smp = VFSTOSMBFS(mp);
39275374Sbp	struct smbnode *np = smp->sm_root;
39375374Sbp	struct smb_share *ssp = smp->sm_share;
39475374Sbp	struct smb_cred scred;
39575374Sbp	int error = 0;
39675374Sbp
39775374Sbp	if (np == NULL)
39875374Sbp		return EINVAL;
39975374Sbp
40075374Sbp	sbp->f_iosize = SSTOVC(ssp)->vc_txmax;		/* optimal transfer block size */
40175374Sbp	sbp->f_spare2 = 0;			/* placeholder */
40287194Sbp	smb_makescred(&scred, td, td->td_proc->p_ucred);
40375374Sbp
40475374Sbp	if (SMB_DIALECT(SSTOVC(ssp)) >= SMB_DIALECT_LANMAN2_0)
40575374Sbp		error = smbfs_smb_statfs2(ssp, sbp, &scred);
40675374Sbp	else
40775374Sbp		error = smbfs_smb_statfs(ssp, sbp, &scred);
40875374Sbp	if (error)
40975374Sbp		return error;
41075374Sbp	sbp->f_flags = 0;		/* copy of mount exported flags */
41175374Sbp	if (sbp != &mp->mnt_stat) {
41275374Sbp		sbp->f_fsid = mp->mnt_stat.f_fsid;	/* file system id */
41375374Sbp		sbp->f_owner = mp->mnt_stat.f_owner;	/* user that mounted the filesystem */
41475374Sbp		sbp->f_type = mp->mnt_vfc->vfc_typenum;	/* type of filesystem */
41575374Sbp		bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
41675374Sbp		bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
41775374Sbp	}
41875374Sbp	strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN);
41975374Sbp	return 0;
42075374Sbp}
42175374Sbp
42275374Sbp/*
42375374Sbp * Flush out the buffer cache
42475374Sbp */
42575374Sbp/* ARGSUSED */
42675374Sbpstatic int
42787194Sbpsmbfs_sync(mp, waitfor, cred, td)
42875374Sbp	struct mount *mp;
42975374Sbp	int waitfor;
43075374Sbp	struct ucred *cred;
43187194Sbp	struct thread *td;
43275374Sbp{
43375374Sbp	struct vnode *vp;
43475374Sbp	int error, allerror = 0;
43575374Sbp	/*
43675374Sbp	 * Force stale buffer cache information to be flushed.
43775374Sbp	 */
43875374Sbploop:
43985339Sdillon	for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist);
44075374Sbp	     vp != NULL;
44185339Sdillon	     vp = TAILQ_NEXT(vp, v_nmntvnodes)) {
44275374Sbp		/*
44375374Sbp		 * If the vnode that we are about to sync is no longer
44475374Sbp		 * associated with this mount point, start over.
44575374Sbp		 */
44675374Sbp		if (vp->v_mount != mp)
44775374Sbp			goto loop;
44875374Sbp#ifndef FB_RELENG3
44975374Sbp		if (VOP_ISLOCKED(vp, NULL) || TAILQ_EMPTY(&vp->v_dirtyblkhd) ||
45075374Sbp#else
45175374Sbp		if (VOP_ISLOCKED(vp) || TAILQ_EMPTY(&vp->v_dirtyblkhd) ||
45275374Sbp#endif
45375374Sbp		    waitfor == MNT_LAZY)
45475374Sbp			continue;
45587194Sbp		if (vget(vp, LK_EXCLUSIVE, td))
45675374Sbp			goto loop;
45787194Sbp		error = VOP_FSYNC(vp, cred, waitfor, td);
45875374Sbp		if (error)
45975374Sbp			allerror = error;
46075374Sbp		vput(vp);
46175374Sbp	}
46275374Sbp	return (allerror);
46375374Sbp}
46475374Sbp
46575374Sbp#if __FreeBSD_version < 400009
46675374Sbp/*
46775374Sbp * smbfs flat namespace lookup. Unsupported.
46875374Sbp */
46975374Sbp/* ARGSUSED */
47075374Sbpstatic int smbfs_vget(mp, ino, vpp)
47175374Sbp	struct mount *mp;
47275374Sbp	ino_t ino;
47375374Sbp	struct vnode **vpp;
47475374Sbp{
47575374Sbp	return (EOPNOTSUPP);
47675374Sbp}
47775374Sbp
47875374Sbp/* ARGSUSED */
47975374Sbpstatic int smbfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
48075374Sbp	struct mount *mp;
48175374Sbp	struct fid *fhp;
48275374Sbp	struct sockaddr *nam;
48375374Sbp	struct vnode **vpp;
48475374Sbp	int *exflagsp;
48575374Sbp	struct ucred **credanonp;
48675374Sbp{
48775374Sbp	return (EINVAL);
48875374Sbp}
48975374Sbp
49075374Sbp/*
49175374Sbp * Vnode pointer to File handle, should never happen either
49275374Sbp */
49375374Sbp/* ARGSUSED */
49475374Sbpstatic int
49575374Sbpsmbfs_vptofh(vp, fhp)
49675374Sbp	struct vnode *vp;
49775374Sbp	struct fid *fhp;
49875374Sbp{
49975374Sbp	return (EINVAL);
50075374Sbp}
50175374Sbp
50275374Sbp#endif /* __FreeBSD_version < 400009 */
503