Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1651817rwp; Thu, 13 Jul 2023 14:24:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQ5X1dbad3KJR4qMTES++adMLgf96/FojB3XO8hhaZU2ho62RoC6p7tq3lITzQiLkYihhD X-Received: by 2002:a17:902:db10:b0:1b9:d36a:904b with SMTP id m16-20020a170902db1000b001b9d36a904bmr2460900plx.61.1689283467792; Thu, 13 Jul 2023 14:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689283467; cv=none; d=google.com; s=arc-20160816; b=e/goP6+QMOm20auPmNP+HMVqCpfBnICVkRmIoLLpAiSIuVFaEKCZXhUYidOz8g/dM1 AHo0gYXAxjJZqapLUcgXSuD95DNYtxPRfGMbz8dVlKOoM9qMiwOrfPh28AbqSOdgsxuZ 6wLdEytX1A2AYDJVYQVrSrJs+2hNpN6VZVKu79BXUbsNGL2+9KwzVbpUFwt2TyNnP9Q7 oXq5Zsk+nRLgJ0qZq4O8i0BjYDnRYJMccc06Kjq2IF112383L91H7ZNcl5d4ZNMP1wos XV0Tqpyy1oXeGq7BJC2kSXCcEFfwM+P++Oy66cs1xUr19K8qnXSKGBoPTbQon7o9N/ro +Qjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VZoITxF+ua2OfyW0hJ0EIfcYz3eQ5iXLvJSOoFtgY8A=; fh=v+qhCvrt4w9QQ2cETHMA15mP2uMsMeuqkma4G8omVv4=; b=xZ/hdzPRjO8tWyBVqhRPoIBaFniwpxvubrfs/ruprg4/fEzkDZpH1Zwi5fHE8dG9dO 4IIcJ8w4+eiJS3Q+ffo2GgOezegftd1FuUbyKFrxYJClIZkEsl6F0XGTtDjjEBTuXMgP FGNUrCrYqrW4R0t5ZWFWAV+Fy28x1Q24WvpuOC40k3+y0wZd6O+FduStxCj20/pvtmOq x1FdzBhqRM8nec54Pj2lfa1+qaEGESLV7Tnx4r+Y1UcxCH76V6OWYalm9dXFdc7DmvmI DpLzYM6g02O1EZSQMUlQai2UnPusMd3lqgYkJ/XgF1NS132QVK94r+2Bmdpk0+1fH1NC lzVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h4oIJoLE; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a170902e88a00b001b7e19195b7si6044130plg.29.2023.07.13.14.24.14; Thu, 13 Jul 2023 14:24:27 -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=@redhat.com header.s=mimecast20190719 header.b=h4oIJoLE; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232141AbjGMVRo (ORCPT + 99 others); Thu, 13 Jul 2023 17:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbjGMVRn (ORCPT ); Thu, 13 Jul 2023 17:17:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BFCF26A3 for ; Thu, 13 Jul 2023 14:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689283015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VZoITxF+ua2OfyW0hJ0EIfcYz3eQ5iXLvJSOoFtgY8A=; b=h4oIJoLEGuCk6w0GxFoT4kxd+wK4TWxXWCkQl+4gte8NZWtVxBawa3p91m0L32vlDuJO58 h1/decqAZJl1cCBl0BY6unBR7+WrspmgnS9Vo03PUM5w+wNYGOKdPr2Ot9gMzn5WPY9wfC 0aokU7Jo5uWSQqgQqj2UV8o6hKk7DZY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-178-BofHDRimNNCEexSVA-bdYw-1; Thu, 13 Jul 2023 17:16:51 -0400 X-MC-Unique: BofHDRimNNCEexSVA-bdYw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2614E8D1680; Thu, 13 Jul 2023 21:16:51 +0000 (UTC) Received: from [192.168.37.1] (unknown [10.22.50.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66001207B320; Thu, 13 Jul 2023 21:16:50 +0000 (UTC) From: Benjamin Coddington To: Olga Kornievskaia Cc: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, linux-nfs@vger.kernel.org Subject: Re: [PATCH 1/1] NFSv4.1: fix zero value filehandle in post open getattr Date: Thu, 13 Jul 2023 17:16:49 -0400 Message-ID: <2C013A73-79B2-446E-885B-33EF05916CCA@redhat.com> In-Reply-To: References: <20230713195416.30414-1-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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 13 Jul 2023, at 17:08, Benjamin Coddington wrote: > On 13 Jul 2023, at 15:54, Olga Kornievskaia wrote: > >> From: Olga Kornievskaia >> >> Currently, if the OPEN compound experiencing an error and needs to >> get the file attributes separately, it will send a stand alone >> GETATTR but it would use the filehandle from the results of >> the OPEN compound. In case of the CLAIM_FH OPEN, nfs_openres's fh >> is zero value. That generate a GETATTR that's sent with a zero >> value filehandle, and results in the server returning an error. >> >> Instead, for the CLAIM_FH OPEN, take the filehandle that was used >> in the PUTFH of the OPEN compound. >> >> Signed-off-by: Olga Kornievskaia >> --- >> fs/nfs/nfs4proc.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >> index 8edc610dc1d3..0b1b49f01c5b 100644 >> --- a/fs/nfs/nfs4proc.c >> +++ b/fs/nfs/nfs4proc.c >> @@ -2703,8 +2703,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data, >> return status; >> } >> if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) { >> + struct nfs_fh *fh = &o_res->fh; >> + >> nfs4_sequence_free_slot(&o_res->seq_res); >> - nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, NULL); >> + if (o_arg->claim == NFS4_OPEN_CLAIM_FH) >> + fh = NFS_FH(d_inode(data->dentry)); >> + nfs4_proc_getattr(server, fh, o_res->f_attr, NULL); >> } >> return 0; >> } > > Looks good, but why not just use o_arg->fh? Maybe also an opportunity > to fix the whitespace damage a few lines before this hunk too. > > Reviewed-by: Benjamin Coddington .. and should we handle the other OPEN_CLAIM cases that use the filehandle as well? Ben