On 10/28/25 11:46 AM, Chaitanya Kulkarni wrote:
> The WARN_ON_ONCE introduced in
> commit f9ee38bbf70f ("blktrace: add block trace commands for zone
> operations")
> triggers kernel warnings when zone operations are traced with blktrace
> version 1. This can spam the kernel log during normal operation with
> zoned block devices when userspace is using the legacy blktrace
> protocol.
>
> Currently blktrace implementation drops newly added REQ_OP_ZONE_XXX
> when blktrace userspce version is set to 1.
>
> Remove the WARN_ON_ONCE and quietly filter these events. Add a
> rate-limited debug message to help diagnose potential issues without
> flooding the kernel log. The debug message can be enabled via dynamic
> debug when needed for troubleshooting.
>
> This approach is more appropriate as encountering zone operations with
> blktrace v1 is an expected condition that should be handled gracefully
> rather than warned about, since users may be running older blktrace
> userspace tools that only support version 1 of the protocol.
>
> With this patch :-
> linux-block (for-next) # git log -1
> commit c8966006a0971d2b4bf94c0426eb7e4407c6853f (HEAD -> for-next)
> Author: Chaitanya Kulkarni <[email protected]>
> Date: Mon Oct 27 19:26:53 2025 -0700
>
> blktrace: use debug print to report dropped events
> linux-block (for-next) # cdblktests
> blktests (master) # ./check blktrace
> blktrace/001 (blktrace zone management command tracing) [passed]
> runtime 3.805s ... 3.889s
> blktests (master) # dmesg -c
> blktests (master) # echo "file kernel/trace/blktrace.c +p" >
> /sys/kernel/debug/dynamic_debug/control
> blktests (master) # ./check blktrace
> blktrace/001 (blktrace zone management command tracing) [passed]
> runtime 3.889s ... 3.881s
> blktests (master) # dmesg -c
> [ 77.826237] blktrace: blktrace v1 cannot trace zone operation 0x1000190001
> [ 77.826260] blktrace: blktrace v1 cannot trace zone operation 0x1000190004
> [ 77.826282] blktrace: blktrace v1 cannot trace zone operation 0x1001490007
> [ 77.826288] blktrace: blktrace v1 cannot trace zone operation 0x1001890008
> [ 77.826343] blktrace: blktrace v1 cannot trace zone operation 0x1000190001
> [ 77.826347] blktrace: blktrace v1 cannot trace zone operation 0x1000190004
> [ 77.826350] blktrace: blktrace v1 cannot trace zone operation 0x1001490007
> [ 77.826354] blktrace: blktrace v1 cannot trace zone operation 0x1001890008
> [ 77.826373] blktrace: blktrace v1 cannot trace zone operation 0x1000190001
> [ 77.826377] blktrace: blktrace v1 cannot trace zone operation 0x1000190004
> blktests (master) # echo "file kernel/trace/blktrace.c -p" >
> /sys/kernel/debug/dynamic_debug/control
> blktests (master) # ./check blktrace
> blktrace/001 (blktrace zone management command tracing) [passed]
> runtime 3.881s ... 3.824s
> blktests (master) # dmesg -c
> blktests (master) #
>
> Reported-by: [email protected]
> Fixes: f9ee38bbf70f ("blktrace: add block trace commands for zone operations")
> Signed-off-by: Chaitanya Kulkarni <[email protected]>
Looks good.
Reviewed-by: Damien Le Moal <[email protected]>
--
Damien Le Moal
Western Digital Research