Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2712171rwe; Sun, 28 Aug 2022 20:40:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR652huNfLwh/wmQkw2d7oaKaYjiMZrp/bzl4u31VHl35ho6VAZQnnF4/d67XBbthtrVcUpC X-Received: by 2002:a17:902:cf0c:b0:16f:9023:e07b with SMTP id i12-20020a170902cf0c00b0016f9023e07bmr14413406plg.143.1661744458150; Sun, 28 Aug 2022 20:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661744458; cv=none; d=google.com; s=arc-20160816; b=qZN8YdYFAWHdZ/mSEGfJn52Bq2pw/lbIupU8XdqTw+9z+6bA0L4tHf5ipaFoQdJjht yZSANcPJGgbx8OZ/pOzCOpwkpN9qHY0krigvHfFIf0kRvFR+/sJ7QuM8iGpVJ74y00mC YiALdhIqML6/PhwPkmaQVWOcvzYpQrxJdmCypmDyxY8671LwKoWLiR/pO0aWRMlhEvw7 06n8SNABcr3n8gD+aoiYGeaq6rf2FYQB9i/WbRtHkYOuXnSmpEGtu1+556pZ+wRtGznz joNMC32EKRcMVSeT51sFXIW3y+LxM//ZN/bQvlGVOHROAdhQxLkbaAUVopYsHUHEyQ8j /FFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=tBBKmXPZz0d24U2B8Ubl7UW8mvxOKfSvEgiuL0CK338=; b=eitSAdOmVzFKA9KiFp3RRMbapMW59+jrvG5cPw4lfp7l7kzxoy1TXlj9mTb38ZSVUg uQcq79uRCht6ffbUvm/fM7HS7iwhKWNMdCszU4zzMp8jzPLRKOAnTt8qEes6/NLG92cy /IcguH2rBwnOB9IU1GS1DeT+EcYB0SyXLoHIywjTEEPtW9MxQbvCqGogZwy8XIERdxQg qedlBx4tGkk1oNGPlkpW2VCd+cfsWpK6z8C0v1eF7XSNE4PT0hPb/zJAbSK6Z9Ogkwc1 gcaOaUxXCoVKg4G4kTkwEEIArGSp/D+6s+CThPTHY9X+3ltvdohgh3aFk3+jw90av7UF 5YZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=0oJkLg4N; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a17090abc0b00b001fdc88d6be7si2046088pjr.111.2022.08.28.20.40.39; Sun, 28 Aug 2022 20:40:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=0oJkLg4N; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbiH2DQB (ORCPT + 99 others); Sun, 28 Aug 2022 23:16:01 -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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@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