public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Benjamin Coddington <bcodding@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	cel@kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [RFC PATCH 3/4] nfs/blocklayout: Fix premature PR key unregistration
Date: Thu, 20 Jun 2024 09:58:42 -0400	[thread overview]
Message-ID: <ZnQ1khOCStHMqS2U@tissot.1015granger.net> (raw)
In-Reply-To: <3859730C-40EC-4818-9058-D74E4153623B@redhat.com>

On Thu, Jun 20, 2024 at 09:52:59AM -0400, Benjamin Coddington wrote:
> On 20 Jun 2024, at 1:06, Christoph Hellwig wrote:
> 
> > On Wed, Jun 19, 2024 at 01:39:33PM -0400, cel@kernel.org wrote:
> >> -	if (test_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags) == 0)
> >> +	if (test_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags) == 0) {
> >
> > It might be worth to invert this and keep the unavailable handling in
> > the branch as that's the exceptional case.   That code is also woefully
> > under-documented and could have really used a comment.
> 
> The transient device handling in general, or just this bit of it?

I read Christoph's comment as referring specifically to the logic
in bl_find_get_deviceid(). 


> >> +		struct pnfs_block_dev *d =
> >> +			container_of(node, struct pnfs_block_dev, node);
> >> +		if (d->pr_reg)
> >> +			if (d->pr_reg(d) < 0)
> >> +				goto out_put;
> >
> > Empty line after variable declarations.  Also is there anything that
> > synchronizes the lookups here so that we don't do multiple registrations
> > in parallel?
> 
> I don't think there is.  Do we get an error if we register twice?

pr_register() does not throw an error in that case, so I didn't
protect against it. However, I could add atomic bit flags to
pnfs_block_dev to ensure registration is done only once, if we
believe that is necessary.


> Ben
> 
> >> +
> >> +	if (d->pr_registered)
> >> +		return 0;
> >> +
> >> +	error = ops->pr_register(bdev, 0, d->pr_key, true);
> >> +	if (error) {
> >> +		trace_bl_pr_key_reg_err(bdev->bd_disk->disk_name, d->pr_key, error);
> >> +		return -error;
> >
> > ->pr_register returns either negative errnos or positive PR_STS_* values,
> > simply inverting the error here isn't doing the right thing.
> 

-- 
Chuck Lever

  reply	other threads:[~2024-06-20 13:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 17:39 [RFC PATCH 0/4] Snapshot of fixes for SCSI PR key registration cel
2024-06-19 17:39 ` [RFC PATCH 1/4] nfs/blocklayout: SCSI layout trace points for reservation key reg/unreg cel
2024-06-20  4:50   ` Christoph Hellwig
2024-06-20  4:52     ` Christoph Hellwig
2024-06-20 14:30     ` Chuck Lever
2024-06-19 17:39 ` [RFC PATCH 2/4] nfs/blocklayout: Report only when /no/ device is found cel
2024-06-20  4:36   ` Christoph Hellwig
2024-06-20 14:59     ` Chuck Lever
2024-06-20 12:17   ` Benjamin Coddington
2024-06-20 14:10     ` Christoph Hellwig
2024-06-19 17:39 ` [RFC PATCH 3/4] nfs/blocklayout: Fix premature PR key unregistration cel
2024-06-20  5:06   ` Christoph Hellwig
2024-06-20 13:52     ` Benjamin Coddington
2024-06-20 13:58       ` Chuck Lever [this message]
2024-06-20 14:15       ` Christoph Hellwig
2024-06-20 14:18         ` Chuck Lever III
2024-06-20 15:45         ` Benjamin Coddington
2024-06-20 15:48           ` Chuck Lever
2024-06-20 15:58             ` Benjamin Coddington
2024-06-20 15:39     ` Chuck Lever
2024-06-20 13:51   ` Benjamin Coddington
2024-06-20 14:34     ` Chuck Lever
2024-06-20 14:37       ` Christoph Hellwig
2024-06-20 15:30       ` Benjamin Coddington
2024-06-20 15:46         ` Chuck Lever
2024-06-20 15:56           ` Benjamin Coddington
2024-06-20 16:45             ` Benjamin Coddington
2024-06-20 17:08               ` Chuck Lever
2024-06-19 17:39 ` [RFC PATCH 4/4] nfs/blocklayout: Use bulk page allocation APIs cel
2024-06-20  4:44   ` Christoph Hellwig

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=ZnQ1khOCStHMqS2U@tissot.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=bcodding@redhat.com \
    --cc=cel@kernel.org \
    --cc=hch@lst.de \
    --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