From 3a54d6a8a824bad29e19a6b9cbd4be8fff46b45b Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 3 Jul 2004 19:17:06 +0000 Subject: [PATCH] Change M_WAITOK argument to sodupsockaddr() to M_NOWAIT. When the call to dup_sockaddr() was renamed to sodupsockaddr(), the argument was changed from '1' to 'M_WAITOK', which changed the semantics. This resulted in a WITNESS warning about a potential sleep while holding the NFS server mutex. Now this will no longer happen, restoring a possible bug present in the original code (setting RC_NAM even though the malloc to copy the addres may fail). bde observes that the flag names here should probably not be the same as the malloc flags for name space reasons. Bumped into by: kuriyama --- sys/nfsserver/nfs_srvcache.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/nfsserver/nfs_srvcache.c b/sys/nfsserver/nfs_srvcache.c index e82625ed6928..b41942d6407c 100644 --- a/sys/nfsserver/nfs_srvcache.c +++ b/sys/nfsserver/nfs_srvcache.c @@ -248,8 +248,12 @@ loop: /* case AF_INET6: */ /* case AF_ISO: */ default: + /* + * XXXRW: Seems like we should only set RC_NAM if we + * actually manage to set rc_nam to something non-NULL. + */ rp->rc_flag |= RC_NAM; - rp->rc_nam = sodupsockaddr(nd->nd_nam, M_WAITOK); + rp->rc_nam = sodupsockaddr(nd->nd_nam, M_NOWAIT); break; }; rp->rc_proc = nd->nd_procnum;