Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 2008 20:08:51 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        obrien@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: cvs commit: src/sys/nfsclient nfs_socket.c
Message-ID:  <20080306180851.GO57756@deviant.kiev.zoral.com.ua>
In-Reply-To: <20080306174948.GA92538@dragon.NUXI.org>
References:  <20080306174948.GA92538@dragon.NUXI.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080306180851.GO57756>