Merge tag 'md-6.10-20240425' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-6.10/block
Pull MD fixes from Song: "These changes contain various fixes by Yu Kuai, Li Nan, and Florian-Ewald Mueller." * tag 'md-6.10-20240425' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md: md: don't account sync_io if iostats of the disk is disabled md: Fix overflow in is_mddev_idle md: add check for sleepers in md_wakeup_thread() md/raid5: fix deadlock that raid5d() wait for itself to clear MD_SB_CHANGE_PENDING
This commit is contained in:
commit
bf4f776d9f
@ -8087,7 +8087,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)
|
||||
if (t) {
|
||||
pr_debug("md: waking up MD thread %s.\n", t->tsk->comm);
|
||||
set_bit(THREAD_WAKEUP, &t->flags);
|
||||
wake_up(&t->wqueue);
|
||||
if (wq_has_sleeper(&t->wqueue))
|
||||
wake_up(&t->wqueue);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
}
|
||||
@ -8576,14 +8577,19 @@ static int is_mddev_idle(struct mddev *mddev, int init)
|
||||
{
|
||||
struct md_rdev *rdev;
|
||||
int idle;
|
||||
int curr_events;
|
||||
long long curr_events;
|
||||
|
||||
idle = 1;
|
||||
rcu_read_lock();
|
||||
rdev_for_each_rcu(rdev, mddev) {
|
||||
struct gendisk *disk = rdev->bdev->bd_disk;
|
||||
curr_events = (int)part_stat_read_accum(disk->part0, sectors) -
|
||||
atomic_read(&disk->sync_io);
|
||||
|
||||
if (!init && !blk_queue_io_stat(disk->queue))
|
||||
continue;
|
||||
|
||||
curr_events =
|
||||
(long long)part_stat_read_accum(disk->part0, sectors) -
|
||||
atomic64_read(&disk->sync_io);
|
||||
/* sync IO will cause sync_io to increase before the disk_stats
|
||||
* as sync_io is counted when a request starts, and
|
||||
* disk_stats is counted when it completes.
|
||||
|
||||
@ -51,7 +51,7 @@ struct md_rdev {
|
||||
|
||||
sector_t sectors; /* Device size (in 512bytes sectors) */
|
||||
struct mddev *mddev; /* RAID array if running */
|
||||
int last_events; /* IO event timestamp */
|
||||
long long last_events; /* IO event timestamp */
|
||||
|
||||
/*
|
||||
* If meta_bdev is non-NULL, it means that a separate device is
|
||||
@ -621,7 +621,8 @@ extern void mddev_unlock(struct mddev *mddev);
|
||||
|
||||
static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
|
||||
{
|
||||
atomic_add(nr_sectors, &bdev->bd_disk->sync_io);
|
||||
if (blk_queue_io_stat(bdev->bd_disk->queue))
|
||||
atomic64_add(nr_sectors, &bdev->bd_disk->sync_io);
|
||||
}
|
||||
|
||||
static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/raid/pq.h>
|
||||
#include <linux/async_tx.h>
|
||||
@ -6734,6 +6733,9 @@ static void raid5d(struct md_thread *thread)
|
||||
int batch_size, released;
|
||||
unsigned int offset;
|
||||
|
||||
if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags))
|
||||
break;
|
||||
|
||||
released = release_stripe_list(conf, conf->temp_inactive_list);
|
||||
if (released)
|
||||
clear_bit(R5_DID_ALLOC, &conf->cache_state);
|
||||
@ -6770,18 +6772,7 @@ static void raid5d(struct md_thread *thread)
|
||||
spin_unlock_irq(&conf->device_lock);
|
||||
md_check_recovery(mddev);
|
||||
spin_lock_irq(&conf->device_lock);
|
||||
|
||||
/*
|
||||
* Waiting on MD_SB_CHANGE_PENDING below may deadlock
|
||||
* seeing md_check_recovery() is needed to clear
|
||||
* the flag when using mdmon.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
wait_event_lock_irq(mddev->sb_wait,
|
||||
!test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags),
|
||||
conf->device_lock);
|
||||
}
|
||||
pr_debug("%d stripes handled\n", handled);
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ struct gendisk {
|
||||
struct list_head slave_bdevs;
|
||||
#endif
|
||||
struct timer_rand_state *random;
|
||||
atomic_t sync_io; /* RAID */
|
||||
atomic64_t sync_io; /* RAID */
|
||||
struct disk_events *ev;
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_ZONED
|
||||
|
||||
Loading…
Reference in New Issue
Block a user