You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
block: fix discard-path hangs and bounds on the BLKDISCARD ioctl
The generic BLKDISCARD ioctl submits a BIO_DISCARD and waits on bio_wait().
Drivers that do not implement discard returned ENOTBLK from their bio_cmd
switch without completing the bio, so the wait hung. Complete the bio with
error in the default case of nvme, ahci, ide and scsi so an unsupported
discard fails cleanly instead of hanging.
multiplex_strategy split a request larger than max_io_size by doing pointer
arithmetic on bio_data, which is nullptr for a discard (no data payload).
Forward discard bios whole and let the driver enforce its own size limit.
In virtio-blk, restrict the SEG_MAX segment-count check to READ/WRITE (the
only requests with a data payload) and complete the bio on failure so a
waiting caller is not left hung. Reject a discard whose sector count would
overflow the u32 num_sectors field or exceed the advertised
max_discard_sectors, rather than truncating and discarding the wrong range.
0 commit comments