Bug 167048 - [nfs] [patch] RELEASE-9 crash when using ZFS+NULLFS+NFS
Summary: [nfs] [patch] RELEASE-9 crash when using ZFS+NULLFS+NFS
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Rick Macklem
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-18 10:30 UTC by Marcelo Araujo
Modified: 2014-05-19 17:46 UTC (History)
0 users

See Also:


Attachments
file.diff (821 bytes, patch)
2012-04-18 10:30 UTC, Marcelo Araujo
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo Araujo freebsd_committer freebsd_triage 2012-04-18 10:30:05 UTC
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: http://people.freebsd.org/~araujo/dump_nfs/

Fix: 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:
How-To-Repeat: 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
Comment 1 Marcelo Araujo freebsd_committer freebsd_triage 2012-04-18 10:43:07 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer.
Comment 2 Marcelo Araujo freebsd_committer freebsd_triage 2014-05-16 03:55:25 UTC
Responsible Changed
From-To: freebsd-fs->rmacklem

That is rmacklem@ area.
Comment 3 dfilter service freebsd_committer freebsd_triage 2014-05-19 17:15:34 UTC
Author: rmacklem
Date: Mon May 19 16:15:27 2014
New Revision: 266447
URL: http://svnweb.freebsd.org/changeset/base/266447

Log:
  MFC: r227809
  This patch enables the new/default NFS server's use of shared
  vnode locking for read, readdir, readlink, getattr and access.
  It is hoped that this will improve server performance for these
  operations, since they will no longer be serialized for a given
  file/vnode.
  
  PR:		167048

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/9/sys/fs/nfsserver/nfs_nfsdport.c	Mon May 19 16:13:40 2014	(r266446)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdport.c	Mon May 19 16:15:27 2014	(r266447)
@@ -2693,7 +2693,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_
 	if (VFS_NEEDSGIANT(mp))
 		error = ESTALE;
 	else
-		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;
@@ -2714,14 +2714,6 @@ nfsvno_fhtovp(struct mount *mp, fhandle_
 				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().
-		 */
-		NFSVOPLOCK(*vpp, LK_DOWNGRADE | LK_RETRY);
-
 	NFSEXITCODE(error);
 	return (error);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 4 Rick Macklem freebsd_committer freebsd_triage 2014-05-19 17:44:48 UTC
State Changed
From-To: open->closed


The patch in the PR (which is r227809 in head) has been MFC'd 
to stable/9. It is already in stable/10 and probably should 
have been MFC'd long ago.