[stgt] Failed to write tape greater than 2Gb

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Thu Dec 8 11:48:13 CET 2011


On Thu, 08 Dec 2011 11:16:29 +0100
Gabriele <gabriele.mailing at rvmgroup.it> wrote:

> Hy,
> 
> >> Dec  8 00:48:30 bunch tgtd: tape_rdwr_request(533) capacity over:
> >> 2818600256 2818572288
> > Yeah, looks like you hit the maximum size that you specified when you
> > created the image file with tgtimg.
> 
> This is the first thing I have checked.
> 
> I created the tape image file with:
> 
> sudo tgtimg --op=new \
>              --device-type=tape \
>              --type=data \
>              --size=400000 \
>              --barcode="A00000001" \
>               --file=/media/tgt/vtl/A00000001
> 
> I loaded the tape with:
> 
> sudo tgtadm --lld iscsi \
>                  --mode logicalunit \
>                  --op update \
>                  --tid 1 \
>                  --lun 4 \
>                  --params 
> element_type=2,address=1000,barcode=A00000001,sides=1
> 
> And I have checked that the image was of the right max size:
> 
> sudo tgtimg --op show --device-type tape --file /media/tgt/vtl/A00000001 
> 
> Media     : A00000001
>   type     : Data
> Media serial number : A00000001_1323336503, created Thu Dec  8 10:28:23 2011
> 
> Beginning of Tape(16): Capacity 400000 MB, Blk No.: 0, prev 0, curr 0, 
> next 1152
>        End of Data(32): Blk No. 1, prev 0, curr 1152,  next 1152, sz 0
> 
> The pastebin of all commands and results is at http://pastebin.com/Vckx3gB3
> 
> On the client, after logging in to the target, I checked that the 
> changer is operable:
> 
> $ sudo mtx -f /dev/sg8 status
>    Storage Changer /dev/sg8:1 Drives, 24 Slots ( 0 Import/Export )
> Data Transfer Element 0:Empty
>        Storage Element 1:Full :VolumeTag=A00000001
>        Storage Element 2:Empty:VolumeTag=
> ...
> 
> I loaded the tape:
> 
> $ sudo mtx -f /dev/sg8 load 1
> Loading media from Storage Element 1 into drive 0...done
> 
> Checked again:
> 
> $ sudo mtx -f /dev/sg8 status
>    Storage Changer /dev/sg8:1 Drives, 24 Slots ( 0 Import/Export )
> Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = 
> A00000001
>        Storage Element 1:Empty:VolumeTag=
>        Storage Element 2:Empty:VolumeTag=
> 
> After I checked the tape drive with mt:
> 
> $ sudo mt -f /dev/st0 status
> SCSI 2 tape drive:
> File number=0, block number=0, partition=0.
> Tape block size 0 bytes. Density code 0x0 (default).
> Soft error count since last status=0
> General status bits on (41010000):
>   BOT ONLINE IM_REP_EN
> 
> And finally I launched the tar of 14Gb of files:
> 
> $ sudo tar cvf /dev/st0 .
> ./
> .....
> tar: /dev/st0: Cannot write: No space left on device
> tar: Error is not recoverable: exiting now
> 
> The image file is of this size:
> $ ls -al /media/tgt/vtl/A00000001
> -rw-r----- 1 root root 2818573744 Dec  8 11:10 /media/tgt/vtl/A00000001
> 
> And the error in syslog is
> $ sudo less /var/log/syslog
> Dec  8 11:10:31 bunch tgtd: tape_rdwr_request(533) capacity over: 
> 2818573648 2818572288
> Dec  8 11:10:31 bunch tgtd: tape_rdwr_request(609) io error 0x9a01cb8 a 
> 10240 10240 0, Success
> 
> The full pastebin is at http://pastebin.com/VriTKptc
> 
> Where is the error ?

Thanks, very helpful.

Can you try the following patch with the previous patches?

diff --git a/usr/tgtimg.c b/usr/tgtimg.c
index 169207a..cbad44b 100644
--- a/usr/tgtimg.c
+++ b/usr/tgtimg.c
@@ -257,9 +257,9 @@ static int ssc_new(int op, char *path, char *barcode, char *capacity,
 	struct MAM_info mi;
 	int fd, ret;
 	uint8_t current_media[1024];
-	uint32_t size;
+	uint64_t size;
 
-	sscanf(capacity, "%d", &size);
+	sscanf(capacity, "%llu", &size);
 	if (size == 0)
 		size = 8000;
 
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list