From: Michael Ablassmeier <abi@grinser.de>
To: stgt@vger.kernel.org
Subject: Re: [PATCH] VTL: Data block may return twice
Date: Sat, 9 Jan 2021 10:41:10 +0100 [thread overview]
Message-ID: <20210109094110.hamvyhaxguqgqslw@lrrr.dead-link.org> (raw)
In-Reply-To: <20210108220259.thrrvjfzxf6otczn@lrrr.dead-link.org>
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]
hi,
see attached patch, makes the bacula btape test be
successful, hope it makes sense.
On Fri, Jan 08, 2021 at 11:02:59PM +0100, Michael Ablassmeier wrote:
> bs_ssc.c
> 346 if (!length) {
> 347 if (h->blk_type == BLK_FILEMARK)
> 348 goto skip_and_out;
>
> which in turn calls
>
> 361 skip_and_out:
> 362 ret = skip_next_header(cmd->dev);
>
> basically moving the position inside the VTL to the wrong place,
> ..making the third read from the tape to return data from the
> same block again :)
>
> bye,
> - michael
[-- Attachment #2: eod_read.diff --]
[-- Type: text/x-diff, Size: 885 bytes --]
diff --git a/usr/bs_ssc.c b/usr/bs_ssc.c
index 5119163..ad47417 100644
--- a/usr/bs_ssc.c
+++ b/usr/bs_ssc.c
@@ -322,16 +322,17 @@ static int resp_var_read(struct scsi_cmd *cmd, uint8_t *buf, uint32_t length,
put_unaligned_be32(val, info);
- if (h->blk_type == BLK_EOD)
- sense_data_build(cmd, 0x40 | BLANK_CHECK,
- NO_ADDITIONAL_SENSE);
- else if (h->blk_type == BLK_FILEMARK)
+ if (h->blk_type == BLK_EOD) {
+ sense_data_build(cmd, NO_SENSE, ASC_END_OF_DATA);
+ return SAM_STAT_CHECK_CONDITION;
+ } else if (h->blk_type == BLK_FILEMARK) {
ssc_sense_data_build(cmd, NO_SENSE | SENSE_FILEMARK,
ASC_MARK, info, sizeof(info));
- else
+ } else {
ssc_sense_data_build(cmd, NO_SENSE | 0x20,
NO_ADDITIONAL_SENSE,
info, sizeof(info));
+ }
if (length > h->blk_sz)
scsi_set_in_resid_by_actual(cmd, length - h->blk_sz);
prev parent reply other threads:[~2021-01-09 9:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 22:02 VTL: Data block may return twice Michael Ablassmeier
2021-01-09 9:41 ` Michael Ablassmeier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210109094110.hamvyhaxguqgqslw@lrrr.dead-link.org \
--to=abi@grinser.de \
--cc=stgt@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).