From: Benjamin Coddington <bcodding@redhat.com>
To: Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] nfs/blocklayout: Limit repeat device registration on failure
Date: Mon, 18 Nov 2024 17:40:41 -0500 [thread overview]
Message-ID: <ec3b7c3edf1bbc048e81ba9aa299eb814bb80a65.1731969260.git.bcodding@redhat.com> (raw)
In-Reply-To: <cover.1731969260.git.bcodding@redhat.com>
If we're unable to register a SCSI device, ensure we mark the device as
unavailable so that it will timeout and be re-added via GETDEVINFO. This
avoids repeated doomed attempts to register a device in the IO path.
Add some clarifying comments as well.
Fixes: d869da91cccb ("nfs/blocklayout: Fix premature PR key unregistration")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
fs/nfs/blocklayout/blocklayout.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 0becdec12970..b36bc2f4f7e2 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -571,19 +571,29 @@ bl_find_get_deviceid(struct nfs_server *server,
if (!node)
return ERR_PTR(-ENODEV);
+ /*
+ * Devices that are marked unavailable are left in the cache with a
+ * timeout to avoid sending GETDEVINFO after every LAYOUTGET, or
+ * constantly attempting to register the device. Once marked as
+ * unavailable they must be deleted and never reused.
+ */
if (test_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags)) {
unsigned long end = jiffies;
unsigned long start = end - PNFS_DEVICE_RETRY_TIMEOUT;
if (!time_in_range(node->timestamp_unavailable, start, end)) {
+ /* Force a new GETDEVINFO for this LAYOUT */
nfs4_delete_deviceid(node->ld, node->nfs_client, id);
goto retry;
}
goto out_put;
}
- if (!bl_register_dev(container_of(node, struct pnfs_block_dev, node)))
+ /* If we cannot register, treat this device as transient */
+ if (!bl_register_dev(container_of(node, struct pnfs_block_dev, node))) {
+ nfs4_mark_deviceid_unavailable(node);
goto out_put;
+ }
return node;
--
2.47.0
next prev parent reply other threads:[~2024-11-18 22:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 22:40 [PATCH 0/2] two fixes for pNFS SCSI device handling Benjamin Coddington
2024-11-18 22:40 ` [PATCH 1/2] nfs/blocklayout: Don't attempt unregister for invalid block device Benjamin Coddington
2024-11-19 12:42 ` Christoph Hellwig
2024-11-19 13:46 ` Benjamin Coddington
2024-11-18 22:40 ` Benjamin Coddington [this message]
2024-11-19 12:42 ` [PATCH 2/2] nfs/blocklayout: Limit repeat device registration on failure Christoph Hellwig
2024-11-20 14:09 [PATCH v2 0/2] two fixes for pNFS SCSI device handling Benjamin Coddington
2024-11-20 14:09 ` [PATCH 2/2] nfs/blocklayout: Limit repeat device registration on failure Benjamin Coddington
2024-11-20 15:22 ` Chuck Lever
2024-11-21 15:11 ` Benjamin Coddington
2024-11-21 15:32 ` Chuck Lever
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=ec3b7c3edf1bbc048e81ba9aa299eb814bb80a65.1731969260.git.bcodding@redhat.com \
--to=bcodding@redhat.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@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
all inboxes | Powered by JetHome®