multipath-tools sector size bug
Hello,
I encountered a problem with the sg_read() routine in readsector0.c while testing an InfiniBand target having 4096 byte sectors. The sg_read() routine assumes that sectors are 512 bytes long.
A patch for the problem follows.
John Kingman
readsector0.c renamed from readsector0.c.orig +6 -2
@@ -51,7 +51,11 @@int res;int rd_opcode[] = {0x8 ,0x28 ,0xa8 ,0x88 };int sz_ind; - +struct stat filestatus; + +if (fstat (sg_fd, &filestatus) !=0 ) +return PATH_DOWN ; + bs = (filestatus.st_blksize >4096 )?4096 : filestatus.st_blksize;memset (rdCmd,0 , cdbsz); sz_ind =1 ; rdCmd[0 ] = rd_opcode[sz_ind];
@@ -97,7 +101,7 @@extern int readsector0 (struct checker * c) { -unsigned char buf[512 ]; +unsigned char buf[4096 ];int ret; ret =sg_read (c->fd, &buf[0 ]);