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 <[email protected]>

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 <[email protected]>

[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
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to