]> git.proxmox.com Git - mirror_zfs.git/commit
vdev_disk: ensure trim errors are returned immediately
authorRob N <rob.norris@klarasystems.com>
Mon, 8 Apr 2024 18:50:24 +0000 (04:50 +1000)
committerGitHub <noreply@github.com>
Mon, 8 Apr 2024 18:50:24 +0000 (11:50 -0700)
commitba9f587a77e6893390c752491dfacb6ee5d52023
tree7ff6773affc252c7f126636b53b1fefec5258531
parent03987f71e39c47d2f16c3006d690c50a9fec2ca5
vdev_disk: ensure trim errors are returned immediately

After 06e25f9c4, the discard issuing code was organised such that if
requesting an async discard or secure erase failed before the IO was
issued (that is, calling __blkdev_issue_discard() returned an error),
the failed zio would never be executed, resulting in txg_sync hanging
forever waiting for IO to finish.

This commit fixes that by immediately executing a failed zio on error.
To handle the successful synchronous op case, we fake an async op by,
when not using an asynchronous submission method, queuing the successful
result zio as part of the discard handler.

Since it was hard to understand the differences between discard and
secure erase, and sync and async, across different kernel versions, I've
commented and reorganised the code a bit to try and make everything more
contained and linear.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16070
config/kernel-blkdev.m4
module/os/linux/zfs/vdev_disk.c