[stgt] Failed to write tape greater than 2Gb

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Wed Dec 7 23:50:52 CET 2011


On Wed, 07 Dec 2011 23:34:57 +0100
Gabriele <gabriele.mailing at rvmgroup.it> wrote:

> Hy,
> 
> > _LARGEFILE64_SOURCE should be already defined due to _GNU_SOURCE.
> > Can you try the following?
> > diff --git a/usr/bs_ssc.c b/usr/bs_ssc.c
> > index b80ece8..e4f1a71 100644
> > diff --git a/usr/libssc.c b/usr/libssc.c
> > index e13a9f6..a4a0687 100644
> > diff --git a/usr/libssc.h b/usr/libssc.h
> > index ace2037..e844346 100644
> 
> It works.
> I have firstly tested vanilla 1.0.22 under amd64 and after I have 
> applied the patches for i386
> The image file was written beyond 2Gb in both cases.

Nice.

> Do you want that i test the patch under amd64 too ?

No.

> The strange thing is that in both architectures, the image file has been 
> filled until 2.7Gb, after that, tar gave the error
> 
> tar: /dev/st0: Cannot write: No space left on device
> 
> And in syslog I have:
> 
> Dec  7 22:38:24 bunch tgtd: tape_rdwr_request(604) io error 0x9c20cb8 a 
> 32768 32768 0, Success
> 
> Strange: there are a plenty of Gb free on the partition holding the 
> image files, and the image file was created with a dimension of 400Gb:
> 
> sudo tgtimg --op=new --device-type=tape --barcode="A00000001" 
> --size=400000 --type=data --file=/media/tgt/vtl/A00000001
> 
> The image file seems to report the correct size:

Can you try the following patch on the top of the previous one?

diff --git a/usr/bs_ssc.c b/usr/bs_ssc.c
index b80ece8..b051f83 100644
--- a/usr/bs_ssc.c
+++ b/usr/bs_ssc.c
@@ -113,7 +113,7 @@ static int resp_rewind(struct scsi_lu *lu)
 	return skip_next_header(lu);
 }
 
-static unsigned long current_size(struct scsi_cmd *cmd)
+static uint64_t current_size(struct scsi_cmd *cmd)
 {
 	struct ssc_info *ssc = dtype_priv(cmd->dev);
 	return ssc->c_blk.curr;
@@ -528,12 +528,17 @@ static void tape_rdwr_request(struct scsi_cmd *cmd)
 			sense_data_build(cmd, NO_SENSE|SENSE_EOM,
 						NO_ADDITIONAL_SENSE);
 			result = SAM_STAT_CHECK_CONDITION;
+			eprintf("capacity over: %llu %llu\n",
+				(unsigned long long)current_size(cmd),
+				(unsigned long long)ssc->mam.max_capacity);
 			break;
 		}
 
 		if (ret != length) {
 			sense_data_build(cmd, MEDIUM_ERROR, ASC_WRITE_ERROR);
 			result = SAM_STAT_CHECK_CONDITION;
+			eprintf("io error %u %u\n", ret, length);
+
 		}
 		break;
 
--
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