[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] Possible bug in nbd-client



Hello,

While using ndb, I got into trouble and think I may have stumbled on a
bug. Below is the description of the problem.

Referring to the latest version code (2.9.24), in the client tool
(ndb-client.c), at the end of the function "negotiate", the following
code is made:

if (read(sock, &buf, 124) < 0)
    err(...);

which is to retrieve the 124 zeroed bytes that the server sends at the
end of the negotiation.

The problem is that the above call may actually return far less than 124
zeroed bytes, which would leave some zeroed bytes in the socket and
cause problems with reception of replies in the ndb kernel module. I
actually got this problem: even though negotiation succeeds, as soon as
the first request is sent by the client, the reply for it gets an
invalid magic error and the client disconnect.

I think that the above read should be in a loop, similar to what is done
in the function readit in the server side.

Best regards.

-- 
Damien Le Moal,
Hitachi Ltd. Yokohama Lab. Japan.




Reply to: