Hi Christoph! > - If BLKROSET is used to set a whole-disk device read-only, any > partitions will end up in a read-only state until the user > explicitly clears the flag. This no longer appears to be the case with your tweak. It's very common for database folks to twiddle the read-only state of block devices and partitions. I know that our users will find it very counter-intuitive that setting /dev/sda read-only won't prevent writes to /dev/sda1. > int bdev_read_only(struct block_device *bdev) > { > if (!bdev) > return 0; > - return bdev->bd_read_only; > + return bdev->bd_read_only || > + test_bit(GD_READ_ONLY, &bdev->bd_disk->state); > } I suggest doing bd->bd_read_only || get_disk_ro(...) here. That does take part0 into account. > static inline int get_disk_ro(struct gendisk *disk) > { > - return disk->part0->bd_read_only; > + return disk->part0->bd_read_only || > + test_bit(GD_READ_ONLY, &disk->state); > } > > extern void disk_block_events(struct gendisk *disk); -- Martin K. Petersen Oracle Linux Engineering