From: Alexey Kuznetsov <kuznet@virtuozzo.com>
To: devel@openvz.org, khorenko@virtuozzo.com, kui.liu@virtuozzo.com,
azaitsev@virtuozzo.com
Subject: [Devel] [PATCH hci-8.1 2/2] fs/fuse/kio: do not blame CS for errors of local accelerated reads
Date: Tue, 1 Dec 2026 23:19:01 +0800 [thread overview]
Message-ID: <aw7lZfkqfXvrOPYo@mops2> (raw)
As was noticed during review of VSTOR-157924, accel errors still
reduce congestion window. Further investigation showed this was
not the only flaw.
A read failed in local accelerated IO is marked with IREQ_F_ACCELERROR.
Its handling was hidden in map_read_error() and was incomplete:
- map_notify_soft_error() saved a copy of the error before
map_read_error() cleared it, so pcs_deaccount_ireq() still closed
congestion window of the CS;
- when the request was not retried (another part of the API request
had failed, or fuse connection was dead), pcs_sreq_complete()
reported the error to MDS as an error of the CS;
- when map_read_error() bailed out early, the flag stayed set and
could hide a real error of the following slow path attempt.
Add ireq_is_read_accel_error() and handle it at the top of
map_notify_soft_error(), in pcs_sreq_complete() and in
pcs_deaccount_ireq().
Writes are deliberately left as is: a failed write is still always
reported to MDS. This is wrong, but digging in memory and code showed
this was not an accidental omission, this was intentional.
We are at risk of violating the strongest vstorage axiom: failed writes
which have some chances to be stuck in network absolutely require
reporting an error to MDS and map update, otherwise data can be corrupted.
So if we made a mistake and left ACCELERROR on a request part of which
may still be delayed in the network, we cannot ignore the error.
Some efforts to solve this were undertaken, see references to net_error
in pcs_cs_accel.c, but apparently they were not complete, so that
safe fallback to error reporting was left intact.
Let's postpone the repair. There is nothing too bad here and accel writes
are actually marginal feature, writes are accelerated only on journalless
CSes which are rarely used.
Fixes: 28349a297579 ("fuse: direct access to local cs repositories")
https://virtuozzo.atlassian.net/browse/VSTOR-157924
Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
Feature: vStorage
---
fs/fuse/kio/pcs/pcs_cluster.c | 4 +++-
fs/fuse/kio/pcs/pcs_map.c | 17 +++++++++--------
fs/fuse/kio/pcs/pcs_req.h | 16 ++++++++++++++++
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_cluster.c b/fs/fuse/kio/pcs/pcs_cluster.c
index e5ecb93447bb..d68390090b96 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.c
+++ b/fs/fuse/kio/pcs/pcs_cluster.c
@@ -62,7 +62,9 @@ static void pcs_sreq_complete(struct pcs_int_request *sreq)
pcs_copy_error_cond_atomic(&ireq->error, &sreq->error);
}
- map_notify_iochunk_error(sreq);
+ /* Another part of the request failed or fuse connection is dead */
+ if (!ireq_is_read_accel_error(sreq))
+ map_notify_iochunk_error(sreq);
}
diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 8bccb1800988..9c85f3e51ba7 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -1408,13 +1408,6 @@ static void map_read_error(struct pcs_int_request *ireq)
if (csl == NULL || csl->map == NULL || (csl->map->state & PCS_MAP_ERROR))
return;
- if (ireq->flags & IREQ_F_ACCELERROR) {
- pcs_clear_error(&ireq->error);
- ireq->flags &= ~IREQ_F_ACCELERROR;
- ireq->flags |= IREQ_F_NO_ACCEL;
- return;
- }
-
cs = rcu_dereference_protected(csl->cs[ireq->iochunk.cs_index].cslink.cs,
atomic_read(&csl->refcnt) > 0);
@@ -1646,7 +1639,7 @@ void pcs_deaccount_ireq(struct pcs_int_request *ireq, pcs_error_t * err)
return;
if (pcs_if_error(err)) {
- if (!err->remote) {
+ if (!err->remote || ireq_is_read_accel_error(ireq)) {
error = -1;
} else {
match_id = err->offender.val;
@@ -1724,6 +1717,14 @@ void map_notify_soft_error(struct pcs_int_request *ireq)
{
pcs_error_t err;
+ if (ireq_is_read_accel_error(ireq)) {
+ /* IREQ_F_NO_ACCEL is set and IREQ_F_ONCE is cleared by cs accel */
+ pcs_deaccount_ireq(ireq, &ireq->error);
+ pcs_clear_error(&ireq->error);
+ ireq->flags &= ~IREQ_F_ACCELERROR;
+ return;
+ }
+
if (ireq->error.value == PCS_ERR_CSD_REPLICATING)
map_replicating(ireq);
diff --git a/fs/fuse/kio/pcs/pcs_req.h b/fs/fuse/kio/pcs/pcs_req.h
index a8c9c9b8b9db..1822b843bd93 100644
--- a/fs/fuse/kio/pcs/pcs_req.h
+++ b/fs/fuse/kio/pcs/pcs_req.h
@@ -366,6 +366,22 @@ static inline int ireq_check_redo(struct pcs_int_request *ireq)
return 1;
}
+/* Read failed in local accelerated IO, see __pcs_csa_final_completion().
+ * The error is not a fault of CS: it must not be blacklisted, reported
+ * to MDS or penalized in congestion control. The request is simply
+ * retried via slow path.
+ *
+ * Writes are not covered intentionally. A failed write must always be
+ * reported to MDS, unless we are absolutely sure it cannot be stuck on
+ * some CS, otherwise later rewrite can be reordered with it.
+ */
+static inline int ireq_is_read_accel_error(struct pcs_int_request *ireq)
+{
+ return (ireq->flags & IREQ_F_ACCELERROR) &&
+ ireq->type == PCS_IREQ_IOCHUNK &&
+ !pcs_req_direction(ireq->iochunk.cmd);
+}
+
struct pcs_int_request * __ireq_alloc(void);
struct pcs_int_request *ireq_alloc(struct pcs_dentry_info *di);
struct pcs_int_request *ireq_alloc_by_cluster(struct pcs_cluster_core *cc);
--
2.47.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
reply other threads:[~2026-12-01 15:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=aw7lZfkqfXvrOPYo@mops2 \
--to=kuznet@virtuozzo.com \
--cc=azaitsev@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=kui.liu@virtuozzo.com \
/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