Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1702238ybh; Tue, 14 Jul 2020 05:14:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPpRX5RZc/KVIBQbvsN3CcobybrGTZ4nCGjpCbamgpQMhg8BZHUGCKvJguVgqBYZjrPIlN X-Received: by 2002:a17:907:4420:: with SMTP id om24mr4155645ejb.10.1594728869685; Tue, 14 Jul 2020 05:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594728869; cv=none; d=google.com; s=arc-20160816; b=sewq9zip084i8q4WaFhWx3w4itAhxt2fxRGZ3AOkVh368ci5ZcZ7Lf046qHqXXQTj1 6X85BUXFODsirNPrp80YFXeqb+GpKpLkoPsERFxIcy3BfQjdRIUr7ZxT2zffU70gHdKN bPc7d96w7/OeiXVyisw77KnKKskuLPH3SpTvkBC4fLS7as0PXCmhrQ3ZPW9pFYV0ebSl BgEvwQnSY2DjKObtxfTLwEKRnJ1uJMjDdQtL0FQXIfxihbM7I6oA6s3+nXLsJF3a/Vir lI9iSKEdKnUe8jREdk+Me5rxxzm1n5DehhiiisK/URg7T1CMipo17XDnjkmb5XzjNWp4 Tt/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=dbM7QhdQH+BOGMhLWa7O6b96M53JJLuDNJ3jghm2BOQ=; b=uThUpXG/2CN3iILovLSByE6np/M9H+fSXc1INRhC+WCP/9WHvLJqL6uJOQPO4nj6sT hTtXPeTzVC4yRSky8f9dyY8b+TNP94FOrNEpNpHOj1JRT3d/uxQI2xIHfVKBAs7qQsuX fpfwsSc/hpSJYXl3S5+pV39thKidgyt2tPWD7e8GAOqX6RBelCjmfnJpFFnC2/TPpljz 2me3suoDVL4fToGR1BPUfjoNXmR8BEpc5qDFgEyfqQ9cxTqD8Wut2MLpXzBetJUqQ8zu p4qCuTT3QfmrNb4s67768pjGAQ+YkqcMWA9LNT4AXc0qDXqqLbKSHgN/ppCMar17RutD 83Vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt4si13063772ejc.34.2020.07.14.05.14.04; Tue, 14 Jul 2020 05:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728784AbgGNMNI (ORCPT + 99 others); Tue, 14 Jul 2020 08:13:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728252AbgGNMNH (ORCPT ); Tue, 14 Jul 2020 08:13:07 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7E16C061755 for ; Tue, 14 Jul 2020 05:13:06 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 1001) id C9AB1C01B; Tue, 14 Jul 2020 14:13:04 +0200 (CEST) Date: Tue, 14 Jul 2020 14:12:49 +0200 From: Dominique Martinet To: Victor Hsieh Cc: v9fs-developer@lists.sourceforge.net, Eric Van Hensbergen , Latchesar Ionkov , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] fs/9p: Fix TCREATE's fid in protocol Message-ID: <20200714121249.GA21928@nautica> References: <20200713215759.3701482-1-victorhsieh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200713215759.3701482-1-victorhsieh@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Victor Hsieh wrote on Mon, Jul 13, 2020: > The fid parameter of TCREATE represents the directory that the file This is not TCREATE, this is TLCREATE. The fid represents the directory before the call, but on success represents the file that has been created. > should be created at. The current implementation mistakenly passes a > locally created fid for the file. The correct file fid is usually > retrieved by another WALK call, which does happen right after. > > The problem happens when a new created fd is read from (i.e. where > private_data->fid is used), but not write to. I'm not sure why the code currently does a 2nd walk from the directory with the name which is prone to a race instead of cloning ofid without a path, but I fail to see the problem you ran into - file->private_data is a fid pointing to the file as it should be. Could you describe what kind of errors you get and if possible how to reproduce? > Fixes: 5643135a2846 ("fs/9p: This patch implements TLCREATE for 9p2000.L protocol.") > Signed-off-by: Victor Hsieh > Cc: stable@vger.kernel.org (afaiu it is normally frowned upon for developers to add this cc (I can understand stable@ not wanting spam discussing issues left and right before maintainers agreed on them!) ; I can add it to the commit itself if requested but they normally pick most such fixes pretty nicely for backport anyway; I see most 9p patches backported as long as the patch applies cleanly which is pretty much all the time. Please let me know if I understood that incorrectly) > --- > fs/9p/vfs_inode_dotl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c > index 60328b21c5fb..90a7aaea918d 100644 > --- a/fs/9p/vfs_inode_dotl.c > +++ b/fs/9p/vfs_inode_dotl.c > @@ -285,7 +285,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, > err); > goto error; > } > - err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), > + err = p9_client_create_dotl(dfid, name, v9fs_open_to_dotl_flags(flags), > mode, gid, &qid); > if (err < 0) { > p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n",