kern/167047: RELEASE-9 crash when using ZFS+NULLFS+NFS

Marcelo Araujo araujo at
Wed Apr 18 09:10:05 UTC 2012

>Number:         167047
>Category:       kern
>Synopsis:       RELEASE-9 crash when using ZFS+NULLFS+NFS
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 18 09:10:04 UTC 2012
>Originator:     Marcelo Araujo
>Release:        FreeBSD 9.0-RELEASE i386
System: FreeBSD 9.0-RELEASE FreeBSD 9.0-RELEASE #13: Wed Apr
18 04:38:26 BRT 2012 araujo at i386
If we create a pool with ZFS, mount it using nullfs in another path and export it using NFS, when the user mount the NFS in another machine and try to perform a ls -a inside /mnt/.zfs we have the crash.

More information about it could be found at:
root# zpool create tank raidz /dev/ada1 /dev/ada2
root# mount nullfs /tank /mnt
root# echo "/mnt -alldirs" >>/etc/exports
root# /etc/rc.d/mountd restart

1) Mount the NFS share in another machine.
2) cd /mnt/.zfs/
3) ls -la
On FreeBSD-HEAD the problem doesn’t happens anymore, but investigate it, the patch attached that was obtained from HEAD, solved this issue.

Patch attached with submission follows:

--- /home/araujo/qnap/freebsd9_src/sys/fs/nfsserver/nfs_nfsdport.c	2012-04-16 04:02:30.000000000 -0300
+++ nfs_nfsdport.c	2012-04-18 03:38:16.000000000 -0300
@@ -2624,7 +2624,7 @@
 		error = ESTALE;
-		error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, vpp);
+		error = VFS_FHTOVP(mp, &fhp->fh_fid, lktype, vpp);
 	if (error != 0)
 		/* Make sure the server replies ESTALE to the client. */
 		error = ESTALE;
@@ -2645,13 +2645,6 @@
 				exp->nes_secflavors[i] = secflavors[i];
-	if (error == 0 && lktype == LK_SHARED)
-		/*
-		 * It would be much better to pass lktype to VFS_FHTOVP(),
-		 * but this will have to do until VFS_FHTOVP() has a lock
-		 * type argument like VFS_VGET().
-		 */
 	return (error);


More information about the freebsd-bugs mailing list