URL: <http://savannah.cern.ch/bugs/?97560> Summary: bad rc for XrdPosix_Read with bad checksum file Project: XROOTD Submitted by: kotlyar Submitted on: 2012-09-18 09:54 Severity: 3 - Normal Priority: 5 - Normal Status: None Privacy: Public Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Fixed by commit(s): _______________________________________________________ Details: Hi, There is a problem with CASTOR xrootd (xrootd-xcastor2fs-1.2.0-1.castor2113) behavior considering checksum checking. I read a small file with read. rc=XrdPosix_Read(fd,buf,SIZEb); For the "good" file I have rc="the file size" and errno=0 For the "bad" file (wrong checksum attributes) I have rc=0 and errno=0 In the log (/var/log/xroot/server/xrdlog.server) for the bad file I have 120914 14:12:09 17814 castor2ofs_verifychecksum: kotlyar.10818:8@lxc2dev5 Unable to verify checksum - checksum wrong! ; Input/output error 120914 14:12:09 17814 kotlyar.10818:8@lxc2dev5 XrootdResponse: 0100 sending err 3005: Unable to verify checksum - checksum wrong! ; Input/output error So rc is zero but should be -1 as soon as there is an Input\output error. To make a "bad" file: setfattr -n user.castor.checksum.value -v 9fb8f533 [log in to unmask] Here is a small program to check it cc -D_LARGEFILE64_SOURCE -DCTHREAD_POSIX -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -fPIC -D_LARGEFILE_SOURCE -I/usr/include/xrootd -lXrdPosixPreload xrd_read.c #include <XrdPosix/XrdPosixExtern.hh> #include <stdio.h> #include <sys/stat.h> #include <errno.h> #include <fcntl.h> int main(int argc, char *argv[]) { int fd,rc; #define SIZEb 12321 char buf[SIZEb]; int flags=O_RDONLY ; errno =0; rc=XrdPosix_Open(argv[1],flags,0666); printf("open rc = %d errno %d\n", rc, errno); if (-1 == rc) { printf("error open: %s(%d)\n",strerror(errno),errno);return 1;} fd=rc; errno=0; rc=XrdPosix_Read(fd,buf,SIZEb); if (-1 == rc) { printf("error read: %s(%d)\n",strerror(errno),errno);return 1;} printf("read rc = %d errno %d\n", rc, errno); printf("done\n"); XrdPosix_Close(fd); return 0; } For the "good" file we have: [root@lxc2dev5 rtcpd]# runuser kotlyar -c "./a.out root://lxc2dev5d1.cern.ch:1095///nothing\[log in to unmask]\&castor2fs.pfn2=tpsrv" open rc = 7 errno 2 read rc = 774 errno 0 done For the "bad" file we have: [root@lxc2dev5 rtcpd]# runuser kotlyar -c "./a.out root://lxc2dev5d1.cern.ch:1095///nothing\[log in to unmask]\&castor2fs.pfn2=tpsrv" open rc = 7 errno 2 read rc = 0 errno 0 done Regards, Victor _______________________________________________________ Reply to this item at: <http://savannah.cern.ch/bugs/?97560> _______________________________________________ Message sent via/by LCG Savannah http://savannah.cern.ch/ ######################################################################## Use REPLY-ALL to reply to list To unsubscribe from the XROOTD-DEV list, click the following link: https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1