From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF61BC0502E for ; Mon, 29 Aug 2022 03:16:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbiH2DQD (ORCPT ); Sun, 28 Aug 2022 23:16:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbiH2DQA (ORCPT ); Sun, 28 Aug 2022 23:16:00 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79C0217E0D; Sun, 28 Aug 2022 20:15:59 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 347CC3375C; Mon, 29 Aug 2022 03:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661742958; 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=tBBKmXPZz0d24U2B8Ubl7UW8mvxOKfSvEgiuL0CK338=; b=0oJkLg4Nrt9d2wio0Olr2XkavG7NvjmNYIas8bCPG97ZpoqWvbjIZx9U+UVlyvE1hBpF0r +eqoCmq2pSKWaQFkDTbm+CbbmOFwIDjmR8viS0uUwPVMXJZp63GJu1LZ/l2SmU7gm7rcc2 BUFZxB9Lo/V0d8on+gDO1wzZT5YIc34= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661742958; 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=tBBKmXPZz0d24U2B8Ubl7UW8mvxOKfSvEgiuL0CK338=; b=tno6QRbZJDTSXLrCSGOiNlz0HGCByoVPljOzZbN6a6xOnbQ0/k3wih7Ww2XWL5n7zByj7b eB/lCufqFM/LExDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A51DF133A6; Mon, 29 Aug 2022 03:15:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id FcQpGGsvDGNrIQAAMHmgww (envelope-from ); Mon, 29 Aug 2022 03:15:55 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "Al Viro" Cc: "Linus Torvalds" , "Daire Byrne" , "Trond Myklebust" , "Chuck Lever" , "Linux NFS Mailing List" , linux-fsdevel@vger.kernel.org, "LKML" Subject: Re: [PATCH 09/10] VFS: add LOOKUP_SILLY_RENAME In-reply-to: References: <166147828344.25420.13834885828450967910.stgit@noble.brown>, <166147984377.25420.5747334898411663007.stgit@noble.brown>, Date: Mon, 29 Aug 2022 13:15:52 +1000 Message-id: <166174295243.27490.1036858614514220411@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 27 Aug 2022, Al Viro wrote: > On Fri, Aug 26, 2022 at 12:10:43PM +1000, NeilBrown wrote: > > When performing a "silly rename" to avoid removing a file that is still > > open, we need to perform a lookup in a directory that is already locked. > > > > In order to allow common functions to be used for this lookup, introduce > > LOOKUP_SILLY_RENAME which affirms that the directory is already locked > > and that the vfsmnt is already writable. > > > > When LOOKUP_SILLY_RENAME is set, path->mnt can be NULL. As > > i_op->rename() doesn't make the vfsmnt available, this is unavoidable. > > So we ensure that a NULL ->mnt isn't fatal. > > This one is really disgusting. Flag-dependent locking is a pretty much > guaranteed source of PITA and "magical" struct path is, again, asking for > trouble. > > You seem to be trying for simpler call graph and you end up paying with > control flow that is much harder to reason about. > It was mostly about avoiding code duplication. I'll see if I can find a cleaner way. Thanks, NeilBrown