linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] NFSD: Fix 5 seconds delay when doing inter server copy
Date: Mon, 30 Nov 2020 13:28:20 -0800	[thread overview]
Message-ID: <8d06ce44-78c4-a0fc-bf99-c104b2622889@oracle.com> (raw)
In-Reply-To: <20201124204956.GB7173@fieldses.org>

On 11/24/20 12:49 PM, J. Bruce Fields wrote:
> On Mon, Nov 23, 2020 at 10:16:09PM -0500, Dai Ngo wrote:
>> Since commit b4868b44c5628 ("NFSv4: Wait for stateid updates after
>> CLOSE/OPEN_DOWNGRADE"), every inter server copy operation suffers 5
>> seconds delay regardless of the size of the copy. The delay is from
>> nfs_set_open_stateid_locked when the check by nfs_stateid_is_sequential
>> fails because the seqid in both nfs4_state and nfs4_stateid are 0.
>>
>> Fix by modifying the source server to return the stateid for COPY_NOTIFY
>> request with seqid 1 instead of 0. This is also to conform with
>> section 4.8 of RFC 7862.
>>
>> Here is the relevant paragraph from section 4.8 of RFC 7862:
>>
>>     A copy offload stateid's seqid MUST NOT be zero.  In the context of a
>>     copy offload operation, it is inappropriate to indicate "the most
>>     recent copy offload operation" using a stateid with a seqid of zero
>>     (see Section 8.2.2 of [RFC5661]).  It is inappropriate because the
>>     stateid refers to internal state in the server and there may be
>>     several asynchronous COPY operations being performed in parallel on
>>     the same file by the server.  Therefore, a copy offload stateid with
>>     a seqid of zero MUST be considered invalid.
>>
>> Fixes: ce0887ac96d3 ("NFSD add nfs4 inter ssc to nfsd4_copy")
>> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
>> ---
>>   fs/nfsd/nfs4state.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>> index d7f27ed6b794..33ee1a6961e3 100644
>> --- a/fs/nfsd/nfs4state.c
>> +++ b/fs/nfsd/nfs4state.c
>> @@ -793,6 +793,7 @@ struct nfs4_cpntf_state *nfs4_alloc_init_cpntf_state(struct nfsd_net *nn,
>>   	refcount_set(&cps->cp_stateid.sc_count, 1);
>>   	if (!nfs4_init_cp_state(nn, &cps->cp_stateid, NFS4_COPYNOTIFY_STID))
>>   		goto out_free;
>> +	cps->cp_stateid.stid.si_generation = 1;
> This affects the stateid returned by COPY_NOTIFY, but not the one
> returned by COPY.  I think we wan to add this to nfs4_init_cp_state()
> and cover both.

Hi Bruce, thank you for your suggestion. Updated patch tested and submitted.

-Dai

P.S sorry for the delay, I was on leave last few days.

>
> --b.
>
>>   	spin_lock(&nn->s2s_cp_lock);
>>   	list_add(&cps->cp_list, &p_stid->sc_cp_list);
>>   	spin_unlock(&nn->s2s_cp_lock);
>> -- 
>> 2.9.5

  parent reply	other threads:[~2020-11-30 21:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24  3:16 [PATCH] NFSD: Fix 5 seconds delay when doing inter server copy Dai Ngo
2020-11-24 20:49 ` J. Bruce Fields
2020-11-30 17:57   ` Chuck Lever
2020-11-30 18:47     ` Dai Ngo
2020-11-30 21:28   ` Dai Ngo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-11-30 21:24 Dai Ngo
2020-11-30 21:38 ` Chuck Lever
2020-11-11  0:40 Dai Ngo

Reply instructions:

You may reply publicly 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=8d06ce44-78c4-a0fc-bf99-c104b2622889@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).