Skip to contentSkip to conversation

LVM2/libdm/ioctl libdm-iface.c

PATCH [email protected] 3 participants 5 messages Mar 20, 2011 – Mar 21, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2011-03-20 02:00:52

Modified files:
libdm/ioctl : libdm-iface.c

Log message:
Fix last checkin - added error message text wrong.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102

libdm/ioctl/libdm-iface.c +2 -4
@@ -965,10 +965,8 @@
 	if (_check_version(dmversion, sizeof(dmversion), _dm_compat))
 		return 1;
 
-	if (!_dm_compat) {
-		log_error("Support for older device-mapped version is disabled.");
-		goto bad;
-	}
+	if (!_dm_compat)
+		goto_bad;
 
 	log_verbose("device-mapper ioctl protocol version %u failed. "
 		    "Trying protocol version 1.", _dm_version);
#1 lore raw

Dne 20.3.2011 03:00, agk at sourceware.org napsal(a):

Quoted 13 lines

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2011-03-20 02:00:52

Modified files:
libdm/ioctl : libdm-iface.c

Log message:
Fix last checkin - added error message text wrong.

Patches:

libdm/ioctl/libdm-iface.c line 969

Quoted 6 lines
libdm/ioctl/libdm-iface.c +2 -4
-	if (!_dm_compat) {
-		log_error("Support for older device-mapped version is disabled.");
-		goto bad;
-	}
+	if (!_dm_compat)
+		goto_bad;

My patch was only fixing error reporting logic.

Now it's reports 'stack' trace before the actual report.

AFAIK your own rule is - to always report error first and then report 'stack' traces upward.

Did I get this rule wrong - are there some exceptions?

Zdenek

#2 lore raw
Quoted 1 line · Zdenek Kabelac

My patch was only fixing error reporting logic.

One output case:
Failed to get device-mapper version
Support for older device-mapped version is disabled.

A quite misleading pair of messages, I think.

Another output case, when only one version is compiled into the binary:
...
Support for older device-mapped version is disabled.

Support was not compiled in so we shouldn't mention anything about it to the user.

Quoted 1 line

Did I get this rule wrong - are there some exceptions?

We must always have at least one log_error on the error path, but as
few as possible.
We try to place it as low down in the code as we can consistent with
minimising the number of log_errors: it is normally, but not always, at the lowest level.
'stack' is used in other places on error paths.

Alasdair

#3 lore raw

Dne 20.3.2011 22:41, Alasdair G Kergon napsal(a):

Quoted 8 lines · Zdenek Kabelac
Quoted 1 line

My patch was only fixing error reporting logic.

One output case:
Failed to get device-mapper version
Support for older device-mapped version is disabled.

A quite misleading pair of messages, I think.

The order would be opposite - and I believe that giving the user knowledge, that lvm lacks some part of code to handle this situation and code needs to be recompiled with such support is IMHO good hint for error like this.

(Hmm typo - device-mapper)

In fact - Failed to get... should be probably log_warn

And also it's worth to know - we have 2 other log_error() already there:

--
dm_task_create: malloc(
--
Incompatible libdevmapper %s%s and kernel driver %s --

Which might be printed together with "Failed to get..."

So that's why I've tried to add a bit more consistency (which strikes to my eye with latest Milan's commit to this code).

Quoted 6 lines

Another output case, when only one version is compiled into the binary:
...
Support for older device-mapped version is disabled.

Support was not compiled in so we shouldn't mention anything about it to the user.

Well that's where I think 'root' should know why the operation failed.

Quoted 4 lines

We try to place it as low down in the code as we can consistent with
minimising the number of log_errors: it is normally, but not always, at the lowest level.
'stack' is used in other places on error paths.

The other way around would be to remove then all log_error below dm_task_create() - and use there only log_debug/log_warn (i.e. similar to dm_malloc() case where the actual error is defered)

Zdenek

#4 lore raw
Quoted 3 lines

The order would be opposite - and I believe that giving the user knowledge, that lvm lacks some part of code to handle this situation and code needs to be recompiled with such support is IMHO good hint for error like this.

_dm_compat is deprecated functionality and I think the proposed message is very misleading, and most likely nothing to do with the actual problem the user needs to address on that code path.

Quoted 1 line

And also it's worth to know - we have 2 other log_error() already there:

which both look fine (on the deprecated code path).

Quoted 3 lines
Quoted 2 lines

Support was not compiled in so we shouldn't mention anything about it to the user.

Well that's where I think 'root' should know why the operation failed.

No - if the support was not compiled in it is because it is known not to be required.

Alasdair