Commit 7d07402e authored by Jens Axboe's avatar Jens Axboe
Browse files

Merge tag 'md-next-20230814-resend' of...

Merge tag 'md-next-20230814-resend' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-6.6/block

Pull MD fixes from Song:

"1. raid6test build fixes, by WANG Xuerui
 2. Various non-urgent fixes."

* tag 'md-next-20230814-resend' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
  md/raid5-cache: fix null-ptr-deref for r5l_flush_stripe_to_raid()
  raid6: test: only check for Altivec if building on powerpc hosts
  raid6: test: make sure all intermediate and artifact files are .gitignored
  raid6: test: cosmetic cleanups for the test Makefile
  raid6: guard the tables.c include of <linux/export.h> with __KERNEL__
  raid6: remove the <linux/export.h> include from recov.c
  md: Hold mddev->reconfig_mutex when trying to get mddev->sync_thread
  md/raid10: fix a 'conf->barrier' leakage in raid10_takeover()
  md: raid1: fix potential OOB in raid1_remove_disk()
  md/raid5-cache: fix a deadlock in r5l_exit_log()
parents 66a6a5d0 0d0bd28c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -952,8 +952,8 @@ static int join(struct mddev *mddev, int nodes)
	return 0;
err:
	set_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state);
	md_unregister_thread(&cinfo->recovery_thread);
	md_unregister_thread(&cinfo->recv_thread);
	md_unregister_thread(mddev, &cinfo->recovery_thread);
	md_unregister_thread(mddev, &cinfo->recv_thread);
	lockres_free(cinfo->message_lockres);
	lockres_free(cinfo->token_lockres);
	lockres_free(cinfo->ack_lockres);
@@ -1015,8 +1015,8 @@ static int leave(struct mddev *mddev)
		resync_bitmap(mddev);

	set_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state);
	md_unregister_thread(&cinfo->recovery_thread);
	md_unregister_thread(&cinfo->recv_thread);
	md_unregister_thread(mddev, &cinfo->recovery_thread);
	md_unregister_thread(mddev, &cinfo->recv_thread);
	lockres_free(cinfo->message_lockres);
	lockres_free(cinfo->token_lockres);
	lockres_free(cinfo->ack_lockres);
+5 −4
Original line number Diff line number Diff line
@@ -6258,7 +6258,7 @@ static void mddev_detach(struct mddev *mddev)
		mddev->pers->quiesce(mddev, 1);
		mddev->pers->quiesce(mddev, 0);
	}
	md_unregister_thread(&mddev->thread);
	md_unregister_thread(mddev, &mddev->thread);
	if (mddev->queue)
		blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
}
@@ -7990,9 +7990,10 @@ struct md_thread *md_register_thread(void (*run) (struct md_thread *),
}
EXPORT_SYMBOL(md_register_thread);

void md_unregister_thread(struct md_thread __rcu **threadp)
void md_unregister_thread(struct mddev *mddev, struct md_thread __rcu **threadp)
{
	struct md_thread *thread = rcu_dereference_protected(*threadp, true);
	struct md_thread *thread = rcu_dereference_protected(*threadp,
					lockdep_is_held(&mddev->reconfig_mutex));

	if (!thread)
		return;
@@ -9484,7 +9485,7 @@ void md_reap_sync_thread(struct mddev *mddev)
	bool is_reshaped = false;

	/* resync has finished, collect result */
	md_unregister_thread(&mddev->sync_thread);
	md_unregister_thread(mddev, &mddev->sync_thread);
	atomic_inc(&mddev->sync_seq);

	if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
+1 −1
Original line number Diff line number Diff line
@@ -761,7 +761,7 @@ extern struct md_thread *md_register_thread(
	void (*run)(struct md_thread *thread),
	struct mddev *mddev,
	const char *name);
extern void md_unregister_thread(struct md_thread __rcu **threadp);
extern void md_unregister_thread(struct mddev *mddev, struct md_thread __rcu **threadp);
extern void md_wakeup_thread(struct md_thread __rcu *thread);
extern void md_check_recovery(struct mddev *mddev);
extern void md_reap_sync_thread(struct mddev *mddev);
+6 −2
Original line number Diff line number Diff line
@@ -1837,6 +1837,10 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
	struct r1conf *conf = mddev->private;
	int err = 0;
	int number = rdev->raid_disk;

	if (unlikely(number >= conf->raid_disks))
		goto abort;

	struct raid1_info *p = conf->mirrors + number;

	if (rdev != p->rdev)
@@ -3152,7 +3156,7 @@ static int raid1_run(struct mddev *mddev)
	 * RAID1 needs at least one disk in active
	 */
	if (conf->raid_disks - mddev->degraded < 1) {
		md_unregister_thread(&conf->thread);
		md_unregister_thread(mddev, &conf->thread);
		ret = -EINVAL;
		goto abort;
	}
@@ -3179,7 +3183,7 @@ static int raid1_run(struct mddev *mddev)

	ret = md_integrity_register(mddev);
	if (ret) {
		md_unregister_thread(&mddev->thread);
		md_unregister_thread(mddev, &mddev->thread);
		goto abort;
	}
	return 0;
+1 −2
Original line number Diff line number Diff line
@@ -4320,7 +4320,7 @@ static int raid10_run(struct mddev *mddev)
	return 0;

out_free_conf:
	md_unregister_thread(&mddev->thread);
	md_unregister_thread(mddev, &mddev->thread);
	raid10_free_conf(conf);
	mddev->private = NULL;
out:
@@ -4417,7 +4417,6 @@ static void *raid10_takeover_raid0(struct mddev *mddev, sector_t size, int devs)
				rdev->new_raid_disk = rdev->raid_disk * 2;
				rdev->sectors = size;
			}
		WRITE_ONCE(conf->barrier, 1);
	}

	return conf;
Loading