Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5005692rdb; Tue, 12 Dec 2023 16:28:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZh+hn2uxbQ9EAx/3nmUSuDAn59KBK4s0mHAFwEoywj5INQxVDoaM41w+zHwgRw6Lh4kXX X-Received: by 2002:a17:90b:19d8:b0:286:7ec2:df49 with SMTP id nm24-20020a17090b19d800b002867ec2df49mr8561327pjb.9.1702427304556; Tue, 12 Dec 2023 16:28:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702427304; cv=none; d=google.com; s=arc-20160816; b=vDtc5DBXXVaC150FesOD20mMV7hsL3g/T3ALz6dQa4y9vKYdRz+y3mG5DF8B2E6do9 s5pz76PKPp0MP13iVrjSz8jhPQ49SK39KMIQnLkWC3qvwBAvfMeFIhe58AUsa+wpKLj5 cB7dOXbH/YJF9v5IBsnYbf5b34UDE6Zcp3Hm2Cpy32q/BDxVKUVzdA7paD2t5YC4r16Y p7yAphZ8Uf+QhRZyYfSZH6ALDFQuGqxXOJ0MXVEmvgJsQXvhLEiuOfbLrT0mfovmsL0H fMkzh3I8+uKyhjkcb9MCtv2v3xBB2veYba6Z+RS9WktU3M1VMaNRoZWkg4T6ediIZCgX ZXTg== 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 :dkim-signature:dkim-signature; bh=nk1IyI/Qw8q4KfaqeA0p6yZTB4fXE68g6N6s8m6YJss=; fh=Fqw1halGKFGLpMuh9H5PoyYmKKkoxddxMgMhSYoqjpg=; b=oOkj2l5LMbwqPbjDOnPSUnsC9mdqn5NwnajRV37Z46foG12IkGttyVpntU0nFAAB2P poX73aIuQFRJr3+mid5kmZ/HfVsM0aD+z6Pu2u2n0DMKE+NNlrvQfQ6VpVRj+snGRgDb 0fxn5dJfZwitZpt0zaP8rc83qgsIzIqT6G1WWbIZ0cbucb+05XIYk6ZPb/0uUbm+DLYZ a51VHm2rt94OQoyYCgCz9n1d7HP7Q4hyrwhalI+yw0mZPuTb8Fr+1moe/JEflN1EZSgH Iuz4ODFrpJCZrwCMgJelnRzCkWqJ2CwCalxDX6ooCWX5Y+TOz6MzGVq+VqF3xetR8ptQ TcyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=sbO4uE9g; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=sbO4uE9g; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=wrw+HDkO; spf=pass (google.com: domain of linux-nfs+bounces-508-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-nfs+bounces-508-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o7-20020a17090aac0700b0028ae55d2947si70509pjq.166.2023.12.12.16.28.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 16:28:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-508-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=sbO4uE9g; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=sbO4uE9g; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=wrw+HDkO; spf=pass (google.com: domain of linux-nfs+bounces-508-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-nfs+bounces-508-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1D8ADB20C10 for ; Wed, 13 Dec 2023 00:28:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0E9065C; Wed, 13 Dec 2023 00:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="sbO4uE9g"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="wrw+HDkO"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="sbO4uE9g"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="wrw+HDkO" 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 EFC58AD; Tue, 12 Dec 2023 16:28:12 -0800 (PST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 567BA1FD04; Wed, 13 Dec 2023 00:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702427291; 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=nk1IyI/Qw8q4KfaqeA0p6yZTB4fXE68g6N6s8m6YJss=; b=sbO4uE9gS9knOM9eF/X/gHFAtd5CarW7KjoagfnTy66elmcq1gl8I4xLP+RiVfMnApK9B0 vBgjAsHAg/GJSL2cgTJXxB3vR5ZBbBvnYz/AOcRhWFcZwR7qAYpFnMg9s4Ph3y6fSpcxjk vQWmMNuOPgPl7jqpcWeYASpxB8eqSQI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702427291; 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=nk1IyI/Qw8q4KfaqeA0p6yZTB4fXE68g6N6s8m6YJss=; b=wrw+HDkOAM35jSetsfybXlJ0VUlo+g3B8JEf53EawQqIf8Jkq8jFf+OJRpWTQhRCIawUa6 S3ZGW6grbkruPlDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702427291; 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=nk1IyI/Qw8q4KfaqeA0p6yZTB4fXE68g6N6s8m6YJss=; b=sbO4uE9gS9knOM9eF/X/gHFAtd5CarW7KjoagfnTy66elmcq1gl8I4xLP+RiVfMnApK9B0 vBgjAsHAg/GJSL2cgTJXxB3vR5ZBbBvnYz/AOcRhWFcZwR7qAYpFnMg9s4Ph3y6fSpcxjk vQWmMNuOPgPl7jqpcWeYASpxB8eqSQI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702427291; 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=nk1IyI/Qw8q4KfaqeA0p6yZTB4fXE68g6N6s8m6YJss=; b=wrw+HDkOAM35jSetsfybXlJ0VUlo+g3B8JEf53EawQqIf8Jkq8jFf+OJRpWTQhRCIawUa6 S3ZGW6grbkruPlDg== 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 19DDF137E8; Wed, 13 Dec 2023 00:28:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2nf1LZf6eGXuPAAAD6G6ig (envelope-from ); Wed, 13 Dec 2023 00:28:07 +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: "Al Viro" Cc: "Chuck Lever" , "Christian Brauner" , "Jens Axboe" , "Oleg Nesterov" , "Jeff Layton" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org Subject: Re: [PATCH 1/3] nfsd: use __fput_sync() to avoid delayed closing of files. In-reply-to: <20231211232135.GF1674809@ZenIV> References: <20231208033006.5546-1-neilb@suse.de>, <20231208033006.5546-2-neilb@suse.de>, , <170224845504.12910.16483736613606611138@noble.neil.brown.name>, <20231211191117.GD1674809@ZenIV>, <170233343177.12910.2316815312951521227@noble.neil.brown.name>, <20231211231330.GE1674809@ZenIV>, <20231211232135.GF1674809@ZenIV> Date: Wed, 13 Dec 2023 11:28:04 +1100 Message-id: <170242728484.12910.12134295135043081177@noble.neil.brown.name> X-Spam-Level: X-Spam-Score: -4.01 X-Spam-Level: X-Rspamd-Server: rspamd1 X-Rspamd-Queue-Id: 567BA1FD04 X-Spam-Flag: NO Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=sbO4uE9g; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=wrw+HDkO; dmarc=pass (policy=none) header.from=suse.de; spf=softfail (smtp-out2.suse.de: 2a07:de40:b281:104:10:150:64:97 is neither permitted nor denied by domain of neilb@suse.de) smtp.mailfrom=neilb@suse.de X-Spamd-Result: default: False [-11.81 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; R_SPF_SOFTFAIL(0.00)[~all:c]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; DMARC_POLICY_ALLOW(0.00)[suse.de,none]; RCPT_COUNT_SEVEN(0.00)[9]; WHITELIST_DMARC(-7.00)[suse.de:D:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim]; DMARC_POLICY_ALLOW_WITH_FAILURES(-0.50)[]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Score: -11.81 On Tue, 12 Dec 2023, Al Viro wrote: > On Mon, Dec 11, 2023 at 11:13:30PM +0000, Al Viro wrote: > > > dentry_kill() means ->d_release(), ->d_iput() and anything final iput() > > could do. Including e.g. anything that might be done by afs_silly_iput(), > > with its "send REMOVE to server, wait for completion". No, that's not > > a deadlock per se, but it can stall you a bit more than you would > > probably consider tolerable... Sure, you could argue that AFS ought to > > make that thing asynchronous, but... > > > > Anyway, it won't be "safe to use in most contexts". ->mmap_lock alone > > is enough for that, and that's just the one I remember to have given > > us a lot of headache. And that's without bringing the "nfsd won't > > touch those files" cases - make it generally accessible and you get > > to audit all locks that might be taken when we close a socket, etc. > > PS: put it that way - I can buy "nfsd is doing that only to regular > files and not on an arbitrary filesystem, at that; having the thread > wait on that sucker is not going to cause too much trouble"; I do *not* > buy turning it into a thing usable outside of a very narrow set of > circumstances. > Can you say more about "not on an arbitrary filesystem" ? I guess you means that procfs and/or sysfs might be problematic as may similar virtual filesystems (nfsd maybe). Could we encode some of this in the comment for __fput_sync ?? /** * __fput_sync : drop reference to a file synchronously * @f: file to drop * * Drop a reference on a file and do most cleanup work before returning. * * Due the the wide use of files in the design of Linux, dropping the * final reference to a file can result in dropping the final reference * to any of a large variety of other objects. Dropping those final * references can result in nearly arbitrary work. It should be assumed * that, unless prior checks or actions confirm otherwise, calling * __fput_sync() might: * - allocate memory * - perform synchronous IO * - wait for a remote service (for networked filesystems) * - take ->i_rwsem and other related VFS and filesystem locks * - take ->s_umount (if file is on a MNT_INTERNAL filesystem) * - take locks in a device driver if the file is CHR, BLK or SOCK * * If the caller cannot be confident that none of these will cause a * problem, it should use fput() instead. * * Note that the final unmount of a lazy-unmounted non-MNT_INTERNAL * filesystem will always be handled asynchronously. Individual drivers * might also leave some clean up to asynchronous threads. */ Thanks, NeilBrown