Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Nov 2006 01:20:46 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Mohan Srinivasan <mohans@freebsd.org>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/nfsclient nfs.h nfs_socket.c
Message-ID:  <20061121010050.P25283@delplex.bde.org>
In-Reply-To: <200611200414.kAK4EN1T032693@repoman.freebsd.org>
References:  <200611200414.kAK4EN1T032693@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 20 Nov 2006, Mohan Srinivasan wrote:

> mohans      2006-11-20 04:14:23 UTC
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/nfsclient        nfs.h nfs_socket.c
>  Log:
>  1) Fix up locking in nfs_up() and nfs_down.
>  2) Reduce the acquisitions of the Giant lock in the nfs_socket.c paths significantly.
>  - We don't need to acquire Giant before tsleeping on lbolt anymore,
>    since jhb specialcased lbolt handling in msleep.
>  - nfs_up() needs to acquire Giant only if printing the "server up"
>    message.

Giant isn't required here either.  tprintf() does its own locking as
required.  This locking happens to be Giant locking, and callers
unfortunately have to be aware of this to avoid LORs.  It may be
necessary to acquire at a higher level, but fortunately, most calls
to tprintf() are already at a high level, and since you've managed
to push down the calls here, the calls are apparently already at
a high level.

Giant should never have been required for calling tprintf() but it
became necessary when Giant was first implemented (since calls into
the tty driver require Giant), and for many years all calls to it from
file systems only worked because file systems were Giant locked.  Then,
some time after file systems became not Giant locked, the crashes
caused by calling tprintf() without Giant were incorrectly fixed for
a few days by acquiring Giant in many callers instead of only in
tprintf().

Giant was never required for plain printf().  nfs_printf() was never
needed since it only wraps plain printf() with Giant locking.

>  - nfs_timer() held Giant for the duration of the NFS timer processing,
>    just because the printing of the message in nfs_down() needed it
>    (and we acquire other locks in nfs_timer()). The acquisition of
>    Giant is moved down into nfs_down() now, reducing the time Giant is
>    held in that path.

Like nfs_up().

Bruce



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