1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix pvcreate on a partition (regressed in 2.02.51).

Eliminate busy loop during pvcreate of a "normal" partition.
_md_sysfs_attribute_snprintf() would busy loop if the device it was
given was not a blkext-based MD partition.

Rather than being cute with a busy-loop prone 'goto check_md_major' in
_md_sysfs_attribute_snprintf(): explicitly check if the provided device
is a blkext-based partition (blkext_major()); and then check that the
get_primary_dev() determined parent is an MD device (md_major()).
This commit is contained in:
Mike Snitzer 2009-08-19 15:34:33 +00:00
parent c7a3cc0a9b
commit 3d37e976bf
4 changed files with 19 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.52 -
=================================
Fix pvcreate on a partition (2.02.51).
Fix vgcfgrestore error paths when locking fails (2.02.49).
Added configure --enable-clogd to conditionally build the cluster log daemon.
Make lvchange --refresh only take a read lock on volume group.

View File

@ -137,13 +137,15 @@ static int _md_sysfs_attribute_snprintf(char *path, size_t size,
if (!sysfs_dir || !*sysfs_dir)
return ret;
check_md_major:
if (MAJOR(dev) != md_major()) {
if (get_primary_dev(sysfs_dir, blkdev, &dev))
goto check_md_major;
if (MAJOR(dev) == blkext_major()) {
/* lookup parent MD device from blkext partition */
if (!get_primary_dev(sysfs_dir, blkdev, &dev))
return ret;
}
if (MAJOR(dev) != md_major())
return ret;
ret = dm_snprintf(path, size, "%s/dev/block/%d:%d/md/%s", sysfs_dir,
(int)MAJOR(dev), (int)MINOR(dev), attribute);
if (ret < 0) {

View File

@ -38,6 +38,7 @@ typedef struct {
} device_info_t;
static int _md_major = -1;
static int _blkext_major = -1;
static int _device_mapper_major = -1;
int md_major(void)
@ -45,6 +46,11 @@ int md_major(void)
return _md_major;
}
int blkext_major(void)
{
return _blkext_major;
}
/*
* Devices are only checked for partition tables if their minor number
* is a multiple of the number corresponding to their type below
@ -197,6 +203,10 @@ static int _scan_proc_dev(const char *proc, const struct config_node *cn)
if (!strncmp("md", line + i, 2) && isspace(*(line + i + 2)))
_md_major = line_maj;
/* Look for blkext device */
if (!strncmp("blkext", line + i, 6) && isspace(*(line + i + 6)))
_blkext_major = line_maj;
/* Look for device-mapper device */
/* FIXME Cope with multiple majors */
if (!strncmp("device-mapper", line + i, 13) && isspace(*(line + i + 13)))

View File

@ -36,6 +36,7 @@ struct dev_filter *lvm_type_filter_create(const char *proc,
void lvm_type_filter_destroy(struct dev_filter *f);
int md_major(void);
int blkext_major(void);
int max_partitions(int major);
#endif