From d4875805d7a5e76cf2559425660603cb1df0dbc7 Mon Sep 17 00:00:00 2001 From: Mohan Srinivasan Date: Mon, 27 Nov 2006 23:26:06 +0000 Subject: [PATCH] bde@ pointed out that tprintf() acquires Giant so callers of tprintf() don't have to explicitly acquire Giant (although they need to be aware of this and not hold any locks at that point). Remove the acquisitions of Giant in the NFS client wrapping tprintf(). --- sys/nfsclient/nfs_socket.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index 90e8375378a..1e1aa5aa8ad 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -1387,6 +1387,10 @@ nfs_timer(void *arg) (rep->r_rexmit > 2 || (rep->r_flags & R_RESENDERR)) && rep->r_lastmsg + nmp->nm_tprintf_delay < now.tv_sec) { rep->r_lastmsg = now.tv_sec; + /* + * Pin down the request and drop locks for the acquisition + * of Giant from tprintf() in nfs_down(). + */ rep->r_flags |= R_PIN_REQ; mtx_unlock(&rep->r_mtx); mtx_unlock(&nmp->nm_mtx); @@ -1839,8 +1843,6 @@ nfs_msg(struct thread *td, const char *server, const char *msg, int error) { struct proc *p; - GIANT_REQUIRED; /* tprintf */ - p = td ? td->td_proc : NULL; if (error) { tprintf(p, LOG_INFO, "nfs server %s: %s, error %d\n", server, @@ -1883,9 +1885,7 @@ nfs_down(rep, nmp, td, msg, error, flags) if (rep) rep->r_flags |= R_TPRINTFMSG; mtx_unlock(&rep->r_mtx); - mtx_lock(&Giant); nfs_msg(td, nmp->nm_mountp->mnt_stat.f_mntfromname, msg, error); - mtx_unlock(&Giant); } void @@ -1901,9 +1901,7 @@ nfs_up(rep, nmp, td, msg, flags) mtx_lock(&rep->r_mtx); if ((rep->r_flags & R_TPRINTFMSG) != 0) { mtx_unlock(&rep->r_mtx); - mtx_lock(&Giant); nfs_msg(td, nmp->nm_mountp->mnt_stat.f_mntfromname, msg, 0); - mtx_unlock(&Giant); } else mtx_unlock(&rep->r_mtx); -- 2.45.2