Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1344319ybn; Wed, 2 Oct 2019 14:45:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzGM+sfQjLRHVpQm/etfZbw+2xCzrb5ed+1+OCJnOLAt260U74KTClV0pCB5Tu3XzfcTVx X-Received: by 2002:a50:ab49:: with SMTP id t9mr6103841edc.301.1570052721376; Wed, 02 Oct 2019 14:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570052721; cv=none; d=google.com; s=arc-20160816; b=UcWzWS4yIuIYB0pupEP/Rsx9aK0Cd+XndgDhDSWpilCobQY0f8fEmdIZzZkHiEWVru OFp6jpZci3oyD+/dYr2A249xrWSBjuoo+3gHI8HDNLwhJRUomfRqoFnCAfcoulkZhSM7 vQakhhWq+VzKVHkq0liSle2J2oW9YK2wsYMlIxcpnmAxjzDsNxpRCW68ZNQ7dDpPkGlV M8djcA+YpD8nhz9R6SMwaYDYboOejLU4rKQDEosacdyJl3VBGZsg28FaJKlq0SebXvz/ 8Gvb2soNGk/iIDsQXv95liD3KPS+Y+gzwlmSa6e1H0SyzPEDb2Ch/hPI3cvCpd+pB/ZH lzNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date; bh=AZDg51T1iQ85jzd4QyeTR/lOHEdjKWODE+d+NM6Vye8=; b=cPsWu/soLhumPD82NzhgCPw7qr4JIosYJ3uzWb8YwbhZbFrMhkZoM2yqYSZM3Pnao2 Gev1tExAo1/09EDnzVByNrP8IvWJdof59brcADRen3EeFDxEdv9yIYprBpJ0N/NIb8C/ jZJj6IF5ZMI6o1Bsn1N0hRkZYihrI8k7VrRXMfCHYzSNA9/tQ91tYAnKXmHNI3KbRI2W ncnnCumOIZY3m11yx2jSUNZfwJjwsv/hGZs8RiEC/znduF2CxtNfVvKwPhTIq9Sg/r6a 6ci2BSngxn/3M/qODPfQRtk4Ule7jya8n41CIN14RFm5tCvj//4CUDjL/RVedVdNuIwW TnaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z35si233805edd.340.2019.10.02.14.44.45; Wed, 02 Oct 2019 14:45:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728124AbfJBTzM (ORCPT + 99 others); Wed, 2 Oct 2019 15:55:12 -0400 Received: from fieldses.org ([173.255.197.46]:40798 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbfJBTzM (ORCPT ); Wed, 2 Oct 2019 15:55:12 -0400 Received: by fieldses.org (Postfix, from userid 2815) id E18841C84; Wed, 2 Oct 2019 15:55:11 -0400 (EDT) Date: Wed, 2 Oct 2019 15:55:11 -0400 To: Olga Kornievskaia Cc: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, bfields@redhat.com, linux-nfs@vger.kernel.org Subject: Re: [PATCH v7 18/19] NFSD: allow inter server COPY to have a STALE source server fh Message-ID: <20191002195511.GA21809@fieldses.org> References: <20190916211353.18802-1-olga.kornievskaia@gmail.com> <20190916211353.18802-19-olga.kornievskaia@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190916211353.18802-19-olga.kornievskaia@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, Sep 16, 2019 at 05:13:52PM -0400, Olga Kornievskaia wrote: > @@ -1956,6 +1964,45 @@ static void svcxdr_init_encode(struct svc_rqst *rqstp, > - rqstp->rq_auth_slack; > } > > +#ifdef CONFIG_NFSD_V4_2_INTER_SSC > +static __be32 > +check_if_stalefh_allowed(struct nfsd4_compoundargs *args) > +{ > + struct nfsd4_op *op, *current_op, *saved_op; current_op and saved_op need to be initialized to NULL here. > + struct nfsd4_copy *copy; > + struct nfsd4_putfh *putfh; > + int i; > + > + /* traverse all operation and if it's a COPY compound, mark the > + * source filehandle to skip verification > + */ > + for (i = 0; i < args->opcnt; i++) { > + op = &args->ops[i]; > + if (op->opnum == OP_PUTFH) > + current_op = op; > + else if (op->opnum == OP_SAVEFH) > + saved_op = current_op; > + else if (op->opnum == OP_RESTOREFH) > + current_op = saved_op; > + else if (op->opnum == OP_COPY) { > + copy = (struct nfsd4_copy *)&op->u; > + if (!saved_op) > + return nfserr_nofilehandle; Looks like this results in returning an empty compound result with just the bare result. I believe what we need to do is execute all the ops preceding the COPY normally, then return the nofilehandle error on the COPY. One approach might be if (!saved_op) { op->status = nfserr_nofilehandle; return; } and change check_if_stalefh_allowed to have no return value. --b. > + putfh = (struct nfsd4_putfh *)&saved_op->u; > + if (!copy->cp_intra) > + putfh->no_verify = true; > + } > + } > + return nfs_ok; > +} ... > @@ -2004,6 +2051,9 @@ static void svcxdr_init_encode(struct svc_rqst *rqstp, > resp->opcnt = 1; > goto encode_op; > } > + status = check_if_stalefh_allowed(args); > + if (status) > + goto out; > > trace_nfsd_compound(rqstp, args->opcnt); > while (!status && resp->opcnt < args->opcnt) {