From: sashiko-bot@kernel.org
To: "Laurence Oberman" <loberman@redhat.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/2] scsi: st: Record the tape position after a successful MTLOAD
Date: Sun, 27 Sep 2026 13:23:52 +0000 [thread overview]
Message-ID: <20260927132352.7E2EE1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927131019.4188777-3-loberman@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] scsi: st: Incomplete state reset in MTLOAD leaves eof active
--
commit bbaf6dbbc22cda3f48df1d40d4f966097f9dac28
Author: Laurence Oberman <loberman@redhat.com>
scsi: st: Record the tape position after a successful MTLOAD
This commit sets the tape file and block numbers to 0 after a successful
MTLOAD when the current partition is 0. This addresses an issue with drives
that do not report a new-medium unit attention when the medium is already
loaded, keeping the position state unknown.
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index 3280ec5702493..02aec1cea2470 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -2688,6 +2688,14 @@ static int do_load_unload(struct scsi_tape *STp, struct file *filp, int load_cod
> else {
> STp->rew_at_close = STp->autorew_dev;
> retval = check_tape(STp, filp);
> + /*
> + * LOAD leaves the medium at the beginning of partition
> + * 0. check_tape() records that only for a new session;
> + * without a new-medium unit attention (the medium was
> + * already loaded) the position would stay unknown.
> + */
> + if (retval == CHKRES_READY && STp->partition == 0)
> + STp->ps[0].drv_file = STp->ps[0].drv_block = 0;
[Severity: Medium]
Will this leave the EOF and filemark state flags desynchronized?
If a user reads a tape until EOD, setting STps->eof = ST_EOD, and then
issues an MTLOAD, the tape is physically rewound. The patched code in
do_load_unload() resets the file and block numbers to 0 here, but the
STps->eof flag does not appear to be cleared to ST_NOEOF as it would be
for an MTREW command.
If they attempt to read again, won't st_read() check STps->eof >= ST_EOD_1
and abort with -EIO? Does STps->eof also need to be cleared here to ensure
read() operations succeed after an MTLOAD?
> if (retval > 0)
> retval = 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927131019.4188777-1-loberman@redhat.com?part=2
next prev parent reply other threads:[~2026-09-27 13:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 13:10 [PATCH 0/2] scsi: st: Fix drive settings and position after reset recovery with MTLOAD/MTRETEN Laurence Oberman
2026-09-27 13:10 ` [PATCH 1/2] scsi: st: Restore changed drive settings after reset also for MTLOAD and MTRETEN Laurence Oberman
2026-09-27 13:10 ` [PATCH 2/2] scsi: st: Record the tape position after a successful MTLOAD Laurence Oberman
2026-09-27 13:23 ` sashiko-bot [this message]
2026-09-28 13:26 ` [PATCH 0/2] scsi: st: Fix drive settings and position after reset recovery with MTLOAD/MTRETEN "Kai Mäkisara (Kolumbus)"
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=20260927132352.7E2EE1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
/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