NFS/flexfiles: Don't treat a locally aborted read as a DS failure
Subsystems (3)
PATCH 1/1 NFS/flexfiles: Don't treat a locally aborted read as a DS failure
When a flexfiles read asks for a pNFS resend, ff_layout_resend_pnfs_read() treats the failure as a DS problem. It moves to the next mirror and sends LAYOUTERROR, or, if no other mirror is usable, marks the layout for return.
That is the wrong response when the client aborted the read itself. Relevant cases which don't establish a new DS failure, and therefore no longer drive another layout return:
ECANCELED
pnfs_lseg_cancel_io() cancelled the I/O because its layout segment was being returned or invalidated.
EAGAIN with the current RPC attempt unsent and hdr->lseg invalid
ff_layout_read_prepare_common() found the segment already invalidated and exited the task before transmission.
This was observed on 7.4-rc3 on a one-client one-DS system under sustained direct-read I/O over pNFS/RDMA after restarting the nfs service on the DS. Marking the layout for return cancels the reads of the segments obtained in the meantime, which then fail the same way. The client marked the layout for return from this path about 8,000 times a second and reconnected transports about 300 times a second. With this change, the layout was no longer marked for return from this path and transports reconnected about 10 times a second.
Detect these local aborts before attempting DS failover and resend through pNFS using the current mirror index as the starting point. Skip the explicit LAYOUTERROR and layout-return requests in this resend handler, leaving existing error recording unchanged.
--- fs/nfs/flexfilelayout/flexfilelayout.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
fs/nfs/flexfilelayout/flexfilelayout.c +19 -0
@@ -1313,6 +1313,16 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs) } } +static bool ff_layout_read_aborted_locally (const struct nfs_pgio_header *hdr) +{ +const struct rpc_task *task = &hdr->task; + +return task->tk_status == -ECANCELED || + (task->tk_status == -EAGAIN && + !RPC_WAS_SENT (task) && + !pnfs_is_valid_lseg (hdr->lseg)); +} +static void ff_layout_resend_pnfs_read (struct nfs_pgio_header *hdr) {u32 idx = hdr->pgio_mirror_idx +1 ;
@@ -1320,6 +1330,15 @@ static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)u32 dss_id =0 ;struct nfs4_ff_layout_ds *mirror_ds; +/* +* A local abort is no evidence against the DS, so skip DS failover +* and don't request another layout return. +*/ +if (ff_layout_read_aborted_locally (hdr)) { +pnfs_read_resend_pnfs (hdr, hdr->pgio_mirror_idx); +return ; + } + mirror_ds =ff_layout_choose_any_ds_for_read (hdr->lseg, idx, &new_idx, hdr->args.offset, &dss_id);if (IS_ERR (mirror_ds)) {
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
Signature · 1 line
2.53.0