Re: [PATCH] block: Add config option to not allow writing to mounted devices

kernel test robot
2023-06-13T04:56:37Z

Hi Jan,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.4-rc6]
[also build test ERROR on linus/master next-20230609]
[cannot apply to axboe-block/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jan-Kara/block-Add-config-option-to-not-allow-writing-to-mounted-devices/20230613-001910
base: v6.4-rc6
patch link: https://lore.kernel.org/r/20230612161614.10302-1-jack%40suse.cz
patch subject: [PATCH] block: Add config option to not allow writing to mounted devices
config: arc-randconfig-r043-20230612 (https://download.01.org/0day-ci/archive/20230613/202306131212.dPssLmeY-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout v6.4-rc6
b4 shazam https://lore.kernel.org/r/20230612161614.10302-1-jack@suse.cz
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306131212.dPssLmeY-lkp@intel.com/

All errors (new ones prefixed by >>):

block/bdev.c: In function 'blkdev_get_whole':
>> block/bdev.c:606:59: error: 'struct block_device' has no member named 'bd_writers'
606 | if (mode & FMODE_EXCL && atomic_read(&bdev->bd_writers) > 0)
| ^~
block/bdev.c:627:33: error: 'struct block_device' has no member named 'bd_writers'
627 | atomic_inc(&bdev->bd_writers);
| ^~
block/bdev.c: In function 'blkdev_put_whole':
block/bdev.c:637:33: error: 'struct block_device' has no member named 'bd_writers'
637 | atomic_dec(&bdev->bd_writers);
| ^~

vim +606 block/bdev.c

599
600 static int blkdev_get_whole(struct block_device *bdev, fmode_t mode)
601 {
602 struct gendisk *disk = bdev->bd_disk;
603 int ret;
604
605 if (IS_ENABLED(BLK_DEV_WRITE_HARDENING)) {
> 606 if (mode & FMODE_EXCL && atomic_read(&bdev->bd_writers) > 0)
607 return -EBUSY;
608 if (mode & FMODE_WRITE && bdev->bd_holders > 0)
609 return -EBUSY;
610 }
611 if (disk->fops->open) {
612 ret = disk->fops->open(bdev, mode);
613 if (ret) {
614 /* avoid ghost partitions on a removed medium */
615 if (ret == -ENOMEDIUM &&
616 test_bit(GD_NEED_PART_SCAN, &disk->state))
617 bdev_disk_changed(disk, true);
618 return ret;
619 }
620 }
621
622 if (!atomic_read(&bdev->bd_openers))
623 set_init_blocksize(bdev);
624 if (test_bit(GD_NEED_PART_SCAN, &disk->state))
625 bdev_disk_changed(disk, false);
626 if (IS_ENABLED(BLK_DEV_WRITE_HARDENING) && mode & FMODE_WRITE)
627 atomic_inc(&bdev->bd_writers);
628 atomic_inc(&bdev->bd_openers);
629 return 0;
630 }
631

--
0-DAY CI Kernel Test Service