Linux-NFS Archive on lore.kernel.org
 help / color / Atom feed
From: Olga Kornievskaia <olga.kornievskaia@gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: trond.myklebust@hammerspace.com,
	Anna Schumaker <anna.schumaker@netapp.com>,
	"J. Bruce Fields" <bfields@redhat.com>,
	linux-nfs <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v7 18/19] NFSD: allow inter server COPY to have a STALE source server fh
Date: Mon, 7 Oct 2019 10:31:04 -0400
Message-ID: <CAN-5tyEb=YG-5j7bNFSqefaC32vaTh3NQ0QgKPwgVuPg-quVQQ@mail.gmail.com> (raw)
In-Reply-To: <20191002195511.GA21809@fieldses.org>

On Wed, Oct 2, 2019 at 3:55 PM J. Bruce Fields <bfields@fieldses.org> wrote:
>
> 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.

Ok thanks. I'm just curious if op->status assignment is necessary or I
can just do a return. When nfsd4_copy() calls nfs4_verify_copy() it
would check
        if (!cstate->save_fh.fh_dentry)
                return nfserr_nofilehandle;

>
> --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) {

  reply index

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16 21:13 [PATCH v7 00/19] client and server support for "inter" SSC copy Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 01/19] NFS NFSD: defining nl4_servers structure needed by both Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 02/19] NFS: add COPY_NOTIFY operation Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 03/19] NFS: add ca_source_server<> to COPY Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 04/19] NFS: also send OFFLOAD_CANCEL to source server Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 05/19] NFS: inter ssc open Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 06/19] NFS: skip recovery of copy open on dest server Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 07/19] NFS: for "inter" copy treat ESTALE as ENOTSUPP Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 08/19] NFS: COPY handle ERR_OFFLOAD_DENIED Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 09/19] NFS: handle source server reboot Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 10/19] NFS: replace cross device check in copy_file_range Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 11/19] NFSD fill-in netloc4 structure Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 12/19] NFSD add ca_source_server<> to COPY Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 13/19] NFSD return nfs4_stid in nfs4_preprocess_stateid_op Olga Kornievskaia
2019-10-02 15:52   ` bfields
2019-10-02 16:12     ` Olga Kornievskaia
2019-10-02 16:15       ` Olga Kornievskaia
2019-10-02 16:34       ` J. Bruce Fields
2019-10-02 16:52         ` Olga Kornievskaia
2019-10-02 16:57           ` J. Bruce Fields
2019-09-16 21:13 ` [PATCH v7 14/19] NFSD COPY_NOTIFY xdr Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 15/19] NFSD add COPY_NOTIFY operation Olga Kornievskaia
2019-10-01 20:59   ` bfields
2019-10-02  0:14     ` Olga Kornievskaia
2019-10-02  1:35       ` J. Bruce Fields
2019-10-02 15:32         ` Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 16/19] NFSD check stateids against copy stateids Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 17/19] NFSD generalize nfsd4_compound_state flag names Olga Kornievskaia
2019-09-16 21:13 ` [PATCH v7 18/19] NFSD: allow inter server COPY to have a STALE source server fh Olga Kornievskaia
2019-10-02 19:55   ` bfields
2019-10-07 14:31     ` Olga Kornievskaia [this message]
2019-10-07 18:20       ` J. Bruce Fields
2019-09-16 21:13 ` [PATCH v7 19/19] NFSD add nfs4 inter ssc to nfsd4_copy Olga Kornievskaia
2019-09-19 19:55   ` [PATCH 1/1] " Olga Kornievskaia
2019-09-30 19:06 ` [PATCH v7 00/19] client and server support for "inter" SSC copy Olga Kornievskaia
2019-10-01 17:13   ` bfields
2019-10-01 17:47     ` Olga Kornievskaia
2019-10-01 17:50       ` J. Bruce Fields
2019-10-01 19:03         ` Olga Kornievskaia

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN-5tyEb=YG-5j7bNFSqefaC32vaTh3NQ0QgKPwgVuPg-quVQQ@mail.gmail.com' \
    --to=olga.kornievskaia@gmail.com \
    --cc=anna.schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-NFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nfs/0 linux-nfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nfs linux-nfs/ https://lore.kernel.org/linux-nfs \
		linux-nfs@vger.kernel.org
	public-inbox-index linux-nfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-nfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git