1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

Fix backward compatibility for major:minor query.

Is an application uses query and set major:minor
to device, it should not fallback to default major by default.

Add new function whoich allows that (and use it in lvm2).
This commit is contained in:
Milan Broz 2009-06-17 20:55:24 +00:00
parent be0938ad3c
commit 6391d03f54
8 changed files with 22 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.48 -
===============================
Explicitly request fallback to default major number in device mapper.
Ignore suspended devices during repair.
Call vgreduce --removemissing automatically to clean up bad PVs in dmeventd.
Suggest use lvchange --resync when up converting not yet synced mirror.

View File

@ -1,5 +1,6 @@
Version 1.02.33 -
===============================
Do not fallback to default major number, provide new function instead (1.02.31)
Do not fork daemon when dmeventd cannot be found.
Add crypt target handling to libdevmapper node.
Add splitname command to dmsetup.

View File

@ -111,10 +111,8 @@ static struct dm_task *_setup_task(const char *name, const char *uuid,
if (event_nr)
dm_task_set_event_nr(dmt, *event_nr);
if (major) {
dm_task_set_major(dmt, major);
dm_task_set_minor(dmt, minor);
}
if (major)
dm_task_set_major_minor(dmt, major, minor, 1);
return dmt;
}
@ -171,7 +169,7 @@ int device_is_usable(dev_t dev)
return 0;
}
if (!dm_task_set_major(dmt, MAJOR(dev)) || !dm_task_set_minor(dmt, MINOR(dev)))
if (!dm_task_set_major_minor(dmt, MAJOR(dev), MINOR(dev), 1))
goto_out;
if (!dm_task_run(dmt)) {

View File

@ -24,6 +24,7 @@ dm_task_set_newname
dm_task_set_event_nr
dm_task_set_major
dm_task_set_minor
dm_task_set_major_minor
dm_task_set_sector
dm_task_set_message
dm_task_set_uid

View File

@ -1335,7 +1335,8 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
goto bad;
}
if (!_dm_multiple_major_support && dmt->major != _dm_device_major) {
if (!_dm_multiple_major_support && dmt->allow_default_major_fallback &&
dmt->major != _dm_device_major) {
log_verbose("Overriding major number of %" PRIu32
" with %" PRIu32 " for persistent device.",
dmt->major, _dm_device_major);

View File

@ -41,6 +41,7 @@ struct dm_task {
uint32_t event_nr;
int major;
int minor;
int allow_default_major_fallback;
uid_t uid;
gid_t gid;
mode_t mode;

View File

@ -145,6 +145,7 @@ int dm_task_set_ro(struct dm_task *dmt);
int dm_task_set_newname(struct dm_task *dmt, const char *newname);
int dm_task_set_minor(struct dm_task *dmt, int minor);
int dm_task_set_major(struct dm_task *dmt, int major);
int dm_task_set_major_minor(struct dm_task *dmt, int major, int minor, int allow_default_major_fallback);
int dm_task_set_uid(struct dm_task *dmt, uid_t uid);
int dm_task_set_gid(struct dm_task *dmt, gid_t gid);
int dm_task_set_mode(struct dm_task *dmt, mode_t mode);

View File

@ -118,6 +118,7 @@ struct dm_task *dm_task_create(int type)
dmt->type = type;
dmt->minor = -1;
dmt->major = -1;
dmt->allow_default_major_fallback = 1;
dmt->uid = DM_DEVICE_UID;
dmt->gid = DM_DEVICE_GID;
dmt->mode = DM_DEVICE_MODE;
@ -190,6 +191,7 @@ int dm_task_set_uuid(struct dm_task *dmt, const char *uuid)
int dm_task_set_major(struct dm_task *dmt, int major)
{
dmt->major = major;
dmt->allow_default_major_fallback = 0;
return 1;
}
@ -201,6 +203,16 @@ int dm_task_set_minor(struct dm_task *dmt, int minor)
return 1;
}
int dm_task_set_major_minor(struct dm_task *dmt, int major, int minor,
int allow_default_major_fallback)
{
dmt->major = major;
dmt->minor = minor;
dmt->allow_default_major_fallback = allow_default_major_fallback;
return 1;
}
int dm_task_set_uid(struct dm_task *dmt, uid_t uid)
{
dmt->uid = uid;