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

Robert Sturrock rns@unimelb.edu.au
Wed, 17 Apr 2013 01:55:26 +0000


Hi All.

(I'm not sure if this should go to openafs-info, or the devel list, so I ap=
ologise if I've gotten that wrong).

We are using a small utility here, written by the good people at ltu.se, to=
 backup our OpenAFS cell to TSM.  The tool is "tsmafs" (/afs/ltu.se/misc/ts=
mafs/tsmafs-0.2.tgz), which includes a program called "tabackup" to perform=
 the actual backup.  We found what we believe is a bug, in which rx_Read() =
is used to read data from AFS, but the scenario where this returns 0 bytes =
is not checked.

The outcome of this is that the tool would occasionally read 0 bytes and th=
en continue on, assuming that it had successfully backed up the file in que=
stion, leaving perhaps only a fragment of the file on TSM.

The code _was_ originally as follows (tabackup.c:storefile():322):

               if ((b =3D rx_Read(rxc, buf, len)) < 0)
                        break;

.. so we added the following extra sanity checking to detect this and raise=
 an error:

+                if (b =3D=3D 0)
+                {
+                   rx_error_code =3D rx_Error(rxc);
+                   warnx("zero length rx_Read for %s%s", hl, ll);
+                   warnx("rx error (%ld) tsn (%lld) tsz (%lld) len (%d)", =
rx_error_code, tsn, tsz, len);
+                   break;
+                }

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?

We are running OpenAFS 1.4.12-1.1.2 on the (RHEL5) client.  Fileserver is 1=
.4.10 on Solaris-x86.

Any pointers appreciated ...

Regards,

Robert.=