[Linux-cluster] wrong error messages in fence-virt
Masatake YAMATO
yamato at redhat.com
Thu Feb 5 13:04:04 UTC 2015
Mistakenly I sent older patch.
New one is attached to this mail.
Masatake YAMATO
On Thu, 05 Feb 2015 18:57:58 +0900 (JST), Masatake YAMATO <yamato at redhat.com> wrote:
> Is fence-virt still maintained?
> I cannot find the git repository for it.
> There is one at sf.net. However, it looks obsoleted.
>
> With my broken configuration, I got following debug output from
> fence_xvm...
>
> # fence_xvm -H targethost -o status -dddddd
> Debugging threshold is now 6
> -- args @ 0x7fff762de810 --
> ...
> Opening /dev/urandom
> Sending to 225.0.0.12 via 192.168.122.113
> Waiting for connection from XVM host daemon.
> Issuing TCP challenge
>> read: Is a directory
> Invalid response to challenge
> Operation failed
>
> Look at the line marked with '>'. The error message is strange for me
> because as far as reading the source code, read is called with a socket connected
> to fence_virtd.
>
> So I conducted a code walking and found two bugs:
>
> 1. Checking the result of read( and write ) system call
>
> perror is called even if the call is successful.
>
> 2. "read" is specified as an argument for perror when write system call is faield.
>
> Both are not critical if fence_virtd is configured well.
> However, users may be confused when it is not well.
>
>
> Followig patch is not tested at all but it represents what I want to
> say in above list.
>
> Masatake YAMATO
>
>
> --- fence-virt-0.3.2/common/simple_auth.c 2013-11-05 01:08:35.000000000 +0900
> +++ fence-virt-0.3.2/common/simple_auth.c.new 2015-02-05 18:40:53.471029118 +0900
> @@ -260,9 +260,13 @@
> return 0;
> }
>
> - if (read(fd, response, sizeof(response)) < sizeof(response)) {
> + ret = read(fd, response, sizeof(response));
> + if (ret < 0) {
> perror("read");
> return 0;
> + } else if (ret < sizeof(response)) {
> + fprintf(stderr, "RESPONSE is too short(%d) in %s\n", ret, __FUNCTION__);
> + return 0;
> }
>
> ret = !memcmp(response, hash, sizeof(response));
> @@ -333,7 +337,7 @@
> HASH_Destroy(h);
>
> if (write(fd, hash, sizeof(hash)) < sizeof(hash)) {
> - perror("read");
> + perror("write");
> return 0;
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_auth.c.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-cluster/attachments/20150205/dcbfd985/attachment.bin>
More information about the Linux-cluster
mailing list