All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging
@ 2026-11-17 13:25 Alexey Kuznetsov
  2026-11-17 13:30 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexey Kuznetsov @ 2026-11-17 13:25 UTC (permalink / raw)
  To: devel, khorenko, kui.liu, azaitsev

These fixes were done in user space long ago,
but we forgot to do them in kernel: print correctly
formatted client ID and show correct origin of
error.

Affects: #ASUP-3693

Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
---
 fs/fuse/kio/pcs/fuse_stat.c      | 4 ++--
 fs/fuse/kio/pcs/pcs_cs.c         | 6 ++++--
 fs/fuse/kio/pcs/pcs_prot_types.h | 7 ++++---
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c
index 41bb9c71af90..9b5825b0bf8b 100644
--- a/fs/fuse/kio/pcs/fuse_stat.c
+++ b/fs/fuse/kio/pcs/fuse_stat.c
@@ -370,8 +370,8 @@ static int do_show_cs_stats(struct pcs_cs *cs, void *ctx)
 		}
 	} while (read_seqretry(&cs->stat.seqlock, seq));
 
-	seq_printf(m, "%-10llu %d=%-8s %-10llu %-10llu %-11llu",
-		NODE_ARGS(cs->id), rpc_state, pcs_rpc_state_name(rpc_state),
+	seq_printf(m, "%-10lu %d=%-8s %-10llu %-10llu %-11llu",
+		(unsigned long)(cs->id.val), rpc_state, pcs_rpc_state_name(rpc_state),
 		read_ops_rate.rate / STAT_TIMER_PERIOD,
 		write_ops_rate.rate / STAT_TIMER_PERIOD,
 		sync_ops_rate.rate / STAT_TIMER_PERIOD);
diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 85e5af2d28c1..d94ac7dc73b2 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -380,10 +380,12 @@ static void cs_response_done(struct pcs_msg *msg)
 
 		pcs_map_verify_sync_state(ireq->dentry, ireq, msg);
 	} else {
-		FUSE_KDEBUG(ireq->cc->fc, XID_FMT " IO error %d %lu, ireq:%px : %llu:%u+%u",
+		FUSE_KDEBUG(ireq->cc->fc, XID_FMT " IO error %d %lu/%lu " CUID_FMT ": %llu:%u+%u",
 		      XID_ARGS(ireq->iochunk.ir.hbuf.hdr.xid), msg->error.value,
 		      msg->error.remote ? (unsigned long)msg->error.offender.val : 0UL,
-		      ireq, (unsigned long long)ireq->iochunk.chunk,
+		      msg->rpc ? (unsigned long)msg->rpc->peer_id.val : 0,
+		      CUID_ARGS(ireq->iochunk.ir.hbuf.uid),
+		      (unsigned long long)ireq->iochunk.chunk,
 		      (unsigned)ireq->iochunk.offset,
 		      (unsigned)ireq->iochunk.size);
 	}
diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
index 64718d568b3e..0793391b9964 100644
--- a/fs/fuse/kio/pcs/pcs_prot_types.h
+++ b/fs/fuse/kio/pcs/pcs_prot_types.h
@@ -453,7 +453,7 @@ enum
 #define VER_FMT "%u:%u:%u:%u:%llu"
 #define VER_ARGS(v) (v).master, (v).cluster, (v).file, (v).lost_lease, (unsigned long long)(v).chunk
 
-#define XID_FMT "[%u.%llu:%llu]"
+#define XID_FMT "[%u." NODE_FMT ":%llu]"
 #define XID_ARGS(x) (unsigned)(((x).origin.val & PCS_NODE_TYPE_MASK) >> PCS_NODE_TYPE_SHIFT), \
 		NODE_ARGS((x).origin), (unsigned long long)((x).val)
 
@@ -463,8 +463,9 @@ enum
 		*((unsigned int*)&((x).uuid[4])),	\
 		*((unsigned int*)&((x).uuid[0]))
 
-#define NODE_FMT "%llu"
-#define NODE_ARGS(id) (unsigned long long)((id).val)
+#define NODE_FMT "%s%llu"
+#define NODE_ARGS(id) (((id).val & PCS_NODE_ALT_MASK) ? "K" : ""), \
+		((unsigned long long)((id).val) & ~PCS_NODE_ALT_MASK)
 
 #define PEER_FMT "%s#" NODE_FMT
 #define PEER_ARGS(r)  pcs_role_to_str((r)->peer_role), NODE_ARGS((r)->peer_id)
-- 
2.47.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging
  2026-11-17 13:25 [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging Alexey Kuznetsov
@ 2026-11-17 13:30 ` no-reply
  2026-11-17 15:06 ` Konstantin Khorenko
  2026-11-17 15:06 ` Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: no-reply @ 2026-11-17 13:30 UTC (permalink / raw)
  To: Alexey Kuznetsov, devel, khorenko, kui.liu, azaitsev

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] fuse/pcs: commit message omits log format changes made by the
  patch
- [Low] fuse/pcs: 64-bit CS id narrowed to unsigned long in cs stats and
  IO error log
--

commit 30a53ff9513c7c968e8dfdd8ad0c3748ecdf8bf6
Author: Alexey Kuznetsov <kuznet@virtuozzo.com>

fs/fuse/pcs: fix problems in logging

This patch changes the PCS node ID formatting macros and the IO error debug line in cs_response_done(). It also changes how the cs_stats ID column is printed.

> fs/fuse/pcs: fix problems in logging
>
> These fixes were done in user space long ago,
> but we forgot to do them in kernel: print correctly
> formatted client ID and show correct origin of
> error.
>
> Affects: #ASUP-3693
>
> Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>

[Severity: Low]
Does the commit message cover everything the diff changes?

NODE_FMT and NODE_ARGS are redefined globally, along with XID_FMT. Every trace site that uses them now prints a "K" prefix and masks the top bit of the ID. The message doesn't describe this, and it doesn't say what "correct origin" means.

The IO error line in cs_response_done() also drops the ireq pointer and adds the rpc peer id and the chunk uid. The chunk uid isn't a client ID. The cs_stats ID column in do_show_cs_stats() now bypasses NODE_ARGS as well. Could the message list these behaviour changes?

> diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c
> index 41bb9c71af90..9b5825b0bf8b 100644
> --- a/fs/fuse/kio/pcs/fuse_stat.c
> +++ b/fs/fuse/kio/pcs/fuse_stat.c
> @@ -370,8 +370,8 @@ static int do_show_cs_stats(struct pcs_cs *cs, void *ctx)
>  		}
>  	} while (read_seqretry(&cs->stat.seqlock, seq));
>  
> -	seq_printf(m, "%-10llu %d=%-8s %-10llu %-10llu %-11llu",
> -		NODE_ARGS(cs->id), rpc_state, pcs_rpc_state_name(rpc_state),
> +	seq_printf(m, "%-10lu %d=%-8s %-10llu %-10llu %-11llu",
> +		(unsigned long)(cs->id.val), rpc_state, pcs_rpc_state_name(rpc_state),

[Severity: Low]
Is the cast to unsigned long safe here? cs->id.val is a u64, so on a 32-bit build the upper 32 bits are dropped. This column also no longer goes through NODE_ARGS, so it skips the ALT-bit handling this patch adds elsewhere. Would (unsigned long long) with %llu avoid both problems?

[ ... ]

> diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
> index 85e5af2d28c1..d94ac7dc73b2 100644
> --- a/fs/fuse/kio/pcs/pcs_cs.c
> +++ b/fs/fuse/kio/pcs/pcs_cs.c
> @@ -380,10 +380,12 @@ static void cs_response_done(struct pcs_msg *msg)
>  
>  		pcs_map_verify_sync_state(ireq->dentry, ireq, msg);
>  	} else {
> -		FUSE_KDEBUG(ireq->cc->fc, XID_FMT " IO error %d %lu, ireq:%px : %llu:%u+%u",
> +		FUSE_KDEBUG(ireq->cc->fc, XID_FMT " IO error %d %lu/%lu " CUID_FMT ": %llu:%u+%u",
>  		      XID_ARGS(ireq->iochunk.ir.hbuf.hdr.xid), msg->error.value,
>  		      msg->error.remote ? (unsigned long)msg->error.offender.val : 0UL,
> -		      ireq, (unsigned long long)ireq->iochunk.chunk,
> +		      msg->rpc ? (unsigned long)msg->rpc->peer_id.val : 0,
> +		      CUID_ARGS(ireq->iochunk.ir.hbuf.uid),
> +		      (unsigned long long)ireq->iochunk.chunk,
>  		      (unsigned)ireq->iochunk.offset,
>  		      (unsigned)ireq->iochunk.size);

[Severity: Low]
The new peer_id argument has the same narrowing: peer_id.val is a u64 and is cast to unsigned long, so the high bits are lost on 32-bit. The offender id on the line above already did this. Could both use unsigned long long with %llu?

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/avxV5vl8EDa1S/OF@mops2?part=1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging
  2026-11-17 13:25 [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging Alexey Kuznetsov
  2026-11-17 13:30 ` no-reply
@ 2026-11-17 15:06 ` Konstantin Khorenko
  2026-11-17 15:06 ` Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 15:06 UTC (permalink / raw)
  To: Alexey Kuznetsov; +Cc: azaitsev, devel, kui.liu

Applying with these fixes on my side:
- message: a list of what changes in the logs, after the first
  paragraph
- "Affects: #ASUP-3693" -> the tracker URL; "Feature: vStorage" added

On Tue, 17 Nov 2026 21:25:58 +0800, Alexey Kuznetsov wrote:
> These fixes were done in user space long ago,
> but we forgot to do them in kernel: print correctly
> formatted client ID and show correct origin of
> error.

The message did not say what changes in the logs. I added:

  - NODE_FMT prints an id with PCS_NODE_ALT_MASK set (the kernel
    client, the origin of every XID) as "K<id>" instead of 2^63 plus
    the id.
  - The IO error line in cs_response_done() adds the id of the CS the
    request was sent to and the chunk uid, and drops the ireq pointer.
  - The cs_stats id column prints the raw id itself, since NODE_ARGS
    now expands to two arguments.

The code is fine. Sashiko's remark on the (unsigned long) casts does
not apply: vz10 builds no 32-bit kernels.

Thanks.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging
  2026-11-17 13:25 [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging Alexey Kuznetsov
  2026-11-17 13:30 ` no-reply
  2026-11-17 15:06 ` Konstantin Khorenko
@ 2026-11-17 15:06 ` Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 15:06 UTC (permalink / raw)
  To: devel, kui.liu, azaitsev, Alexey Kuznetsov

On Tue, 17 Nov 2026 21:25:58 +0800, Alexey Kuznetsov wrote:
> fs/fuse/pcs: fix problems in logging

Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.24.3.vz10, thanks!

[1/1] fs/fuse/pcs: fix problems in logging
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/c26fd05da46f

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-17 15:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 13:25 [Devel] [PATCH hci-8.1] fs/fuse/pcs: fix problems in logging Alexey Kuznetsov
2026-11-17 13:30 ` no-reply
2026-11-17 15:06 ` Konstantin Khorenko
2026-11-17 15:06 ` Konstantin Khorenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.