[OpenAFS] Re: tsmafs utility: rx_Read() returns 0?

Anders Magnusson ragge@ltu.se
Wed, 17 Apr 2013 16:21:38 +0200


On 04/17/2013 08:14 AM, Andrew Deason wrote:
>> I suppose my question is: is it normal/ok for rx_Read() to return 0,
>> or is this in itself indicative of a problem or bug somewhere?
> If the call has an error, we return 0 (and a quick glance at the code,
> I'm not sure I see any case where we return negative). 0 is also for eof
> and maybe some other odd cases like Jeff mentions, but regardless, if
> you know you're supposed to be getting more data (and for that code in
> tsmafs, you do), a 0 is an error. OpenAFS code in general checks for
> <= 0 for errors. I'm assuming you saw an actual error code printed out
> when you modified the code as mentioned?
> And giving a quick look to the tsmafs code around there, it seems to be
> missing error checks on the first rx_Read32 calls, as well. If you want
> to be like openafs code, check for <= 0 return, and look at rx_Error()
> for the actual error code (which you do now). You can just print that
> code directly, or use com_err functions to get an error message.
I got a question about this a while back (since I've written that code), 
but really haven't had time to handle it yet.

There are some fixes and updates made to tsmafs since the code that is 
available, but a check shows that nothing here is changed.

Andrew points out that some error checks are missing, which is true, 
they should be added.  The code has been in use at LTU for like 4 years 
now and since this hasn't been a problem nobody has fixed it.
When I wrote it I used the 1991 Transarc examples about how to do the 
calls, which seemed to work :-)

The code path does a RXAFS_FetchACL(), StartRXAFS_FetchData64(), two 
rx_Read32() and then checks that the file size from fetchacl and the two 
read32 are the same.  Then it assumes that it's just to read the whole 
file size.

I have no idea whether there should be a workaround added for the bug 
Jeff wrote about.

As I am not working at LTU any longer there is a difficulty in testing a 
fix for me.
I will though try to be helpful as much as I have time with for others 
that want to fix it.

-- Ragge