diff mbox series

[2/2] pnfs/blocklayout: Don't add zero-length pnfs_block_dev

Message ID 53e2ab90d83d4cdc15f1b48b2eb671ad26f54a6a.1701788600.git.bcodding@redhat.com (mailing list archive)
State New
Headers show
Series [1/2] blocklayoutdriver: Fix reference leak of pnfs_device_node | expand

Commit Message

Benjamin Coddington Dec. 5, 2023, 3:05 p.m. UTC
We noticed a SCSI device that refused to allow READ CAPACITY when the
device had a PR with exclusive access, registrants only.  The result of
this situation is that the blocklayout driver adds a pnfs_block_dev of zero
length which always fails the offset_in_map tests.  Instead of continuously
trying to do pNFS for this case, just mark the device as unavailable which
will allow the client to fallback to the MDS for the duration of
PNFS_DEVICE_RETRY_TIMEOUT.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfs/blocklayout/dev.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christoph Hellwig Dec. 6, 2023, 5:44 a.m. UTC | #1
On Tue, Dec 05, 2023 at 10:05:02AM -0500, Benjamin Coddington wrote:
> We noticed a SCSI device that refused to allow READ CAPACITY when the
> device had a PR with exclusive access, registrants only.  The result of
> this situation is that the blocklayout driver adds a pnfs_block_dev of zero
> length which always fails the offset_in_map tests.  Instead of continuously
> trying to do pNFS for this case, just mark the device as unavailable which
> will allow the client to fallback to the MDS for the duration of
> PNFS_DEVICE_RETRY_TIMEOUT.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c
index f318a05a80e1..c97ebc42ec0f 100644
--- a/fs/nfs/blocklayout/dev.c
+++ b/fs/nfs/blocklayout/dev.c
@@ -351,6 +351,9 @@  bl_parse_scsi(struct nfs_server *server, struct pnfs_block_dev *d,
 	d->map = bl_map_simple;
 	d->pr_key = v->scsi.pr_key;
 
+	if (d->len == 0)
+		return -ENODEV;
+
 	pr_info("pNFS: using block device %s (reservation key 0x%llx)\n",
 		d->bdev_handle->bdev->bd_disk->disk_name, d->pr_key);