Re: [PATCH V2] block: fail unaligned bio from submit_bio_noacct()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux