Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4214525rdh; Tue, 28 Nov 2023 15:31:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1v+m5oWBcpzPg+elxo33Oi0gqzDqopMhyjlNiNbjaHMFtf9C2pk4r2IBzIrGKa6yvFT8e X-Received: by 2002:ac8:7d12:0:b0:423:792f:d5ca with SMTP id g18-20020ac87d12000000b00423792fd5camr22147234qtb.63.1701214305947; Tue, 28 Nov 2023 15:31:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701214305; cv=none; d=google.com; s=arc-20160816; b=ik6VuY24S+iSA/qu7MQXx7ofhXFvLQutuSOjAyzAWkUOAd7++IjdExerID3cOUVe4v KSQgXNi3v+G/MdGUKpk98DbZKQ+luqR9Y2UZb/iaxW6ev0eJfyeV7dtOqpfB22HVjeWB KJ7C3S0V6shiRufXnVejBFEXQtbguC9Nv9+5zX3Y/ROQy2a/Z5DE9uCZP01JVdwntTHC dTc3ZHfYVIQgT7lYGICUljbEIBRH44A0dCu6Wheyu08WmK1U8+C18ZWg7OsciWe49DCJ Wb2crbUh18ctNEY+10U5kQnZ8Q0rJK7C28y1Kf8UEqWsvfCVPIH3tAjrGkcnMoe6nB2v S5Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:references:in-reply-to:subject:cc:to:from :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:dkim-signature:dkim-signature; bh=jhtBuDaZGYA819mpouZcxSxxgJoRCLewkkNQb5qq+ak=; fh=DGWfcNZrbezgznOPGW7EIZOI/0MzixmRHDzh/fzdxk8=; b=j1vrNl8Ah+X5wjSvzHvBv1mfRZqxUhYCoWJrHFctC86tqsQ6ZWFdihQauPBE3ozZG4 2BhPDM5TsHnluFal8tNFx5LTO+NZYcdtG1arKiuAcZV6Zw+42bP4zxGUIu8eCfYkhq2G 5sZM2WPQV6lTOwrhSSVk3aP+nEvu8qkX6OuqgJK2d11Iyijl75nULkVg05Apjkv7UI/q vm0mUlLkRTJe12Kw6C/11SzOlcLD/7/IfScjHvtkxzZG4JPWO6RxPnHuMTroMAT/Q1/T aeSg6IojAb7+pEN2/w2/D6Q2/D4kanm7d4sZBlWfq0p4L5ixnICz/1Q+c4uPsbqE8pLf TYIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DItGLTbA; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=jY4I5ejm; spf=pass (google.com: domain of linux-nfs+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f19-20020a05622a105300b004236f52e8d1si12622653qte.232.2023.11.28.15.31.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 15:31:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DItGLTbA; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=jY4I5ejm; spf=pass (google.com: domain of linux-nfs+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9F00E1C20CF7 for ; Tue, 28 Nov 2023 23:31:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7E8A58AB2; Tue, 28 Nov 2023 23:31:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DItGLTbA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="jY4I5ejm" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6A101AD; Tue, 28 Nov 2023 15:31:38 -0800 (PST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1EAD41F898; Tue, 28 Nov 2023 23:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1701214296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jhtBuDaZGYA819mpouZcxSxxgJoRCLewkkNQb5qq+ak=; b=DItGLTbAaAMYDM9LJCQSj619BbDcAxCPE6J8TDRdH7N2nffEuOa0O5dxPHUV7YF5k8dQ6Q EBtmO2q18FuKLYBnoVIEujaOo421wJDL7pXkWRC+QEd6LK5X0lLkB8icLwbZx3ujg34MkS P3R9qSgriY9ZoWptcQyGVQm+mRWnWxQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1701214296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jhtBuDaZGYA819mpouZcxSxxgJoRCLewkkNQb5qq+ak=; b=jY4I5ejmx/t9jlh1zSn6SEjz+2pLcB/a0Y3mg1rPbJPnnp5KFl1VspmnrF4qEyg1VVXapT InIUpp9YrlhQ8ACw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C4BE913763; Tue, 28 Nov 2023 23:31:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id jHFRHFV4ZmUFWgAAD6G6ig (envelope-from ); Tue, 28 Nov 2023 23:31:33 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "NeilBrown" To: "Jeff Layton" Cc: "Christian Brauner" , "Al Viro" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org Subject: Re: [PATCH/RFC] core/nfsd: allow kernel threads to use task_work. In-reply-to: <518775f9f9bd3ad1afec0bde4d0a6bee3370bdd4.camel@kernel.org> References: <170112272125.7109.6245462722883333440@noble.neil.brown.name>, , <170113056683.7109.13851405274459689039@noble.neil.brown.name>, <20231128-blumig-anreichern-b9d8d1dc49b3@brauner>, <518775f9f9bd3ad1afec0bde4d0a6bee3370bdd4.camel@kernel.org> Date: Wed, 29 Nov 2023 10:31:30 +1100 Message-id: <170121429051.7109.6920588851658122847@noble.neil.brown.name> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spamd-Result: default: False [-1.29 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.19)[-0.952]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[12.59%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -1.29 On Wed, 29 Nov 2023, Jeff Layton wrote: > > This is another place where we might want to reserve a "rescuer" thread > that avoids doing work that can end up blocked. Maybe we could switch > back to queuing them to the list when we're below a certain threshold of > available threads (1? 2? 4?). A rescuer isn't for cases where work might be blocked, but for cases whether otherwise work might be deadlocked - though maybe that is what you meant. Could nfsd calling filp_close() or __fput() ever deadlock? I think we know from the experience pre v5.8 that calling filp_close() doesn't cause deadlocks. Could __fput, and particularly ->release ever deadlock w.r.t nfsd? i.e. could a ->release function for a file exported through NFS ever wait for nfsd to handle an NFS request? We don't need to worry about indirect dependencies like allocating memory and waiting for nfsd to flush out writes - that is already handled so that we can support loop-back mounts. So to have a problem we would need to nfs-export an NFS filesystem that was being served by the local NFS server. Now that we support NFS re-export, and we support loop-back mounts, it is fair to ask if we support the combination of the two. If we did, then calling ->release from the nfsd thread could deadlock. But calling ->read and ->write (or whatever those interfaces are called today) would also deadlock. So I think we have to say that nfs-reexporting a loop-back NFS mount is not supported, and not supportable. Whether we should try to detect and reject this case is an interesting question, but quite a separate question from that of how to handle the closing of files. In short - I don't think there is any need or value in a dedicated "rescuer" thread here. Thanks, NeilBrown