freebsd-src/sys/fs/nfsclient
Rick Macklem 501bdf3001 nfscl: newnfs_copycred() cannot be called when a mutex is held
Since newnfs_copycred() calls crsetgroups() which in turn calls
crextend() which might do a malloc(M_WAITOK), newnfs_copycred()
cannot be called with a mutex held.  Fortunately, the malloc()
call is rarely done, since XU_GROUPS is 16 and the NFS client
uses a maximum of 17 (only 17 groups will cause the malloc() to
be called).  Further, it is only a problem if the malloc() tries
to sleep().  As such, this bug does not seem to have caused
problems in practice.

This patch fixes the one place in the NFS client where
newnfs_copycred() is called while a mutex is held by moving the
call to after where the mutex is released.

Found by inspection while working on an experimental patch.

MFC after:	2 weeks
2023-11-06 14:25:30 -08:00
..
nfs.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
nfs_clbio.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nfs_clcomsubs.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nfs_clkdtrace.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nfs_clkrpc.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nfs_clnfsiod.c nfscl: Add sysctl flag CTLFLAG_TUN to loader tunable 2023-10-09 18:30:21 +08:00
nfs_clnode.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nfs_clport.c nfscl: Use Claim_Null_FH and Claim_Deleg_Cur_FH 2023-10-20 16:10:25 -07:00
nfs_clrpcops.c nfscl/kgssapi: Fix Kerberized NFS mounts to pNFS servers 2023-10-23 13:21:14 -07:00
nfs_clstate.c nfscl: newnfs_copycred() cannot be called when a mutex is held 2023-11-06 14:25:30 -08:00
nfs_clsubs.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nfs_clvfsops.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
nfs_clvnops.c nfscl: Use Claim_Null_FH and Claim_Deleg_Cur_FH 2023-10-20 16:10:25 -07:00
nfs_kdtrace.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
nfsmount.h nfscl: Use Claim_Null_FH and Claim_Deleg_Cur_FH 2023-10-20 16:10:25 -07:00
nfsnode.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
nlminfo.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00