From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 6 18:08:59 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9B601065670 for ; Thu, 6 Mar 2008 18:08:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay03.kiev.sovam.com (relay03.kiev.sovam.com [62.64.120.201]) by mx1.freebsd.org (Postfix) with ESMTP id 5B0D98FC2C for ; Thu, 6 Mar 2008 18:08:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=skuns.kiev.zoral.com.ua) by relay03.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1JXKWV-0008MY-FU; Thu, 06 Mar 2008 20:08:57 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m26I973u008825 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Mar 2008 20:09:07 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m26I8qB0049639; Thu, 6 Mar 2008 20:08:52 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m26I8pI6049638; Thu, 6 Mar 2008 20:08:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 6 Mar 2008 20:08:51 +0200 From: Kostik Belousov To: obrien@freebsd.org, freebsd-hackers@freebsd.org Message-ID: <20080306180851.GO57756@deviant.kiev.zoral.com.ua> References: <20080306174948.GA92538@dragon.NUXI.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TSvRAX6F0b3a4r66" Content-Disposition: inline In-Reply-To: <20080306174948.GA92538@dragon.NUXI.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on skuns.kiev.zoral.com.ua X-Scanner-Signature: 8a658898c353158d5b622bcbe36a9e12 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2366 [Mar 6 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release Cc: Subject: Re: cvs commit: src/sys/nfsclient nfs_socket.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Mar 2008 18:08:59 -0000 --TSvRAX6F0b3a4r66 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 06, 2008 at 09:49:48AM -0800, David O'Brien wrote: > On Tue, Aug 29, 2006 at 10:00:12PM +0000, Mohan Srinivasan wrote: > > mohans 2006-08-29 22:00:12 UTC > > FreeBSD src repository > > Modified files: > > sys/nfsclient nfs_socket.c=20 > > Log: > > Fix for a deadlock triggered by a 'umount -f' causing a NFS request t= o never > > retransmit (or return). Thanks to John Baldwin for helping nail this = one. > > Revision Changes Path > > 1.144 +14 -2 src/sys/nfsclient/nfs_socket.c > > http://cvsweb.freebsd.org/src/sys/nfsclient/nfs_socket.c.diff?r1=3D1.14= 3&r2=3D1.144 >=20 > How does this look for a RELENG_6 version of this fix? >=20 > Index: nfsclient/nfs_socket.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/ncvs/src/sys/nfsclient/nfs_socket.c,v > retrieving revision 1.125.2.18 > diff -u -p -r1.125.2.18 nfs_socket.c > --- nfsclient/nfs_socket.c 17 Jan 2008 21:04:51 -0000 1.125.2.18 > +++ nfsclient/nfs_socket.c 25 Feb 2008 10:26:59 -0000 > @@ -1323,6 +1323,18 @@ nfs_timer(void *arg) > continue; > if (nfs_sigintr(nmp, rep, rep->r_td)) > continue; > + else { > + /* > + * Terminate request if force-unmount in progress. > + * Note that NFS could have vfs_busy'ed the mount, > + * causing the unmount to wait for the mnt_lock, making > + * this bit of logic necessary. > + */ > + if (rep->r_nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) { > + nfs_softterm(rep); > + continue; > + } > + } > if (nmp->nm_tprintf_initial_delay !=3D 0 && > (rep->r_rexmit > 2 || (rep->r_flags & R_RESENDERR)) && > rep->r_lastmsg + nmp->nm_tprintf_delay < now.tv_sec) { >=20 The reason for this change was the rev. 1.180 of the nfs_vfsops.c, that never makes into RELENG_6. NFS client in RELENG_7 is MPsafe and sufficiently reworked. I think that scenario that leads to that deadlock is: The thread A doing fstatfs() vfs_busy()ed the mountpoint, and then: - unmount (thread B) waits for the mnt_lock; - the request sent by the thread A or response to that request is lost and never retransmitted due to forced umount being performed. This ends up in the deadlock. --TSvRAX6F0b3a4r66 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iEYEARECAAYFAkfQMzIACgkQC3+MBN1Mb4i1kgCeMd7P4MdsKp8nfY6T/YCDUMqt gDgAnimAbBjtC8XGDxb4UO/Y1rKO9dKs =9A1l -----END PGP SIGNATURE----- --TSvRAX6F0b3a4r66--