Re: [PATCH 1/3] md: restore bitmap/location to fix wrong bitmap offset while growing

Glass Su <[email protected]>
Newsgroups gmane.linux.raid
Message-ID <[email protected]>

> On Mar 6, 2026, at 06:50, kernel test robot <[email protected]> wrote:
> 
> Hi Su,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on linus/master]
> [also build test ERROR on v7.0-rc2 next-20260305]
> [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/Su-Yue/md-restore-bitmap-location-to-fix-wrong-bitmap-offset-while-growing/20260303-114108
> base:   linus/master
> patch link:    https://lore.kernel.org/r/20260303033731.83885-2-glass.su%40suse.com
> patch subject: [PATCH 1/3] md: restore bitmap/location to fix wrong bitmap offset while growing
> config: i386-randconfig-051-20260305 (https://download.01.org/0day-ci/archive/20260306/[email protected]/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260306/[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 >>):
> 
>   ld: drivers/md/md.o: in function `md_alloc':
>>> drivers/md/md.c:6376:(.text+0xb36c): undefined reference to `md_sysfs_create_common_group'

Forget to test it with 

# CONFIG_MD_BITMAP is not set

Anyway, I will do  revision as Yu Kuai’s suggestion.

— 
Su

> 

> 
> vim +6376 drivers/md/md.c
> 
>  6276 
>  6277 struct mddev *md_alloc(dev_t dev, char *name)
>  6278 {
>  6279 /*
>  6280 * If dev is zero, name is the name of a device to allocate with
>  6281 * an arbitrary minor number.  It will be "md_???"
>  6282 * If dev is non-zero it must be a device number with a MAJOR of
>  6283 * MD_MAJOR or mdp_major.  In this case, if "name" is NULL, then
>  6284 * the device is being created by opening a node in /dev.
>  6285 * If "name" is not NULL, the device is being created by
>  6286 * writing to /sys/module/md_mod/parameters/new_array.
>  6287 */
>  6288 static DEFINE_MUTEX(disks_mutex);
>  6289 struct mddev *mddev;
>  6290 struct gendisk *disk;
>  6291 int partitioned;
>  6292 int shift;
>  6293 int unit;
>  6294 int error;
>  6295 
>  6296 /*
>  6297 * Wait for any previous instance of this device to be completely
>  6298 * removed (mddev_delayed_delete).
>  6299 */
>  6300 flush_workqueue(md_misc_wq);
>  6301 
>  6302 mutex_lock(&disks_mutex);
>  6303 mddev = mddev_alloc(dev);
>  6304 if (IS_ERR(mddev)) {
>  6305 error = PTR_ERR(mddev);
>  6306 goto out_unlock;
>  6307 }
>  6308 
>  6309 partitioned = (MAJOR(mddev->unit) != MD_MAJOR);
>  6310 shift = partitioned ? MdpMinorShift : 0;
>  6311 unit = MINOR(mddev->unit) >> shift;
>  6312 
>  6313 if (name && !dev) {
>  6314 /* Need to ensure that 'name' is not a duplicate.
>  6315 */
>  6316 struct mddev *mddev2;
>  6317 spin_lock(&all_mddevs_lock);
>  6318 
>  6319 list_for_each_entry(mddev2, &all_mddevs, all_mddevs)
>  6320 if (mddev2->gendisk &&
>  6321    strcmp(mddev2->gendisk->disk_name, name) == 0) {
>  6322 spin_unlock(&all_mddevs_lock);
>  6323 error = -EEXIST;
>  6324 goto out_free_mddev;
>  6325 }
>  6326 spin_unlock(&all_mddevs_lock);
>  6327 }
>  6328 if (name && dev)
>  6329 /*
>  6330 * Creating /dev/mdNNN via "newarray", so adjust hold_active.
>  6331 */
>  6332 mddev->hold_active = UNTIL_STOP;
>  6333 
>  6334 disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
>  6335 if (IS_ERR(disk)) {
>  6336 error = PTR_ERR(disk);
>  6337 goto out_free_mddev;
>  6338 }
>  6339 
>  6340 disk->major = MAJOR(mddev->unit);
>  6341 disk->first_minor = unit << shift;
>  6342 disk->minors = 1 << shift;
>  6343 if (name)
>  6344 strcpy(disk->disk_name, name);
>  6345 else if (partitioned)
>  6346 sprintf(disk->disk_name, "md_d%d", unit);
>  6347 else
>  6348 sprintf(disk->disk_name, "md%d", unit);
>  6349 disk->fops = &md_fops;
>  6350 disk->private_data = mddev;
>  6351 
>  6352 disk->events |= DISK_EVENT_MEDIA_CHANGE;
>  6353 mddev->gendisk = disk;
>  6354 error = add_disk(disk);
>  6355 if (error)
>  6356 goto out_put_disk;
>  6357 
>  6358 kobject_init(&mddev->kobj, &md_ktype);
>  6359 error = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, "%s", "md");
>  6360 if (error) {
>  6361 /*
>  6362 * The disk is already live at this point.  Clear the hold flag
>  6363 * and let mddev_put take care of the deletion, as it isn't any
>  6364 * different from a normal close on last release now.
>  6365 */
>  6366 mddev->hold_active = 0;
>  6367 mutex_unlock(&disks_mutex);
>  6368 mddev_put(mddev);
>  6369 return ERR_PTR(error);
>  6370 }
>  6371 
>  6372 /*
>  6373 * md_sysfs_remove_common_group is not needed because mddev_delayed_delete
>  6374 * calls kobject_put(&mddev->kobj) if mddev is to be deleted.
>  6375 */
>> 6376 if (md_sysfs_create_common_group(mddev))
>  6377 pr_warn("md: cannot register common bitmap attributes for %s\n",
>  6378 mdname(mddev));
>  6379 
>  6380 kobject_uevent(&mddev->kobj, KOBJ_ADD);
>  6381 mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state");
>  6382 mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level");
>  6383 mutex_unlock(&disks_mutex);
>  6384 return mddev;
>  6385 
>  6386 out_put_disk:
>  6387 put_disk(disk);
>  6388 out_free_mddev:
>  6389 mddev_free(mddev);
>  6390 out_unlock:
>  6391 mutex_unlock(&disks_mutex);
>  6392 return ERR_PTR(error);
>  6393 }
>  6394 
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.