linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Olga Kornievskaia <aglo@umich.edu>
Cc: Olga Kornievskaia <kolga@netapp.com>,
	"J. Bruce Fields" <bfields@redhat.com>,
	linux-nfs <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v7 06/10] NFSD return nfs4_stid in nfs4_preprocess_stateid_op
Date: Thu, 8 Mar 2018 10:14:06 -0500	[thread overview]
Message-ID: <20180308151406.GB10782@fieldses.org> (raw)
In-Reply-To: <CAN-5tyE9++KkQs064P25NtYkX6L03sNinhVU4Xg41cX_j_EfXg@mail.gmail.com>

On Wed, Mar 07, 2018 at 04:54:50PM -0500, Olga Kornievskaia wrote:
> On Wed, Mar 7, 2018 at 4:43 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> > On Tue, Feb 20, 2018 at 11:42:25AM -0500, Olga Kornievskaia wrote:
> >> @@ -5143,8 +5144,11 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid)
> >>       if (!status && filpp)
> >>               status = nfs4_check_file(rqstp, fhp, s, filpp, tmp_file, flags);
> >>  out:
> >> -     if (s)
> >> +     if (s) {
> >> +             if (!status && cstid)
> >> +                     *cstid = s;
> >>               nfs4_put_stid(s);
> >
> > Are you sure that's right?  Normally you wouldn't drop a reference on
> > something you're returning.
> 
> Hm. Should it be taken here then? I do up the reference on the stateid
> later in the code in the nfds4_copy().

Yeah, you probably want

		if (!status && cstid)
			*cstid = s;
		else
			nfs4_put_stid(s);

instead of doing the increment later in nfsd4_copy() code.

Otherwise, in theory a close or free_stateid or something could
race in and destroy the stateid before you get the chance to increment
the reference again.

--b.

  reply	other threads:[~2018-03-08 15:14 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 16:42 [PATCH v7 00/10] NFSD support for asynchronous COPY Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 01/10] NFSD CB_OFFLOAD xdr Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 02/10] NFSD OFFLOAD_STATUS xdr Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 03/10] NFSD OFFLOAD_CANCEL xdr Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 04/10] NFSD xdr callback stateid in async COPY reply Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 05/10] NFSD introduce asynch copy feature Olga Kornievskaia
2018-03-06 21:27   ` J. Bruce Fields
2018-03-07 20:48     ` Olga Kornievskaia
2018-03-07 20:38   ` J. Bruce Fields
2018-03-07 20:50     ` Olga Kornievskaia
2018-03-07 21:05   ` J. Bruce Fields
2018-03-07 22:06     ` Olga Kornievskaia
2018-03-08 15:07       ` J. Bruce Fields
2018-03-22 15:08     ` Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 06/10] NFSD return nfs4_stid in nfs4_preprocess_stateid_op Olga Kornievskaia
2018-03-07 21:43   ` J. Bruce Fields
2018-03-07 21:54     ` Olga Kornievskaia
2018-03-08 15:14       ` J. Bruce Fields [this message]
2018-02-20 16:42 ` [PATCH v7 07/10] NFSD create new stateid for async copy Olga Kornievskaia
2018-03-08 16:31   ` J. Bruce Fields
2018-03-22 15:12     ` Olga Kornievskaia
2018-03-22 15:17       ` J. Bruce Fields
2018-03-22 16:40         ` Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 08/10] NFSD handle OFFLOAD_CANCEL op Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 09/10] NFSD support OFFLOAD_STATUS Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 10/10] NFSD stop queued async copies on client shutdown Olga Kornievskaia
2018-03-08 17:05   ` J. Bruce Fields
2018-04-10 20:09     ` Olga Kornievskaia
2018-04-10 20:21       ` J. Bruce Fields
2018-04-10 21:07         ` Olga Kornievskaia
2018-04-10 21:13           ` J. Bruce Fields
2018-04-11 17:33             ` J. Bruce Fields
2018-04-12 20:05               ` Olga Kornievskaia
2018-04-12 20:06                 ` J. Bruce Fields

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=20180308151406.GB10782@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=aglo@umich.edu \
    --cc=bfields@redhat.com \
    --cc=kolga@netapp.com \
    --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).