On Sun, Mar 24, 2024 at 09:37:02PM +0800, Ming Lei wrote: > @@ -780,6 +793,9 @@ void submit_bio_noacct(struct bio *bio) > } > } > > + if (WARN_ON_ONCE(!bio_check_alignment(bio, q))) > + goto end_io; > + The "status" at this point is "BLK_STS_IOERR", so user space would see EIO, but the existing checks return EINVAL. I'm not sure if that's "ok", but assuming it is, I think the user visible different behavior should be mentioned in the changelog. Alternatively, maybe we want an asynchronous way to return EINVAL for these conditions. It's more informative to a user where the problem is than a generic EIO. There is no BLK_STS_ value that translates to EINVAL, though, so maybe we need a new block status code like BLK_STS_INVALID_REQUEST. > @@ -53,10 +52,6 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, > return -EOPNOTSUPP; > } > > - bs_mask = (bdev_logical_block_size(bdev) >> 9) - 1; > - if ((sector | nr_sects) & bs_mask) > - return -EINVAL; > - > if (!nr_sects) > return -EINVAL;