Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp998311rwe; Fri, 26 Aug 2022 20:56:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR7tOctc1QtkoQJ1y5yjqPZx0sp1tcO+KUhF2xRygxIa8DfjD15tQfO2i9/gOqrxjTdfrldV X-Received: by 2002:a05:6a00:1907:b0:534:f847:b495 with SMTP id y7-20020a056a00190700b00534f847b495mr6832256pfi.47.1661572561529; Fri, 26 Aug 2022 20:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661572561; cv=none; d=google.com; s=arc-20160816; b=EGnG3VaBhDJkoknTIut2C/QYxDLHEHHGXAauu2K1Y15/q0o9tx0Y9C6eA1kx08NEa9 vwK9RNJBatRcGyGfV5kHuPIW6G9C74buj+rGtLfAIdLLZSQ/PAzwgx6shHeR4ih7Lnm4 obua/R/MD2KLDrb2m82dpRxKbMyxIPk57XKAQiVTFKzBfcTf/jt5dk7mxJI3MD/2quFx QySiUDeOnikeudv6LflRI/U9L+zEk2BUY83jVSHb7nXouw141ABDTaIGpkv3Flgf3MfR /I2YIon3OtKtrGBb6L7eApuvWv4Gru/vXqCCw3dgZ/c4h/GZWTb/50PhfyjKeWfjAkZW Rbsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=NYtf56mRPMxzipwSaPrwtpkE4cZWx2aqkuOobXv08A8=; b=sNnwJcVuadkKGywtwZ0J9YLGrgn1oZ2FIp073U3rCsK0+ueesuNEM7Ll9I6aCOCB5v El/V3xzO1NRT/aITnmgrH8GOzv2rYUEQHgUnrbmLNyTk+gQYkrpT/aXWJz8hQ0yeXBDC fgbXmNVAvip3cSojeKHzGKpmy08rs+feQO6QGJFNkbscs+j+3gQxQm2lkZKvU22uC7CY PZNIMPSzoSczqxEL+Zm5gSi19NUzlCTfkiNSD510OBj8nf1CMd8rEErwYUJeUOqMnjKW rrKxGTNLhQAVj8wFp36F40y52+tK7FHJf9XNH4wGf0BfEwX3lWETv9j3lpraYNVM9TGW O0+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=k6BrKfkH; 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=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u185-20020a6385c2000000b004160307346esi3155475pgd.687.2022.08.26.20.55.49; Fri, 26 Aug 2022 20:56:01 -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=@linux.org.uk header.s=zeniv-20220401 header.b=k6BrKfkH; 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=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231629AbiH0Dsg (ORCPT + 99 others); Fri, 26 Aug 2022 23:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiH0Dsf (ORCPT ); Fri, 26 Aug 2022 23:48:35 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B639A5994; Fri, 26 Aug 2022 20:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NYtf56mRPMxzipwSaPrwtpkE4cZWx2aqkuOobXv08A8=; b=k6BrKfkH9ROqbDLZXqqfQZQA+K DWTJy/IEp+/DTPX/yof8JnRJYISooHM9T1R0+LNxQjHyYZNwN/RIOLT5BEvpE6juotgBJ+0TJlK55 HC4NiW3sWKKHDCI4cQG+wrXy2SSY9sLEkNdgZvCEiWNvoasLxNO3PicclqExYyhEdtXoj3+sDVGoB MH3uycrGoMhwAJN4zluTWL7j+yxi63oFjPfMBaKYHtWQEsvedtY8aNcCMkfxKFGPMFsBkfZVFe+xl NUf5Zm6GGV5FonFmrVMWql1XfhAiR4jZchRYXuYZQ0E+CIkpUoe4s3uQ628VYd0muSOR48rFU8sU/ DsjWNSXQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1oRmo7-008rgz-9h; Sat, 27 Aug 2022 03:48:27 +0000 Date: Sat, 27 Aug 2022 04:48:27 +0100 From: Al Viro To: NeilBrown Cc: Linus Torvalds , Daire Byrne , Trond Myklebust , Chuck Lever , Linux NFS Mailing List , linux-fsdevel@vger.kernel.org, LKML Subject: Re: [PATCH 03/10] VFS: move want_write checks into lookup_hash_update() Message-ID: References: <166147828344.25420.13834885828450967910.stgit@noble.brown> <166147984374.25420.3477094952897986387.stgit@noble.brown> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <166147984374.25420.3477094952897986387.stgit@noble.brown> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE,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 Fri, Aug 26, 2022 at 12:10:43PM +1000, NeilBrown wrote: > mnt_want_write() is always called before lookup_hash_update(), so > we can simplify the code by moving the call into that function. > > If lookup_hash_update() succeeds, it now will have claimed the > want_write lock. If it fails, the want_write lock isn't held. > > To allow this, lookup_hash_update() now receives a 'struct path *' > instead of 'struct dentry *' > > Note that when creating a name, any error from mnt_want_write() does not > get reported unless there is no other error. For unlink/rmdir though, > an error from mnt_want_write() is immediately fatal - overriding ENOENT > for example. This behaviour seems strange, but this patch is careful to > preserve it. Would be a nice idea, if not for the mess with LOOKUP_SILLY_RENAME later in the series...