dm-mp: revalidate paths with zero size prior to use
PATCH 1/1 dm-mp: revalidate paths with zero size prior to use
From: Mike Anderson <[email protected]>
Revalidate zero size path prior to using.
Signed-off-by Mike Anderson <[email protected]>
---
This patch currently only does a revalidate if the size is zero to reduce impact to existing configurations.
Visual change to the user is the dmesg will contain revalidate info for each device.
drivers/md/dm-mpath.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/md/dm-mpath.c +24 -0
@@ -107,6 +107,27 @@static void process_queued_ios (struct work_struct *work);static void trigger_event (struct work_struct *work); +static void dm_check_dev_size (struct priority_group *pg) +{ +struct pgpath *pgpath; +struct block_device *bdev; +sector_t dev_size; + +if (!pg) +return ; + +list_for_each_entry (pgpath, &pg->pgpaths, list) { + bdev = pgpath->path.dev->bdev; + dev_size = bdev->bd_inode->i_size >>SECTOR_SHIFT ; + +if (!dev_size) { +struct gendisk *gd = bdev->bd_disk; +if (gd->fops->revalidate_disk) + gd->fops->revalidate_disk (gd); +bd_set_size (bdev, (loff_t )get_capacity (gd)<<9 ); + } + } +}/*----------------------------------------------- * Allocation routines
@@ -224,6 +245,7 @@ }else { m->pg_init_required =0 ; m->queue_io =0 ; +dm_check_dev_size (m->current_pg); } }
@@ -1002,6 +1024,8 @@ }else if (!m->pg_init_required) m->queue_io =0 ; +dm_check_dev_size (m->current_pg); + m->pg_init_in_progress =0 ;queue_work (kmultipathd, &m->process_queued_ios);spin_unlock_irqrestore (&m->lock, flags);
Alasdair G Kergon
maintainerQuoted 1 line · Mike Anderson
Revalidate zero size path prior to using.
Are new checks also needed for non-multipath configurations too now?
Alasdair
Signature · 1 line
[email protected]