From owner-freebsd-bugs@FreeBSD.ORG Wed Apr 18 09:10:05 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AE80106567C for ; Wed, 18 Apr 2012 09:10:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D92988FC22 for ; Wed, 18 Apr 2012 09:10:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3I9A4Iq099855 for ; Wed, 18 Apr 2012 09:10:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3I9A4gU099854; Wed, 18 Apr 2012 09:10:04 GMT (envelope-from gnats) Resent-Date: Wed, 18 Apr 2012 09:10:04 GMT Resent-Message-Id: <201204180910.q3I9A4gU099854@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Marcelo Araujo Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD04106566C for ; Wed, 18 Apr 2012 09:06:42 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id C65098FC0C for ; Wed, 18 Apr 2012 09:06:42 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q3I96gZY045399 for ; Wed, 18 Apr 2012 09:06:42 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q3I96g8X045398; Wed, 18 Apr 2012 09:06:42 GMT (envelope-from nobody) Message-Id: <201204180906.q3I96g8X045398@red.freebsd.org> Date: Wed, 18 Apr 2012 09:06:42 GMT From: Marcelo Araujo To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/167047: RELEASE-9 crash when using ZFS+NULLFS+NFS X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Apr 2012 09:10:05 -0000 >Number: 167047 >Category: kern >Synopsis: RELEASE-9 crash when using ZFS+NULLFS+NFS >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 18 09:10:04 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Marcelo Araujo >Release: FreeBSD 9.0-RELEASE i386 >Organization: FreeBSD >Environment: System: FreeBSD vibration.freebsd.org 9.0-RELEASE FreeBSD 9.0-RELEASE #13: Wed Apr 18 04:38:26 BRT 2012 araujo@vibration.freebsd.org:/usr/obj/usr/src/sys/NFS i386 >Description: 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/ >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 >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: --- /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 @@ 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; @@ -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(). - */ - NFSVOPLOCK(*vpp, LK_DOWNGRADE | LK_RETRY); NFSEXITCODE(error); return (error); >Release-Note: >Audit-Trail: >Unformatted: