linux/drivers
Kai Makisara 91614c054c [SCSI] st: A MTIOCTOP/MTWEOF within the early warning will cause the file number to be incorrect
On Wed, 24 Jan 2007, Andrew Morton wrote:

> On Mon, 22 Jan 2007 13:07:20 -0800
> bugme-daemon@bugzilla.kernel.org wrote:
>
> > http://bugzilla.kernel.org/show_bug.cgi?id=7864
> >
> >            Summary: A MTIOCTOP/MTWEOF within the early warning will cause
> >                     the file number to be incorrect
> >     Kernel Version: 2.6.19.2
> >             Status: NEW
> >           Severity: low
> >              Owner: io_scsi@kernel-bugs.osdl.org
> >          Submitter: ce_reisinger@yahoo.com
> >
> >
> > Write records to a SCSI tape until a write fails with a ENOSPC (you have reached
> > early warning.
> > Now perform a:
> >    struct mtget before, after;
> >    ioctl(fd, MTIOCGET, &before);
> >    struct mtop mtop = { MTWEOF, 1 };
> >    ioctl(fd, MTIOCTOP, &mtop);
> >    ioctl(fd, MTIOCGET, &after);
> >
> > Check the value of mt_fileno in the before and after structures. Notice the
> > after is 2 greater then the before.
> >
> > The problem appears to be in the block of code starting at line 2817 in st.c.
> > This block is entered because the drive did return a CHECK CONDITION with NO
> > SENSE and the SENSE_EOM bit set. At lines 2824/5 the fileno is incremented. But
> > it has already been increased by the number of filemarks requested by the
> > MTIOCTOP. I believe that the residue count in the sense data should be
> > subtracted from fileno, not a increment as is done.
> >
>
> Thanks.  Could you please send us a tested patch to fix these things, as
> per http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt ?
>
The analysis is basically correct and explains the bug. According to the
SCSI standards, the sense code is NO SENSE or RECOVERED ERROR in case
writing filemark(s) succeeds. If it fails (partly or completely) the sense
code is VOLUME OVERFLOW. The patch below is tested to fix the case when
one filemark is successfully written after the EOM early warning. It
should also fix the case at real EOM but this has not been tested.

Carl, thanks for reporting the bug and providing the analysis for the fix.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-01-27 09:18:21 -06:00
..
acorn [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
acpi [PATCH] ACPI: fix cpufreq regression 2007-01-26 13:50:58 -08:00
amba
ata Fix Maple PATA IRQ assignment. 2007-01-26 17:27:40 -05:00
atm [PATCH] horizon.c: missing __devinit 2007-01-23 11:09:49 -08:00
base [PATCH] fix kernel-doc warnings in 2.6.20-rc1 2006-12-22 08:55:47 -08:00
block [PATCH] Fix BUG at drivers/scsi/scsi_lib.c:1118 caused by "pktsetup dvd /dev/sr0" 2007-01-05 23:55:22 -08:00
bluetooth [Bluetooth] Correct SCO buffer for Broadcom based Dell laptops 2007-01-09 00:29:59 -08:00
cdrom [PATCH] cdrom: set default timeout to 7 seconds 2007-01-03 17:32:54 -08:00
char Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2007-01-23 11:19:32 -08:00
clocksource [PATCH] clocksource: small cleanup 2006-12-10 09:57:22 -08:00
connector [PATCH] connector: some fixes for ia64 unaligned access errors 2007-01-05 23:55:29 -08:00
cpufreq [CPUFREQ] Bug fix for acpi-cpufreq and cpufreq_stats oops on frequency change notification 2006-12-22 22:45:41 -05:00
crypto [PATCH] geode crypto is PCI device 2006-12-10 09:55:40 -08:00
dio
dma [PATCH] slab: remove SLAB_KERNEL 2006-12-07 08:39:24 -08:00
edac [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
eisa
fc4 [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
firmware [PATCH] Fix race in efi variable delete code 2007-01-26 13:51:01 -08:00
hid HID: hid/hid-input.c doesn't need to include linux/usb/input.h 2007-01-21 22:17:57 +01:00
hwmon hwmon/w83793: Hide invalid VID readings 2007-01-18 22:14:24 +01:00
i2c i2c/m41t00: Do not forget to write year 2007-01-05 17:54:05 +01:00
ide [PATCH] atiixp: Old drivers/ide layer driver for the ATIIXP hang fix 2007-01-05 23:55:22 -08:00
ieee1394 ieee1394: sbp2: fix probing of some DVD-ROM/RWs 2007-01-10 20:24:42 +01:00
infiniband IB/ehca: Fix mismatched spin_unlock in irq handler 2007-01-22 17:03:55 -08:00
input [SPARC64]: Fix of_iounmap() region release. 2006-12-31 14:06:05 -08:00
isdn [PATCH] Gigaset ISDN driver error handling fixes 2007-01-26 13:50:58 -08:00
kvm [PATCH] KVM: SVM: Propagate cpu shutdown events to userspace 2007-01-26 13:50:57 -08:00
leds [PATCH] Fix leds-s3c24xx hardware.h reference 2007-01-05 23:55:21 -08:00
macintosh [PATCH] Fix implicit declarations in via-pmu 2007-01-05 23:55:21 -08:00
mca
md [PATCH] md: remove unnecessary printk when raid5 gets an unaligned read. 2007-01-26 13:51:00 -08:00
media V4L/DVB (5123): Buf_qbuf: fix: videobuf_queue->stream corruption and lockup 2007-01-23 22:00:21 -02:00
message [SCSI] fusion: bump version 2007-01-06 09:32:49 -06:00
mfd [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
misc Pull platform-drivers into test branch 2006-12-20 02:52:17 -05:00
mmc mmc: Correct definition of R6 2007-01-15 06:44:03 +01:00
mtd Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-01-18 10:34:51 +11:00
net [BNX2]: Fix 2nd port's MAC address. 2007-01-25 15:49:56 -08:00
nubus
oprofile [PATCH] struct path: convert oprofile 2006-12-08 08:28:48 -08:00
parisc [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
parport [PATCH] Kconfig refactoring for better menu nesting 2006-12-10 09:55:39 -08:00
pci PCI: fix pci-driver kernel-doc 2007-01-22 12:00:54 -08:00
pcmcia [PATCH] Fix numerous kcalloc() calls, convert to kzalloc() 2006-12-13 09:05:52 -08:00
pnp [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
ps3 [POWERPC] ps3: Add vuart support 2006-12-11 13:49:53 +11:00
rapidio
rtc [PATCH] remove __devinit markings from rtc_sysfs_add_device() 2007-01-26 13:51:00 -08:00
s390 Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6 2007-01-09 09:36:06 -08:00
sbus [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
scsi [SCSI] st: A MTIOCTOP/MTWEOF within the early warning will cause the file number to be incorrect 2007-01-27 09:18:21 -06:00
serial [PATCH] x86-64: modpost add more symbols to whitelist pattern2 2007-01-11 01:52:44 +01:00
sh
sn
spi [PATCH] SPI: alternative fix for spi_busnum_to_master 2007-01-26 13:50:58 -08:00
tc [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
telephony [PATCH] struct path: convert ixj 2006-12-08 08:28:46 -08:00
usb [PATCH] funsoft: ktermios fix 2007-01-23 11:09:49 -08:00
video backlight: fix backlight_device_register compile failures 2007-01-02 00:06:18 -05:00
w1 [PATCH] w1: Fix for kconfig entry typo 2006-12-13 09:05:48 -08:00
zorro [PATCH] struct path: convert zorro 2006-12-08 08:28:50 -08:00
Kconfig [PATCH] kvm: userspace interface 2006-12-10 09:57:22 -08:00
Makefile [PATCH] kvm: userspace interface 2006-12-10 09:57:22 -08:00