tree:   
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git 
for-next
head:   89db2b980bb27a5ec625382f8fe7798f6ab10d01
commit: 5cf739d81755e49c39a3bd3c8bf5ec57441710b5 [6/15] dm init: ensure block 
device is ready before creating mapped device
config: loongarch-defconfig 
(https://download.01.org/0day-ci/archive/20260104/[email protected]/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project 
cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20260104/[email protected]/reproduce)

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 <[email protected]>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/md/dm-init.c:314:20: error: call to undeclared function 
>> 'blkdev_get_no_open'; ISO C99 and later do not support implicit function 
>> declarations [-Wimplicit-function-declaration]
     314 |                         while (!(bdev = blkdev_get_no_open(dev, 
false)))
         |                                         ^
>> drivers/md/dm-init.c:314:18: error: incompatible integer to pointer 
>> conversion assigning to 'struct block_device *' from 'int' [-Wint-conversion]
     314 |                         while (!(bdev = blkdev_get_no_open(dev, 
false)))
         |                                       ^ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/md/dm-init.c:316:4: error: call to undeclared function 
>> 'blkdev_put_no_open'; ISO C99 and later do not support implicit function 
>> declarations [-Wimplicit-function-declaration]
     316 |                         blkdev_put_no_open(bdev);
         |                         ^
   3 errors generated.


vim +/blkdev_get_no_open +314 drivers/md/dm-init.c

   267  
   268  /**
   269   * dm_init_init - parse "dm-mod.create=" argument and configure drivers
   270   */
   271  static int __init dm_init_init(void)
   272  {
   273          struct dm_device *dev;
   274          LIST_HEAD(devices);
   275          char *str;
   276          int i, r;
   277  
   278          if (!create)
   279                  return 0;
   280  
   281          if (strlen(create) >= DM_MAX_STR_SIZE) {
   282                  DMERR("Argument is too big. Limit is %d", 
DM_MAX_STR_SIZE);
   283                  return -EINVAL;
   284          }
   285          str = kstrndup(create, DM_MAX_STR_SIZE, GFP_KERNEL);
   286          if (!str)
   287                  return -ENOMEM;
   288  
   289          r = dm_parse_devices(&devices, str);
   290          if (r)
   291                  goto out;
   292  
   293          DMINFO("waiting for all devices to be available before creating 
mapped devices");
   294          wait_for_device_probe();
   295  
   296          for (i = 0; i < ARRAY_SIZE(waitfor); i++) {
   297                  if (waitfor[i]) {
   298                          dev_t dev;
   299                          struct block_device *bdev;
   300  
   301                          DMINFO("waiting for device %s ...", waitfor[i]);
   302                          while (early_lookup_bdev(waitfor[i], &dev))
   303                                  fsleep(5000);
   304  
   305                          /*
   306                           * early_lookup_bdev() only checks if the 
device node exists and
   307                           * returns the dev_t. It does not guarantee 
that the underlying
   308                           * block device is fully initialized and ready 
to be opened. On
   309                           * some platforms, this can lead to a race 
condition where
   310                           * dm_early_create() fails because the device 
is not yet ready.
   311                           * Ensure the block device is truly available 
by attempting to
   312                           * get it.
   313                           */
 > 314                          while (!(bdev = blkdev_get_no_open(dev, false)))
   315                                  fsleep(5000);
 > 316                          blkdev_put_no_open(bdev);
   317                  }
   318          }
   319  
   320          if (waitfor[0])
   321                  DMINFO("all devices available");
   322  
   323          list_for_each_entry(dev, &devices, list) {
   324                  if (dm_early_create(&dev->dmi, dev->table,
   325                                      dev->target_args_array))
   326                          break;
   327          }
   328  out:
   329          kfree(str);
   330          dm_setup_cleanup(&devices);
   331          return r;
   332  }
   333  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to