xref: /freebsd/sys/fs/nullfs/null_vfsops.c (revision dfd233edd5040ed82a16a0074e220188e2c67ad4)
1d167cf6fSWarner Losh /*-
2996c772fSJohn Dyson  * Copyright (c) 1992, 1993, 1995
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * This code is derived from software donated to Berkeley by
6df8bae1dSRodney W. Grimes  * Jan-Simon Pendry.
7df8bae1dSRodney W. Grimes  *
8df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
9df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
10df8bae1dSRodney W. Grimes  * are met:
11df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
12df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
13df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
15df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
16df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
17df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
18df8bae1dSRodney W. Grimes  *    without specific prior written permission.
19df8bae1dSRodney W. Grimes  *
20df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
31df8bae1dSRodney W. Grimes  *
32df8bae1dSRodney W. Grimes  *	@(#)null_vfsops.c	8.2 (Berkeley) 1/21/94
33df8bae1dSRodney W. Grimes  *
34df8bae1dSRodney W. Grimes  * @(#)lofs_vfsops.c	1.2 (Berkeley) 6/18/92
35c3aac50fSPeter Wemm  * $FreeBSD$
36df8bae1dSRodney W. Grimes  */
37df8bae1dSRodney W. Grimes 
38df8bae1dSRodney W. Grimes /*
39df8bae1dSRodney W. Grimes  * Null Layer
40df8bae1dSRodney W. Grimes  * (See null_vnops.c for a description of what this does.)
41df8bae1dSRodney W. Grimes  */
42df8bae1dSRodney W. Grimes 
43df8bae1dSRodney W. Grimes #include <sys/param.h>
44df8bae1dSRodney W. Grimes #include <sys/systm.h>
4557b4252eSKonstantin Belousov #include <sys/fcntl.h>
46fdc0430eSMike Pritchard #include <sys/kernel.h>
47fb919e4dSMark Murray #include <sys/lock.h>
48a1c995b6SPoul-Henning Kamp #include <sys/malloc.h>
49df8bae1dSRodney W. Grimes #include <sys/mount.h>
50df8bae1dSRodney W. Grimes #include <sys/namei.h>
51fb919e4dSMark Murray #include <sys/proc.h>
52fb919e4dSMark Murray #include <sys/vnode.h>
53fb919e4dSMark Murray 
5499d300a1SRuslan Ermilov #include <fs/nullfs/null.h>
55df8bae1dSRodney W. Grimes 
565bb84bc8SRobert Watson static MALLOC_DEFINE(M_NULLFSMNT, "nullfs_mount", "NULLFS mount structure");
57a1c995b6SPoul-Henning Kamp 
587652131bSPoul-Henning Kamp static vfs_fhtovp_t	nullfs_fhtovp;
595e8c582aSPoul-Henning Kamp static vfs_mount_t	nullfs_mount;
607652131bSPoul-Henning Kamp static vfs_quotactl_t	nullfs_quotactl;
617652131bSPoul-Henning Kamp static vfs_root_t	nullfs_root;
627652131bSPoul-Henning Kamp static vfs_sync_t	nullfs_sync;
637652131bSPoul-Henning Kamp static vfs_statfs_t	nullfs_statfs;
647652131bSPoul-Henning Kamp static vfs_unmount_t	nullfs_unmount;
657652131bSPoul-Henning Kamp static vfs_vget_t	nullfs_vget;
667652131bSPoul-Henning Kamp static vfs_extattrctl_t	nullfs_extattrctl;
679b5e8b3aSBruce Evans 
68df8bae1dSRodney W. Grimes /*
69df8bae1dSRodney W. Grimes  * Mount null layer
70df8bae1dSRodney W. Grimes  */
71d4b7a369SPoul-Henning Kamp static int
72dfd233edSAttilio Rao nullfs_mount(struct mount *mp)
73df8bae1dSRodney W. Grimes {
74df8bae1dSRodney W. Grimes 	int error = 0;
75df8bae1dSRodney W. Grimes 	struct vnode *lowerrootvp, *vp;
76df8bae1dSRodney W. Grimes 	struct vnode *nullm_rootvp;
77df8bae1dSRodney W. Grimes 	struct null_mount *xmp;
789fcc512cSMaxime Henrion 	char *target;
799fcc512cSMaxime Henrion 	int isvnunlocked = 0, len;
805e8c582aSPoul-Henning Kamp 	struct nameidata nd, *ndp = &nd;
81df8bae1dSRodney W. Grimes 
828da80660SBoris Popov 	NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
83df8bae1dSRodney W. Grimes 
8464042a76SPoul-Henning Kamp 	if (mp->mnt_flag & MNT_ROOTFS)
8564042a76SPoul-Henning Kamp 		return (EOPNOTSUPP);
86df8bae1dSRodney W. Grimes 	/*
87df8bae1dSRodney W. Grimes 	 * Update is a no-op
88df8bae1dSRodney W. Grimes 	 */
89df8bae1dSRodney W. Grimes 	if (mp->mnt_flag & MNT_UPDATE) {
90ebbf93fdSCraig Rodrigues 		/*
91ebbf93fdSCraig Rodrigues 		 * Only support update mounts for NFS export.
92ebbf93fdSCraig Rodrigues 		 */
93ebbf93fdSCraig Rodrigues 		if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0))
94ebbf93fdSCraig Rodrigues 			return (0);
95ebbf93fdSCraig Rodrigues 		else
96df8bae1dSRodney W. Grimes 			return (EOPNOTSUPP);
97df8bae1dSRodney W. Grimes 	}
98df8bae1dSRodney W. Grimes 
99df8bae1dSRodney W. Grimes 	/*
100df8bae1dSRodney W. Grimes 	 * Get argument
101df8bae1dSRodney W. Grimes 	 */
1029fcc512cSMaxime Henrion 	error = vfs_getopt(mp->mnt_optnew, "target", (void **)&target, &len);
1039fcc512cSMaxime Henrion 	if (error || target[len - 1] != '\0')
1049fcc512cSMaxime Henrion 		return (EINVAL);
105df8bae1dSRodney W. Grimes 
106df8bae1dSRodney W. Grimes 	/*
107f85e8fc5SKATO Takenori 	 * Unlock lower node to avoid deadlock.
108f85e8fc5SKATO Takenori 	 * (XXX) VOP_ISLOCKED is needed?
109f85e8fc5SKATO Takenori 	 */
110aec0fb7bSPoul-Henning Kamp 	if ((mp->mnt_vnodecovered->v_op == &null_vnodeops) &&
11181c794f9SAttilio Rao 		VOP_ISLOCKED(mp->mnt_vnodecovered)) {
11222db15c0SAttilio Rao 		VOP_UNLOCK(mp->mnt_vnodecovered, 0);
113f85e8fc5SKATO Takenori 		isvnunlocked = 1;
114f85e8fc5SKATO Takenori 	}
115f85e8fc5SKATO Takenori 	/*
116df8bae1dSRodney W. Grimes 	 * Find lower node
117df8bae1dSRodney W. Grimes 	 */
118dfd233edSAttilio Rao 	NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread);
1193a773ad0SPoul-Henning Kamp 	error = namei(ndp);
120f85e8fc5SKATO Takenori 	/*
121f85e8fc5SKATO Takenori 	 * Re-lock vnode.
122f85e8fc5SKATO Takenori 	 */
12381c794f9SAttilio Rao 	if (isvnunlocked && !VOP_ISLOCKED(mp->mnt_vnodecovered))
124cb05b60aSAttilio Rao 		vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY);
125f85e8fc5SKATO Takenori 
1263a773ad0SPoul-Henning Kamp 	if (error)
127df8bae1dSRodney W. Grimes 		return (error);
128762e6b85SEivind Eklund 	NDFREE(ndp, NDF_ONLY_PNBUF);
129df8bae1dSRodney W. Grimes 
130df8bae1dSRodney W. Grimes 	/*
131df8bae1dSRodney W. Grimes 	 * Sanity check on lower vnode
132df8bae1dSRodney W. Grimes 	 */
133df8bae1dSRodney W. Grimes 	lowerrootvp = ndp->ni_vp;
134df8bae1dSRodney W. Grimes 
135f85e8fc5SKATO Takenori 	/*
136f85e8fc5SKATO Takenori 	 * Check multi null mount to avoid `lock against myself' panic.
137f85e8fc5SKATO Takenori 	 */
138f85e8fc5SKATO Takenori 	if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) {
1398da80660SBoris Popov 		NULLFSDEBUG("nullfs_mount: multi null mount?\n");
1406716c905SBoris Popov 		vput(lowerrootvp);
141747e9157SKATO Takenori 		return (EDEADLK);
142f85e8fc5SKATO Takenori 	}
143f85e8fc5SKATO Takenori 
144df8bae1dSRodney W. Grimes 	xmp = (struct null_mount *) malloc(sizeof(struct null_mount),
145a163d034SWarner Losh 				M_NULLFSMNT, M_WAITOK);	/* XXX */
146df8bae1dSRodney W. Grimes 
147df8bae1dSRodney W. Grimes 	/*
148df8bae1dSRodney W. Grimes 	 * Save reference to underlying FS
149df8bae1dSRodney W. Grimes 	 */
150df8bae1dSRodney W. Grimes 	xmp->nullm_vfs = lowerrootvp->v_mount;
151df8bae1dSRodney W. Grimes 
152df8bae1dSRodney W. Grimes 	/*
153df8bae1dSRodney W. Grimes 	 * Save reference.  Each mount also holds
154df8bae1dSRodney W. Grimes 	 * a reference on the root vnode.
155df8bae1dSRodney W. Grimes 	 */
1561cfdefbbSSemen Ustimenko 	error = null_nodeget(mp, lowerrootvp, &vp);
157df8bae1dSRodney W. Grimes 	/*
158df8bae1dSRodney W. Grimes 	 * Make sure the node alias worked
159df8bae1dSRodney W. Grimes 	 */
160df8bae1dSRodney W. Grimes 	if (error) {
16122db15c0SAttilio Rao 		VOP_UNLOCK(vp, 0);
162df8bae1dSRodney W. Grimes 		vrele(lowerrootvp);
163a1c995b6SPoul-Henning Kamp 		free(xmp, M_NULLFSMNT);	/* XXX */
164df8bae1dSRodney W. Grimes 		return (error);
165df8bae1dSRodney W. Grimes 	}
166df8bae1dSRodney W. Grimes 
167df8bae1dSRodney W. Grimes 	/*
168df8bae1dSRodney W. Grimes 	 * Keep a held reference to the root vnode.
169df8bae1dSRodney W. Grimes 	 * It is vrele'd in nullfs_unmount.
170df8bae1dSRodney W. Grimes 	 */
171df8bae1dSRodney W. Grimes 	nullm_rootvp = vp;
172e6e370a7SJeff Roberson 	nullm_rootvp->v_vflag |= VV_ROOT;
173df8bae1dSRodney W. Grimes 	xmp->nullm_rootvp = nullm_rootvp;
17475cabb63SJeff Roberson 
17575cabb63SJeff Roberson 	/*
17675cabb63SJeff Roberson 	 * Unlock the node (either the lower or the alias)
17775cabb63SJeff Roberson 	 */
17822db15c0SAttilio Rao 	VOP_UNLOCK(vp, 0);
17975cabb63SJeff Roberson 
1805da56ddbSTor Egge 	if (NULLVPTOLOWERVP(nullm_rootvp)->v_mount->mnt_flag & MNT_LOCAL) {
1815da56ddbSTor Egge 		MNT_ILOCK(mp);
182df8bae1dSRodney W. Grimes 		mp->mnt_flag |= MNT_LOCAL;
1835da56ddbSTor Egge 		MNT_IUNLOCK(mp);
1845da56ddbSTor Egge 	}
1855da56ddbSTor Egge 	MNT_ILOCK(mp);
186ccabcacbSJohn Baldwin 	mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE;
1875da56ddbSTor Egge 	MNT_IUNLOCK(mp);
18877465d93SAlfred Perlstein 	mp->mnt_data =  xmp;
189996c772fSJohn Dyson 	vfs_getnewfsid(mp);
190df8bae1dSRodney W. Grimes 
1917ab8c8c0SPoul-Henning Kamp 	vfs_mountedfrom(mp, target);
1927ab8c8c0SPoul-Henning Kamp 
1938da80660SBoris Popov 	NULLFSDEBUG("nullfs_mount: lower %s, alias at %s\n",
194df8bae1dSRodney W. Grimes 		mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname);
195df8bae1dSRodney W. Grimes 	return (0);
196df8bae1dSRodney W. Grimes }
197df8bae1dSRodney W. Grimes 
198df8bae1dSRodney W. Grimes /*
199df8bae1dSRodney W. Grimes  * Free reference to null layer
200df8bae1dSRodney W. Grimes  */
201d4b7a369SPoul-Henning Kamp static int
202dfd233edSAttilio Rao nullfs_unmount(mp, mntflags)
203df8bae1dSRodney W. Grimes 	struct mount *mp;
204df8bae1dSRodney W. Grimes 	int mntflags;
205df8bae1dSRodney W. Grimes {
2068da80660SBoris Popov 	void *mntdata;
207df8bae1dSRodney W. Grimes 	int error;
208df8bae1dSRodney W. Grimes 	int flags = 0;
209df8bae1dSRodney W. Grimes 
2108da80660SBoris Popov 	NULLFSDEBUG("nullfs_unmount: mp = %p\n", (void *)mp);
211df8bae1dSRodney W. Grimes 
212996c772fSJohn Dyson 	if (mntflags & MNT_FORCE)
213df8bae1dSRodney W. Grimes 		flags |= FORCECLOSE;
214df8bae1dSRodney W. Grimes 
2150864ef1eSIan Dowse 	/* There is 1 extra root vnode reference (nullm_rootvp). */
216dfd233edSAttilio Rao 	error = vflush(mp, 1, flags, curthread);
2173a773ad0SPoul-Henning Kamp 	if (error)
218df8bae1dSRodney W. Grimes 		return (error);
219df8bae1dSRodney W. Grimes 
220df8bae1dSRodney W. Grimes 	/*
221df8bae1dSRodney W. Grimes 	 * Finally, throw away the null_mount structure
222df8bae1dSRodney W. Grimes 	 */
2238da80660SBoris Popov 	mntdata = mp->mnt_data;
224df8bae1dSRodney W. Grimes 	mp->mnt_data = 0;
2254451405fSBoris Popov 	free(mntdata, M_NULLFSMNT);
226df8bae1dSRodney W. Grimes 	return 0;
227df8bae1dSRodney W. Grimes }
228df8bae1dSRodney W. Grimes 
229d4b7a369SPoul-Henning Kamp static int
230dfd233edSAttilio Rao nullfs_root(mp, flags, vpp)
231df8bae1dSRodney W. Grimes 	struct mount *mp;
232d9b2d9f7SJeff Roberson 	int flags;
233df8bae1dSRodney W. Grimes 	struct vnode **vpp;
234df8bae1dSRodney W. Grimes {
235df8bae1dSRodney W. Grimes 	struct vnode *vp;
236df8bae1dSRodney W. Grimes 
2378da80660SBoris Popov 	NULLFSDEBUG("nullfs_root(mp = %p, vp = %p->%p)\n", (void *)mp,
23889785a16SBruce Evans 	    (void *)MOUNTTONULLMOUNT(mp)->nullm_rootvp,
23989785a16SBruce Evans 	    (void *)NULLVPTOLOWERVP(MOUNTTONULLMOUNT(mp)->nullm_rootvp));
240df8bae1dSRodney W. Grimes 
241df8bae1dSRodney W. Grimes 	/*
242df8bae1dSRodney W. Grimes 	 * Return locked reference to root.
243df8bae1dSRodney W. Grimes 	 */
244df8bae1dSRodney W. Grimes 	vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
245df8bae1dSRodney W. Grimes 	VREF(vp);
2464451405fSBoris Popov 
2478da80660SBoris Popov #ifdef NULLFS_DEBUG
24881c794f9SAttilio Rao 	if (VOP_ISLOCKED(vp))
249cf29f18aSRobert Watson 		panic("root vnode is locked.\n");
2508da80660SBoris Popov #endif
251cb05b60aSAttilio Rao 	vn_lock(vp, flags | LK_RETRY);
252df8bae1dSRodney W. Grimes 	*vpp = vp;
253df8bae1dSRodney W. Grimes 	return 0;
254df8bae1dSRodney W. Grimes }
255df8bae1dSRodney W. Grimes 
256d4b7a369SPoul-Henning Kamp static int
257dfd233edSAttilio Rao nullfs_quotactl(mp, cmd, uid, arg)
258df8bae1dSRodney W. Grimes 	struct mount *mp;
259df8bae1dSRodney W. Grimes 	int cmd;
260df8bae1dSRodney W. Grimes 	uid_t uid;
2610430a5e2SDag-Erling Smørgrav 	void *arg;
262df8bae1dSRodney W. Grimes {
263dfd233edSAttilio Rao 	return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg);
264df8bae1dSRodney W. Grimes }
265df8bae1dSRodney W. Grimes 
266d4b7a369SPoul-Henning Kamp static int
267dfd233edSAttilio Rao nullfs_statfs(mp, sbp)
268df8bae1dSRodney W. Grimes 	struct mount *mp;
269df8bae1dSRodney W. Grimes 	struct statfs *sbp;
270df8bae1dSRodney W. Grimes {
271df8bae1dSRodney W. Grimes 	int error;
272df8bae1dSRodney W. Grimes 	struct statfs mstat;
273df8bae1dSRodney W. Grimes 
2748da80660SBoris Popov 	NULLFSDEBUG("nullfs_statfs(mp = %p, vp = %p->%p)\n", (void *)mp,
27589785a16SBruce Evans 	    (void *)MOUNTTONULLMOUNT(mp)->nullm_rootvp,
27689785a16SBruce Evans 	    (void *)NULLVPTOLOWERVP(MOUNTTONULLMOUNT(mp)->nullm_rootvp));
277df8bae1dSRodney W. Grimes 
278df8bae1dSRodney W. Grimes 	bzero(&mstat, sizeof(mstat));
279df8bae1dSRodney W. Grimes 
280dfd233edSAttilio Rao 	error = VFS_STATFS(MOUNTTONULLMOUNT(mp)->nullm_vfs, &mstat);
281df8bae1dSRodney W. Grimes 	if (error)
282df8bae1dSRodney W. Grimes 		return (error);
283df8bae1dSRodney W. Grimes 
284df8bae1dSRodney W. Grimes 	/* now copy across the "interesting" information and fake the rest */
285df8bae1dSRodney W. Grimes 	sbp->f_type = mstat.f_type;
286df8bae1dSRodney W. Grimes 	sbp->f_flags = mstat.f_flags;
287df8bae1dSRodney W. Grimes 	sbp->f_bsize = mstat.f_bsize;
288df8bae1dSRodney W. Grimes 	sbp->f_iosize = mstat.f_iosize;
289df8bae1dSRodney W. Grimes 	sbp->f_blocks = mstat.f_blocks;
290df8bae1dSRodney W. Grimes 	sbp->f_bfree = mstat.f_bfree;
291df8bae1dSRodney W. Grimes 	sbp->f_bavail = mstat.f_bavail;
292df8bae1dSRodney W. Grimes 	sbp->f_files = mstat.f_files;
293df8bae1dSRodney W. Grimes 	sbp->f_ffree = mstat.f_ffree;
294df8bae1dSRodney W. Grimes 	return (0);
295df8bae1dSRodney W. Grimes }
296df8bae1dSRodney W. Grimes 
297d4b7a369SPoul-Henning Kamp static int
298dfd233edSAttilio Rao nullfs_sync(mp, waitfor)
299df8bae1dSRodney W. Grimes 	struct mount *mp;
300df8bae1dSRodney W. Grimes 	int waitfor;
301df8bae1dSRodney W. Grimes {
302df8bae1dSRodney W. Grimes 	/*
303df8bae1dSRodney W. Grimes 	 * XXX - Assumes no data cached at null layer.
304df8bae1dSRodney W. Grimes 	 */
305df8bae1dSRodney W. Grimes 	return (0);
306df8bae1dSRodney W. Grimes }
307df8bae1dSRodney W. Grimes 
308d4b7a369SPoul-Henning Kamp static int
309a0595d02SKirk McKusick nullfs_vget(mp, ino, flags, vpp)
310df8bae1dSRodney W. Grimes 	struct mount *mp;
311df8bae1dSRodney W. Grimes 	ino_t ino;
312a0595d02SKirk McKusick 	int flags;
313df8bae1dSRodney W. Grimes 	struct vnode **vpp;
314df8bae1dSRodney W. Grimes {
3154451405fSBoris Popov 	int error;
316a0595d02SKirk McKusick 	error = VFS_VGET(MOUNTTONULLMOUNT(mp)->nullm_vfs, ino, flags, vpp);
3174451405fSBoris Popov 	if (error)
3184451405fSBoris Popov 		return (error);
319df8bae1dSRodney W. Grimes 
3201cfdefbbSSemen Ustimenko 	return (null_nodeget(mp, *vpp, vpp));
321df8bae1dSRodney W. Grimes }
322df8bae1dSRodney W. Grimes 
323d4b7a369SPoul-Henning Kamp static int
324c24fda81SAlfred Perlstein nullfs_fhtovp(mp, fidp, vpp)
325df8bae1dSRodney W. Grimes 	struct mount *mp;
326df8bae1dSRodney W. Grimes 	struct fid *fidp;
327df8bae1dSRodney W. Grimes 	struct vnode **vpp;
328c24fda81SAlfred Perlstein {
3294451405fSBoris Popov 	int error;
3304451405fSBoris Popov 	error = VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, vpp);
3314451405fSBoris Popov 	if (error)
3324451405fSBoris Popov 		return (error);
333c24fda81SAlfred Perlstein 
3341cfdefbbSSemen Ustimenko 	return (null_nodeget(mp, *vpp, vpp));
335c24fda81SAlfred Perlstein }
336c24fda81SAlfred Perlstein 
337c24fda81SAlfred Perlstein static int
338dfd233edSAttilio Rao nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname)
33991f37dcbSRobert Watson 	struct mount *mp;
34091f37dcbSRobert Watson 	int cmd;
34170f36851SRobert Watson 	struct vnode *filename_vp;
34270f36851SRobert Watson 	int namespace;
3438f073875SRobert Watson 	const char *attrname;
34491f37dcbSRobert Watson {
34570f36851SRobert Watson 	return VFS_EXTATTRCTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, filename_vp,
346dfd233edSAttilio Rao 	    namespace, attrname);
34791f37dcbSRobert Watson }
34891f37dcbSRobert Watson 
34991f37dcbSRobert Watson 
350d4b7a369SPoul-Henning Kamp static struct vfsops null_vfsops = {
3517652131bSPoul-Henning Kamp 	.vfs_extattrctl =	nullfs_extattrctl,
3527652131bSPoul-Henning Kamp 	.vfs_fhtovp =		nullfs_fhtovp,
3537652131bSPoul-Henning Kamp 	.vfs_init =		nullfs_init,
3545e8c582aSPoul-Henning Kamp 	.vfs_mount =		nullfs_mount,
3557652131bSPoul-Henning Kamp 	.vfs_quotactl =		nullfs_quotactl,
3567652131bSPoul-Henning Kamp 	.vfs_root =		nullfs_root,
3577652131bSPoul-Henning Kamp 	.vfs_statfs =		nullfs_statfs,
3587652131bSPoul-Henning Kamp 	.vfs_sync =		nullfs_sync,
3597652131bSPoul-Henning Kamp 	.vfs_uninit =		nullfs_uninit,
3607652131bSPoul-Henning Kamp 	.vfs_unmount =		nullfs_unmount,
3617652131bSPoul-Henning Kamp 	.vfs_vget =		nullfs_vget,
362df8bae1dSRodney W. Grimes };
363c901836cSGarrett Wollman 
3641b2fbe6fSSheldon Hearn VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK);
365