Re: [PATCH] block: propagate partition scanning errors to the BLKRRPART ioctl

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

 



On 4/2/24 09:01, Christoph Hellwig wrote:
> Commit 4601b4b130de ("block: reopen the device in blkdev_reread_part")
> lost the propagation of I/O errors from the low-level read of the
> partition table to the user space caller of the BLKRRPART.
>
> Apparently some user space relies on, so restore the propagation.  This
> isn't exactly pretty as other block device open calls explicitly do not
> are about these errors, so add a new BLK_OPEN_STRICT_SCAN to opt into
> the error propagation.
>
> Fixes: 4601b4b130de ("block: reopen the device in blkdev_reread_part")
> Reported-by: Saranya Muruganandam<saranyamohan@xxxxxxxxxx>
> Signed-off-by: Christoph Hellwig<hch@xxxxxx>

The only change from existing behavior is now we are calling
bdev_disk_changed() after atomic_inc(&bdev->bd_openers) in
blkdev_get_whole(), I guess it should not have any side effects.

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>

-ck

I've verified that existing code in blkdev_get_whole() just returns
0 instead of catching the error from bdev_disk_changed(), with this patch
bdev_disk_changed() error is caught in blkdev_get_whole() and returned to
the userspace in following callchain :-

blkdev_common_ioctl()
  disk_scan_partitions()
   bdev_file_open_by_dev()
    bdev_open()
     blkdev_get_part()
      blkdev_get_whole()
       return bdev_disk_changed() error if
       GD_NEED_PART_SCAN in set
      blkdev_get_whole()
       return bdev_disk_changed() error if
       GD_NEED_PART_SCAN in set





[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