android_kernel_xiaomi_sm8350/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
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
block
bluetooth [Bluetooth] Correct SCO buffer for Broadcom based Dell laptops 2007-01-09 00:29:59 -08:00
cdrom
char Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2007-01-23 11:19:32 -08:00
clocksource
connector [PATCH] connector: some fixes for ia64 unaligned access errors 2007-01-05 23:55:29 -08:00
cpufreq
crypto
dio
dma
edac
eisa
fc4
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
ide
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
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
macintosh
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
misc
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
parisc
parport
pci PCI: fix pci-driver kernel-doc 2007-01-22 12:00:54 -08:00
pcmcia
pnp
ps3
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
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
telephony
usb [PATCH] funsoft: ktermios fix 2007-01-23 11:09:49 -08:00
video
w1
zorro
Kconfig
Makefile