On Mon, May 23, 2022 at 02:38:02PM +0200, Vincent Whitchurch wrote: > On Mon, Feb 14, 2022 at 10:19:30PM +0530, Shyam Prasad N wrote: > > It's about a circular dependency locking fs_reclaim lock with srv_mutex held. > > Does someone here understand this dependency? > > The crypto shash allocation does allocations with GFP_KERNEL (i.e., > GFP_NOFS is not set and so fs reclaim can be triggered) and this is > called under the CIFS srv_mutex. However, the CIFS srv_mutex is also > used in the reclaim path as the splat shows. This is the dependency > which lockdep is complaining about. > > A way to remove this particular dependency is to make CIFS do a > memalloc_nofs_save/restore() around the places it takes the srv_mutex. > However, doing this does not solve the lockdep splats completely since > there is another dependency via some internal locks in crypto, see the > log below. I have now sent out a patch to use memalloc_nofs_*. There are other GFP_KERNEL allocations in CIFS done under the srv_mutex (such as the one in SMB2_sess_auth_rawntlmssp_negotiate()) besides the shash allocations, so that patch is needed even if something is done later to move the crypto shash allocations out of that mutex. https://lore.kernel.org/linux-cifs/20220530132155.4019006-1-vincent.whitchurch@xxxxxxxx/