v1->v2: 1) Replace BLK_DEV_DUMPINFO with BLK_DEV_WRITE_MOUNTED_QUIET, which is logically opposite; 2) Make BLK_DEV_WRITE_MOUNTED_QUIET dependent on BLK_DEV_WRITE_MOUNTED, and decide whether to set bd_writers by BLK_DEV_WRITE_MOUNTED_QUIET; 3) Move bdev_dump_info() into bdev_may_open(); 4) Add the cmdline interface to control whether to show info; 5) Pass the state of "writes blocked" to part0 when mounting a partition. v2->v3: Add restriction for modifying bd_writers. v3->v4: 1) Count bd_writers regardless of whether bdev_allow_write_mounted is set; 2) Expand the meaning of bdev_allow_write_mounted; 3) Add config option to detect writing to part0 while partitions mounted; 4) Add bd_mounters to record the number of times that part0 or partition is mounted; 5) Show info about opening a lower device for write while upper-layers mounted. v4->v5: Move introduction of bd_mounters to patch1.
Li Lingfeng (5): block: Count writers and mounters regardless of whether bdev_allow_write_mounted is set block: Expand the meaning of bdev_allow_write_mounted block: Add config option to detect writing to part0 while partitions mounted block: Add config option to show info about opening a mounted device for write block: Show info about opening a lower device for write while upper-layers mounted
block/Kconfig | 19 ++++++++ block/bdev.c | 100 +++++++++++++++++++++++++++++++++----- include/linux/blk_types.h | 1 + 3 files changed, 107 insertions(+), 13 deletions(-)