Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1500621pxb; Wed, 30 Mar 2022 05:07:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyU/cZtiOUYxLce2WDihP9fcbeBonPP0nNX/0XxZw5ZcIejbyoHIbLDSIBnhka+aCZaBsHk X-Received: by 2002:a05:6e02:1568:b0:2c9:cb97:973 with SMTP id k8-20020a056e02156800b002c9cb970973mr5055966ilu.132.1648642058163; Wed, 30 Mar 2022 05:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648642058; cv=none; d=google.com; s=arc-20160816; b=n/tgBmr9mxZg2MekyInF2CNHSjdMM8pc9Jcos7JJMjyzLBOfEKjjT97uegYWeT2UNn BY7QWrDwOrsEQo9AdMnSL4vCC5PbCO1VW4PpyynWELsIbmy59R8MxCJHkbWhGTm4Q/RS GIgiyyDfaK64+qOWLRqCFgJtNUiXjNvV/+SuGRz/7WyeeTLEiV83J5fmtWtUPNQvCdRj mlvsuYs75YqiUY/YRocjf/yxtsxypdAIw3QjPIli3OhPwU99dW5r9eHlcBqQ3XNfUptG EsLI2xFSwyh6VUHEat+b5jpD06zKZf8C4tt2B26jGxCZ2qdh1cn+siPF/AX9Jt8sxLva WVcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=XsTxg5YKPlAg6VXpLB31OEo9MwL2KGmC4FzYa308hZk=; b=wSlSyfDh3mUa2TGvNmhLYyWlB6VTzMv+r9Li/Lcm+TfTRH8pdappr/WDPkNNJXwz1E oe/4MrQc6XnZbkVGRd4/8/iKEIX3CpscxoK96LQhzyEyQ3cbH8aYWUq8t9Znkh8rkgo7 BvBsOMPZebEOLgIZwWZVBR/I0caVafW7vXr6pATRPGlMTI+NTwQZkmjp53bgicR+YTBQ 8P3qQmbaDJc3Focpr4hfzKWSckBuTucRKrBW8v2cggcvp5Oa12tSPR1YE2qjjvmscpQY bIcR4ALozuqmQVYz3X5LaA9MSMAhkDn8uM3d0u1o8DTJOKFoo+075O8C+aIBAv6y9j+7 X00A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hzwvvkDk; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=aPuNyrr4; 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 e12-20020a02934c000000b0032139764f23si21334384jah.130.2022.03.30.05.07.17; Wed, 30 Mar 2022 05:07:38 -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=hzwvvkDk; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=aPuNyrr4; 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 S241342AbiC3IP7 (ORCPT + 99 others); Wed, 30 Mar 2022 04:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244166AbiC3IP4 (ORCPT ); Wed, 30 Mar 2022 04:15:56 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72606D98; Wed, 30 Mar 2022 01:14:11 -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-out2.suse.de (Postfix) with ESMTPS id 053471F7AB; Wed, 30 Mar 2022 08:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1648628050; 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=XsTxg5YKPlAg6VXpLB31OEo9MwL2KGmC4FzYa308hZk=; b=hzwvvkDki5KwoetwuQRi0rywJyiFhyM18kSRZMzCZBKyUz2K456VNhk+yBnO78pFslW7/P WC6/n08+qIDET4hEPsOWvDmyriE+TaLQQHMjat+j4u6JHFq/UWTdx8o2W1hQ4zl/hjnAnK abeN9n5DO47U07XmEKcja7JX7O7UplU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1648628050; 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=XsTxg5YKPlAg6VXpLB31OEo9MwL2KGmC4FzYa308hZk=; b=aPuNyrr41TxJwLJ0dr9V88MYccDJLhjKBtaKEaP4yVFW3rBHf9e5zQqkfTYf8Xh67QLg6E lLqmS9Jja61xmiCQ== 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 CEA2213AF3; Wed, 30 Mar 2022 08:14:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QfzsMFERRGLCOQAAMHmgww (envelope-from ); Wed, 30 Mar 2022 08:14:09 +0000 Date: Wed, 30 Mar 2022 10:14:08 +0200 From: David Disseldorp To: "NeilBrown" Cc: Al Viro , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML Subject: Re: [PATCH] VFS: filename_create(): fix incorrect intent. Message-ID: <20220330101408.2bbb47ee@suse.de> In-Reply-To: <164842900895.6096.10753358086437966517@noble.neil.brown.name> References: <164842900895.6096.10753358086437966517@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Hi Neil, I gave this a spin and was wondering why xfstests wouldn't start with this change... On Mon, 28 Mar 2022 11:56:48 +1100, NeilBrown wrote: ... > > diff --git a/fs/namei.c b/fs/namei.c > index 3f1829b3ab5b..3ffb42e56a8e 100644 > --- a/fs/namei.c > +++ b/fs/namei.c > @@ -3676,7 +3676,6 @@ static struct dentry *filename_create(int dfd, struct filename *name, > int type; > int err2; > int error; > - bool is_dir = (lookup_flags & LOOKUP_DIRECTORY); > > /* > * Note that only LOOKUP_REVAL and LOOKUP_DIRECTORY matter here. Any > @@ -3698,9 +3697,11 @@ static struct dentry *filename_create(int dfd, struct filename *name, > /* don't fail immediately if it's r/o, at least try to report other errors */ > err2 = mnt_want_write(path->mnt); > /* > - * Do the final lookup. > + * Do the final lookup. Request 'create' only if there is no trailing > + * '/', or if directory is requested. > */ > - lookup_flags |= LOOKUP_CREATE | LOOKUP_EXCL; > + if (!last.name[last.len] || (lookup_flags & LOOKUP_DIRECTORY)) > + lookup_flags |= LOOKUP_CREATE | LOOKUP_EXCL; This doesn't look right, as any LOOKUP_DIRECTORY flag gets dropped via the prior "lookup_flags &= LOOKUP_REVAL;". Cheers, David