1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Mitigate some warnings if running as non-root user.

LVM doesn't behave correctly if running as non-root user,
there is warning when it detects it.

Despite this, it produces many error messages, saying nothing.
See https://bugzilla.redhat.com/show_bug.cgi?id=620571

This patch fixes two things:
1) Removes eror message from device_is_usable() which has no
information value anyway (real warning is printed inside it).

2) it fixes device-mapper initialization, if we support
core dm module autoload and device node is present, it should
fail early and not try recreate existing and correct node.
(non-root == permission denied here)

N.B. In future code should support user roles, some more
drastic checks in code are probably contraproductive now.
This commit is contained in:
Milan Broz 2011-03-18 12:17:57 +00:00
parent cb385da467
commit a2222288b5
4 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.85 -
===================================
Mitigate annoying error warning from device is usable check if run as non-root.
Add missing \0 for grown debug object in _bitset_with_random_bits().
Fix allocation of system_id buffer in volume_group structure.
Fix readlink usage inside get_primary_dev().

View File

@ -1,5 +1,6 @@
Version 1.02.64 -
===================================
Fallback to control node creation only if node doesn't exist yet.
Change dm_hash API for binary data to accept const void *key.
Fix memory access of empty params string in _reload_with_suppression_v4().
Lower severity of selabel_lookup and matchpathcon failure to log_debug.

View File

@ -141,10 +141,8 @@ int device_is_usable(struct device *dev)
int only_error_target = 1;
int r = 0;
if (!(dmt = dm_task_create(DM_DEVICE_STATUS))) {
log_error("Failed to create dm_task struct to check dev status");
return 0;
}
if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
return_0;
if (!dm_task_set_major_minor(dmt, MAJOR(dev->dev), MINOR(dev->dev), 1))
goto_out;

View File

@ -365,7 +365,8 @@ static int _open_and_assign_control_fd(const char *control,
_close_control_fd();
if ((_control_fd = open(control, O_RDWR)) < 0) {
if (!(ignore_nodev && errno == ENODEV))
if (ignore_nodev && errno == ENODEV)
return 1;
log_sys_error("open", control);
return 0;
}
@ -412,7 +413,9 @@ static int _open_control(void)
!_create_control(control, major, MAPPER_CTRL_MINOR))
goto error;
_open_and_assign_control_fd(control, 1);
/* Fallback to old code only if control node doesn't exist */
if (!_open_and_assign_control_fd(control, 1))
goto error;
}
/*