linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Xiao Ni <xni@redhat.com>, linux-raid@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, yukuai@fnnas.com, song@kernel.org
Subject: Re: [PATCH 1/1] md: avoid repeated calls to del_gendisk
Date: Wed, 29 Oct 2025 14:15:06 +0800	[thread overview]
Message-ID: <202510291426.ewU26n4f-lkp@intel.com> (raw)
In-Reply-To: <20251028133737.98300-1-xni@redhat.com>

Hi Xiao,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.18-rc3 next-20251029]
[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/Xiao-Ni/md-avoid-repeated-calls-to-del_gendisk/20251028-214651
base:   linus/master
patch link:    https://lore.kernel.org/r/20251028133737.98300-1-xni%40redhat.com
patch subject: [PATCH 1/1] md: avoid repeated calls to del_gendisk
config: microblaze-randconfig-r051-20251029 (https://download.01.org/0day-ci/archive/20251029/202510291426.ewU26n4f-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251029/202510291426.ewU26n4f-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510291426.ewU26n4f-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/md/md.c: In function 'mddev_unlock':
>> drivers/md/md.c:945:50: error: expected ')' before 'del_gendisk'
       !test_and_set_bit(MD_DO_DELETE, &mddev->flags)
                                                     ^
                                                     )
       del_gendisk(mddev->gendisk);
       ~~~~~~~~~~~                                    
   drivers/md/md.c:944:6: note: to match this '('
      if (test_bit(MD_DELETED, &mddev->flags) &&
         ^
>> drivers/md/md.c:947:2: error: expected expression before '}' token
     }
     ^


vim +945 drivers/md/md.c

   877	
   878	void mddev_unlock(struct mddev *mddev)
   879	{
   880		struct md_rdev *rdev;
   881		struct md_rdev *tmp;
   882		LIST_HEAD(delete);
   883	
   884		if (!list_empty(&mddev->deleting))
   885			list_splice_init(&mddev->deleting, &delete);
   886	
   887		if (mddev->to_remove) {
   888			/* These cannot be removed under reconfig_mutex as
   889			 * an access to the files will try to take reconfig_mutex
   890			 * while holding the file unremovable, which leads to
   891			 * a deadlock.
   892			 * So hold set sysfs_active while the remove in happeing,
   893			 * and anything else which might set ->to_remove or my
   894			 * otherwise change the sysfs namespace will fail with
   895			 * -EBUSY if sysfs_active is still set.
   896			 * We set sysfs_active under reconfig_mutex and elsewhere
   897			 * test it under the same mutex to ensure its correct value
   898			 * is seen.
   899			 */
   900			const struct attribute_group *to_remove = mddev->to_remove;
   901			mddev->to_remove = NULL;
   902			mddev->sysfs_active = 1;
   903			mutex_unlock(&mddev->reconfig_mutex);
   904	
   905			if (mddev->kobj.sd) {
   906				if (to_remove != &md_redundancy_group)
   907					sysfs_remove_group(&mddev->kobj, to_remove);
   908				if (mddev->pers == NULL ||
   909				    mddev->pers->sync_request == NULL) {
   910					sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
   911					if (mddev->sysfs_action)
   912						sysfs_put(mddev->sysfs_action);
   913					if (mddev->sysfs_completed)
   914						sysfs_put(mddev->sysfs_completed);
   915					if (mddev->sysfs_degraded)
   916						sysfs_put(mddev->sysfs_degraded);
   917					mddev->sysfs_action = NULL;
   918					mddev->sysfs_completed = NULL;
   919					mddev->sysfs_degraded = NULL;
   920				}
   921			}
   922			mddev->sysfs_active = 0;
   923		} else
   924			mutex_unlock(&mddev->reconfig_mutex);
   925	
   926		md_wakeup_thread(mddev->thread);
   927		wake_up(&mddev->sb_wait);
   928	
   929		list_for_each_entry_safe(rdev, tmp, &delete, same_set) {
   930			list_del_init(&rdev->same_set);
   931			kobject_del(&rdev->kobj);
   932			export_rdev(rdev, mddev);
   933		}
   934	
   935		if (!legacy_async_del_gendisk) {
   936			/*
   937			 * Call del_gendisk after release reconfig_mutex to avoid
   938			 * deadlock (e.g. call del_gendisk under the lock and an
   939			 * access to sysfs files waits the lock)
   940			 * And MD_DELETED is only used for md raid which is set in
   941			 * do_md_stop. dm raid only uses md_stop to stop. So dm raid
   942			 * doesn't need to check MD_DELETED when getting reconfig lock
   943			 */
   944			if (test_bit(MD_DELETED, &mddev->flags) &&
 > 945				!test_and_set_bit(MD_DO_DELETE, &mddev->flags)
   946				del_gendisk(mddev->gendisk);
 > 947		}
   948	}
   949	EXPORT_SYMBOL_GPL(mddev_unlock);
   950	

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

      parent reply	other threads:[~2025-10-29  6:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 13:37 [PATCH 1/1] md: avoid repeated calls to del_gendisk Xiao Ni
2025-10-28 15:33 ` Yu Kuai
2025-10-29  5:42 ` kernel test robot
2025-10-29  6:15 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202510291426.ewU26n4f-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=song@kernel.org \
    --cc=xni@redhat.com \
    --cc=yukuai@fnnas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).