History log of /drivers/scsi/st.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a75ee6ecd411a50bf4da927c2fdb2cb56246a2bd 31-Mar-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

Pull SCSI updates from James Bottomley:
"This is primarily another round of driver updates (lpfc, bfa, fcoe,
ipr) plus a new ufshcd driver. There shouldn't be anything
controversial in here (The final deletion of scsi proc_ops which
caused some build breakage has been held over until the next merge
window to give us more time to stabilise it).

I'm afraid, with me moving continents at exactly the wrong time,
anything submitted after the merge window opened has been held over to
the next merge window."

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (63 commits)
[SCSI] ipr: Driver version 2.5.3
[SCSI] ipr: Increase alignment boundary of command blocks
[SCSI] ipr: Increase max concurrent oustanding commands
[SCSI] ipr: Remove unnecessary memory barriers
[SCSI] ipr: Remove unnecessary interrupt clearing on new adapters
[SCSI] ipr: Fix target id allocation re-use problem
[SCSI] atp870u, mpt2sas, qla4xxx use pci_dev->revision
[SCSI] fcoe: Drop the rtnl_mutex before calling fcoe_ctlr_link_up
[SCSI] bfa: Update the driver version to 3.0.23.0
[SCSI] bfa: BSG and User interface fixes.
[SCSI] bfa: Fix to avoid vport delete hang on request queue full scenario.
[SCSI] bfa: Move service parameter programming logic into firmware.
[SCSI] bfa: Revised Fabric Assigned Address(FAA) feature implementation.
[SCSI] bfa: Flash controller IOC pll init fixes.
[SCSI] bfa: Serialize the IOC hw semaphore unlock logic.
[SCSI] bfa: Modify ISR to process pending completions
[SCSI] bfa: Add fc host issue lip support
[SCSI] mpt2sas: remove extraneous sas_log_info messages
[SCSI] libfc: fcoe_transport_create fails in single-CPU environment
[SCSI] fcoe: reduce contention for fcoe_rx_list lock [v2]
...
9ffc93f203c18a70623f21950f1dd473c9ec48cd 28-Mar-2012 David Howells <dhowells@redhat.com> Remove all #inclusions of asm/system.h

Remove all #inclusions of asm/system.h preparatory to splitting and killing
it. Performed with the following command:

perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`

Signed-off-by: David Howells <dhowells@redhat.com>
/drivers/scsi/st.c
c743e44fbb1f8668941e83de07662b1ecd33d083 01-Mar-2012 Lee Duncan <lduncan@suse.com> [SCSI] st: expand ability to write immediate filemarks

The st tape driver recently added the MTWEOFI ioctl, which writes
a tape filemark (EOF), like the MTWEOF ioctl, except that MTWEOFI
returns immediately. This makes certain applications, like backup
software, run much more quickly on buffered tape drives.

Since legacy applications do not know about this new MTWEOFI ioctl,
this patch adds a new ioctl option that tells the st driver to return
immediately when writing an EOF (i.e. a filemark). This new flag
is much like the existing flag that tells the st driver to perform
writes (and certain other IOs) immediately, but this new flag only
applies to writing EOFs.

This new feature is controlled via the MTSETDRVBUFFER ioctl, using
the newly-defined MT_ST_NOWAIT_EOF flag.

Use of this new feature is displayed via the sysfs tape "options"
attribute.

The st documentation was updated to mention this new flag, as well
as the problems that can occur from using it.

Signed-off-by: Lee Duncan <lduncan@suse.com>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/st.c
46a243f72de931aad2632a0f3de3612534212ae9 15-Jan-2012 Oliver Neukum <oliver@neukum.org> [SCSI] st: implement PM

This implements basic power management for SCSI tapes.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/st.c
c68bf8eeaa57c852e74adcf597237be149eef830 21-Oct-2011 Petr Uzel <petr.uzel@suse.cz> [SCSI] st: fix race in st_scsi_execute_end

The call to complete() in st_scsi_execute_end() wakes up sleeping thread
in write_behind_check(), which frees the st_request, thus invalidating
the pointer to the associated bio structure, which is then passed to the
blk_rq_unmap_user(). Fix by storing pointer to bio structure into
temporary local variable.

This bug is present since at least linux-2.6.32.

CC: stable@kernel.org
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Reported-by: Juergen Groß <juergen.gross@ts.fujitsu.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/st.c
46081b166415acb66d4b3150ecefcd9460bb48a1 20-Dec-2010 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: Increase success probability in driver buffer allocation

Modify allocation to try the minimum possible page order allowed by the HBA
scatter/gather segment limit in allocation of the driver's internal
buffer. This increases the probability of successful allocation. The
allocation may still fail if this minimum order is > 0.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Reported-by: Lukas Kolbe <lkolbe@techfak.uni-bielefeld.de>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
/drivers/scsi/st.c
373daacfce9ea0091cb3027572354ddebefb8ebb 20-Dec-2010 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: Store page order before driver buffer allocation

The order of the pages allocated for the driver buffer must be stored before
allocation because it is used in freeing already allocated pages if
allocation fails.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Reported-by: Lukas Kolbe <lkolbe@techfak.uni-bielefeld.de>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
/drivers/scsi/st.c
c70b5296e775cde46cfcb2d860ba160108a5ec7a 23-Oct-2010 Linus Torvalds <torvalds@linux-foundation.org> Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (84 commits)
[SCSI] be2iscsi: SGE Len == 64K
[SCSI] be2iscsi: Remove premature free of cid
[SCSI] be2iscsi: More time for FW
[SCSI] libsas: fix bug for vacant phy
[SCSI] sd: Fix overflow with big physical blocks
[SCSI] st: add MTWEOFI to write filemarks without flushing drive buffer
[SCSI] libsas: Don't issue commands to devices that have been hot-removed
[SCSI] megaraid_sas: Add Online Controller Reset to MegaRAID SAS drive
[SCSI] lpfc 8.3.17: Update lpfc driver version to 8.3.17
[SCSI] lpfc 8.3.17: Replace function reset methodology
[SCSI] lpfc 8.3.17: SCSI fixes
[SCSI] lpfc 8.3.17: BSG fixes
[SCSI] lpfc 8.3.17: SLI Additions and Fixes
[SCSI] lpfc 8.3.17: Code Cleanup and Locking fixes
[SCSI] zfcp: Remove scsi_cmnd->serial_number from debug traces
[SCSI] ipr: fix array error logging
[SCSI] aha152x: enable PCMCIA on 64bit
[SCSI] scsi_dh_alua: Handle all states correctly
[SCSI] cxgb4i: connection and ddp setting update
[SCSI] cxgb3i: fixed connection over vlan
...
3e51d3c924aea8a1f1372e6c615b0a37b528121d 08-Oct-2010 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: add MTWEOFI to write filemarks without flushing drive buffer

This patch adds a new MTIOCTOP operation MTWEOFI that writes filemarks with
immediate bit set. This means that the drive does not flush its buffer and the
next file can be started immediately. This speeds up writing in applications
that have to write multiple small files.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
/drivers/scsi/st.c
2a48fc0ab24241755dc93bfd4f01d68efab47f5a 02-Jun-2010 Arnd Bergmann <arnd@arndb.de> block: autoconvert trivial BKL users to private mutex

The block device drivers have all gained new lock_kernel
calls from a recent pushdown, and some of the drivers
were already using the BKL before.

This turns the BKL into a set of per-driver mutexes.
Still need to check whether this is safe to do.

file=$1
name=$2
if grep -q lock_kernel ${file} ; then
if grep -q 'include.*linux.mutex.h' ${file} ; then
sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
else
sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
fi
sed -i ${file} \
-e "/^#include.*linux.mutex.h/,$ {
1,/^\(static\|int\|long\)/ {
/^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

} }" \
-e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
-e '/[ ]*cycle_kernel_lock();/d'
else
sed -i -e '/include.*\<smp_lock.h\>/d' ${file} \
-e '/cycle_kernel_lock()/d'
fi

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
/drivers/scsi/st.c
b4d878e23c7f574490ee4d6fd59ebd6819781dd1 26-May-2010 Jan Blunck <jblunck@suse.de> st: use noop_llseek() instead of default_llseek()

st_open() suggests that llseek() doesn't work: "We really want to do
nonseekable_open(inode, filp); here, but some versions of tar incorrectly
call lseek on tapes and bail out if that fails. So we disallow pread()
and pwrite(), but permit lseeks."

Instead of using the fallback default_llseek() the driver should use
noop_llseek() which leaves the file->f_pos untouched but succeeds.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Kai Makisara <Kai.Makisara@kolumbus.fi>
Cc: Willem Riede <osst@riede.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/scsi/st.c
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
/drivers/scsi/st.c
8a78362c4eefc1deddbefe2c7f38aabbc2429d6b 26-Feb-2010 Martin K. Petersen <martin.petersen@oracle.com> block: Consolidate phys_segment and hw_segment limits

Except for SCSI no device drivers distinguish between physical and
hardware segment limits. Consolidate the two into a single segment
limit.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/scsi/st.c
c982c368bb90adbd312faa05d0cfd842e9ab45a7 26-Nov-2009 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: fix mdata->page_order handling

dio transfer always resets mdata->page_order to zero. It breaks
high-order pages previously allocated for non-dio transfer.

This patches adds reserved_page_order to st_buffer structure to save
page order for non-dio transfer.

http://bugzilla.kernel.org/show_bug.cgi?id=14563

When enlarge_buffer() allocates 524288 from 0, st uses six-order page
allocation. So mdata->page_order is 6 and frp_seg is 2.

After that, if st uses dio, sgl_map_user_pages() sets
mdata->page_order to 0 for st_do_scsi(). After that, when we call
normalize_buffer(), it frees only free frp_seg * PAGE_SIZE (2 * 4096)
though we should free frp_seg * PAGE_SIZE << 6 (2 * 4096 << 6). So we
see buffer_size is set to 516096 (524288 - 8192).

Reported-by: Joachim Breuer <linux-kernel@jmbreuer.net>
Tested-by: Joachim Breuer <linux-kernel@jmbreuer.net>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: stable@kernel.org
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
/drivers/scsi/st.c
832151f45806613f203c4c0308c1566d882b971f 17-Nov-2009 Roel Kluin <roel.kluin@gmail.com> [SCSI] st: fix test of value range in st_set_options()

value cannot logically be less than START and greater than BUFFERSIZE.

#define EXTENDED_SENSE_START 18

// vi include/scsi/scsi_cmnd.h +105
#define SCSI_SENSE_BUFFERSIZE 96

[akpm@linux-foundation.org: fix warning]
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
/drivers/scsi/st.c
2c2ed8bfd899b84ecbf71d28fcc2cc4ace36c8d9 28-Sep-2009 David Jeffery <djeffery@redhat.com> [SCSI] st: fix possible memory use after free after MTSETBLK ioctl

A memory use after free bug can manifest if the MTSETBLK or SET_DENS_AND_BLK
ioctl features are used to set the tape's blocksize from 0 to non-zero.
After the driver sets the new block size, in this one case it calls
normalize_buffer() to free the device's internal data buffers. However, the
ioctl code assumes there is always a buffer and does not check or allocate
a buffer if there isn't one. So any following ioctl calls can corrupt
a part of memory by writing data to memory that the st driver had freed.

This patch removes the normalize_buffer() call and the specialness of
changing from a 0 to non-zero blocksize to fix the possible use of
memory after it has been freed by the st driver.

signed-off-by: David Jeffery <djeffery@redhat.com>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
/drivers/scsi/st.c
82681a318f9f028ea64e61f24bbd9ac535531921 12-Jun-2009 James Bottomley <James.Bottomley@HansenPartnership.com> [SCSI] Merge branch 'linus'

Conflicts:
drivers/message/fusion/mptsas.c

fixed up conflict between req->data_len accessors and mptsas driver updates.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
1da2019fffc65c02a613305919bac28c9bdfaf99 02-May-2009 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: fix gcc 4.4 warning

This patch fixes the GCC 4.4 warning reported by David Binderman and Sergey
Senozhatsky. The old version was working correctly but was not easy to read.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
ae03bf639a5027d27270123f5f6e3ee6a412781d 22-May-2009 Martin K. Petersen <martin.petersen@oracle.com> block: Use accessor functions for queue limits

Convert all external users of queue limits to using wrapper functions
instead of poking the request queue variables directly.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/scsi/st.c
c3a4d78c580de4edc9ef0f7c59812fb02ceb037f 07-May-2009 Tejun Heo <tj@kernel.org> block: add rq->resid_len

rq->data_len served two purposes - the length of data buffer on issue
and the residual count on completion. This duality creates some
headaches.

First of all, block layer and low level drivers can't really determine
what rq->data_len contains while a request is executing. It could be
the total request length or it coulde be anything else one of the
lower layers is using to keep track of residual count. This
complicates things because blk_rq_bytes() and thus
[__]blk_end_request_all() relies on rq->data_len for PC commands.
Drivers which want to report residual count should first cache the
total request length, update rq->data_len and then complete the
request with the cached data length.

Secondly, it makes requests default to reporting full residual count,
ie. reporting that no data transfer occurred. The residual count is
an exception not the norm; however, the driver should clear
rq->data_len to zero to signify the normal cases while leaving it
alone means no data transfer occurred at all. This reverse default
behavior complicates code unnecessarily and renders block PC on some
drivers (ide-tape/floppy) unuseable.

This patch adds rq->resid_len which is used only for residual count.

While at it, remove now unnecessasry blk_rq_bytes() caching in
ide_pc_intr() as rq->data_len is not changed anymore.

Boaz : spotted missing conversion in osd
Sergei : spotted too early conversion to blk_rq_bytes() in ide-tape

[ Impact: cleanup residual count handling, report 0 resid by default ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/scsi/st.c
1c9fbafc8c629c89183d6dccec67a8415513b0d1 04-Jan-2009 Martin K. Petersen <martin.petersen@oracle.com> [SCSI] Remove SUGGEST flags

The SUGGEST_* flags in the SCSI command result have been out of fashion
for a while and we don't actually use them in the error handling.
Remove the remaining occurrences.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
8f78fc5eb798426891f99390a61f752aaef9fc39 18-Dec-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: retry enlarge_buffer allocation

Make enlarge_buffer() retry allocation if the previously chosen page
order was too small. Really limit the page order to 6. Return error if
the maximum order is not large enough for the request.

Signed-off-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
02ae2c0e844e2864a877d1da8a92fe5e63778a18 18-Dec-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: integrate st_scsi_kern_execute and st_do_scsi

This integrates st_scsi_kern_execute and st_do_scsi. IOW, it removes
st_scsi_kern_execute. Then st has a single function, st_do_scsi, to
perform SCSI commands.

Signed-off-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
edf69c58c74eeeb48f62f267ce41f7827cb4dd06 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: remove unused frp_sg_current

frp_sg_current in struct st_buffer is always zero. We don't need it.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
1ac63cf5c05f956f52ab418a07f77d12328f3b5f 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: remove unused orig_frp_segs

orig_frp_segs in struct st_buffer is always zero. We don't need it.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
f409d6cc688d4e87b0ebf577b6554695e1931705 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: simplify new_tape_buffer

- remove the from_initialization argument, which is always 1. We
always need to use GFP_ATOMIC.

- 'got' valuable is initialized to zero and doesn't change. We don't
need it.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
b3d59115ba2b2550d70eafd929f1fa607fe588dc 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: remove struct scatterlist

This removes the usage of struct scatterlist completely.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
08c95832427b449ecfb357696f7b8e239b79a72c 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: kill struct st_buff_fragment

This removes struct st_buff_fragment and use reserved_pages array to
store fragment buffer.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
b3376b4aaab4c348dfd2e0b7595dc12f64c9fac9 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: remove buf_to_sg

This removes unused buf_to_sg() that the non-dio path used.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
6620742f72d2fcf311e3fc8aa2476daa91fa3f31 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert dio path to use st_scsi_execute

This patch converts the dio path (mmap) to use st_scsi_execute. IOW,
it removes scsi_execute_async in the non dio path.

scsi_execute_async has gone! This also remove unused st_sleep_done.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
6d4762678b7cbe932e858c62c07c533e1736a8bf 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert non-dio path to use st_scsi_execute

This patch converts the non-dio path (fragment buffer path) to use
st_scsi_execute. IOW, it removes scsi_execute_async in the non-dio
path.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
13b53b443482623d33fd9446289d320e1c719f02 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: add st_scsi_execute helper function

st_scsi_execute is a helper function to perform SCSI commands
involving data transfer between user and kernel space (st_read and
st_write).

It's the future plan to combine this with st_scsi_kern_execute helper
function.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
d0e1ae31be226e83cdd0684625bf1535518ee0d3 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: add struct rq_map_data support

This adds struct rq_map_data and the array of pointers to store
fragment buffers to struct st_buffer.

This patch doesn't remove st_buf_fragment but the latter patch does.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
9c905966c4d8c03ea21d230b277b7ea1e492f3c9 18-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: make all the fragment buffers the same size

This patch simiplifies the fragment buffer management a bit, all the
buffers in the fragment list become the same size. This is necessary
to use the block layer API (sg driver was modified in the same way)
since the block layer API takes the same size page frames instead of
scatter gatter.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
ccc607f6d29def18a4c2a4aab31435a784754a64 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert st_int_ioctl to use st_scsi_kern_execute

This replaces st_do_scsi in st_int_ioctl with st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
7a31ec3c1ff1ceeb3aebe25e13def5ac4edd5dc4 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert get_location to use st_scsi_kern_execute

This replaces st_do_scsi in get_location (READ_POSITION) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
18c87015741d931875038789957db55b00661f5b 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert write_mode_page to use st_scsi_kern_execute

This replaces st_do_scsi in write_mode_page (MODE_SELECT) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
8ecf0d994a8d3fb439e1efea6f60c22831bf69c8 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert read_mode_page to use st_scsi_kern_execute

This replaces st_do_scsi in read_mode_page (MODE_SENSE) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
52107b2c575d76bf210ff7e995128042594324ac 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert check_tape to use st_scsi_kern_execute

This replaces st_do_scsi in check_tape (READ_BLOCK_LIMITS and
MODE_SENSE) with st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
212cd8bfe12bb115e7bc9e119fe1411451829afb 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert st_flush to use st_scsi_kern_execute

This replaces st_do_scsi in st_flush (WRITE FILEMARKS) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
39ade4b1acb685127d73b53814850d9c92084c9e 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert cross_eof to use st_scsi_kern_execute

This replaces st_do_scsi in cross_eof (SPACE) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
15c920a6dc65ea0117bc5d4fd025d4b2eab13d59 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert do_load_unload to use st_scsi_kern_execute

This replaces st_do_scsi in do_load_unload (START STOP) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
3c0bf16c63a6ef69c9b3e90591e6179deacfa8f7 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert set_location to use st_scsi_kern_execute

This replaces st_do_scsi in set_location (LOCATE 10) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
0944a721ba5c2535b615f06afd3aaa2f18c69cb9 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: convert test_ready to use st_scsi_kern_execute

This replaces st_do_scsi in test_ready (TEST_UNIT_READY) with
st_scsi_kern_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
ffb4349499c00cd8ec90cb896599789cc00a7415 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: add st_scsi_kern_execute helper function

st_scsi_kern_execute is a helper function to perform SCSI commands
synchronously. It supports data transfer with a liner in-kernel buffer
(not scatter gather). st_scsi_kern_execute internally uses
scsi_execute().

The majority of st_do_scsi can be replaced with
st_scsi_kern_execute. This is a preparation for rewriting st_do_scsi
to remove obsolete scsi_execute_async().

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
4deba245d0d6b2dc97cc4277c37f8519655d3afe 05-Dec-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> [SCSI] st: move st_request initialization to st_allocate_request form st_do_scsi

This moves st_request initialization code to st_allocate_request()
form st_do_scsi(). This is a preparation for making
st_allocate_request() usable for everyone, not only st_do_scsi().

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
a02488ed73488f316aa00eb973407f4229c6c2bf 30-Nov-2008 James Bottomley <James.Bottomley@HansenPartnership.com> [SCSI] st: update to use block timeout

Since we're trying to eliminate struct scsi_device timeout, the tape
driver has to be updated to use the block queue timeout instead. The
tape use of scsi_device timeout looks to be self consistent, so I don't
think this necessarily fixes any bug, but it has to be done to allow me
to remove the timeout parameter from struct scsi_device.

Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
83ff6fe8580a7c834dba4389d742332fff9b9929 02-Mar-2008 Al Viro <viro@zeniv.linux.org.uk> [PATCH] don't mess with file in scsi_nonblockable_ioctl()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
/drivers/scsi/st.c
74f3c8aff36ad6552ea609c8b20bfd588fa16f38 27-Aug-2007 Al Viro <viro@zeniv.linux.org.uk> [PATCH] switch scsi_cmd_ioctl() to passing fmode_t

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
/drivers/scsi/st.c
d73a1a674b5383bb3b38ae3dd625504ffc623d90 22-Jul-2008 Greg Kroah-Hartman <gregkh@suse.de> device create: scsi: convert device_create_drvdata to device_create

Now that device_create() has been audited, rename things back to the
original call to be sane.

Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/scsi/st.c
786231af0a4ac6d78cef51fa7e9c3dd63f016195 11-Jul-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: Remove bogus memset

Mike Christie noticed a bogus memset. It can be removed as dead code
since the number of bytes in the driver buffer in fixed block mode is
always a multiple of the tape block size.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
626dcb1ee39aa1010c27df31970ff0ecfb287208 11-Jul-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: Move buffer pointer back when data could not be written.

Move buffer pointer back when data could not be written. Bug found by
Mike Christie.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
2fceef397f9880b212a74c418290ce69e7ac00eb 14-Jul-2008 Jonathan Corbet <corbet@lwn.net> Merge commit 'v2.6.26' into bkl-removal
b3369c68bf9d61062585f3ebc1286220191c0f84 16-May-2008 Jonathan Corbet <corbet@lwn.net> st: cdev lock_kernel() pushdown

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
/drivers/scsi/st.c
24b42566c3fcbb5a9011d1446783d0f5844ccd45 17-May-2008 Greg Kroah-Hartman <gregkh@suse.de> SCSI: fix race in device_create

There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.

This patch fixes the problem by using the new function,
device_create_drvdata(). It fixes the problem in all of the scsi
drivers that need it.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/scsi/st.c
7d15d6a4dc08dfd456d834e33ef6c1d798fb2edc 14-Mar-2008 James Bottomley <James.Bottomley@HansenPartnership.com> [SCSI] st: fix up after class_device removal

There's a change in the SCSI tree that adds another class_device, so change
it to an ordinary device

[jejb: this one got rebased until it's basically cosmetic only]

Cc: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
ee959b00c335d7780136c5abda37809191fe52c3 22-Feb-2008 Tony Jones <tonyj@suse.de> SCSI: convert struct class_device to struct device

It's big, but there doesn't seem to be a way to split it up smaller...

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/scsi/st.c
8ef8d5941cdc6ab616334e14306c39f7aceb780c 14-Apr-2008 Adrian Bunk <bunk@kernel.org> [SCSI] st: rename flush_write_buffer()

This patch fixes the following namespace collision with
include/asm-avr32/cacheflush.h :

<-- snip -->

...
CC [M] drivers/scsi/st.o
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/scsi/st.c:629:53: error: macro "flush_write_buffer" passed 1 arguments, but takes just 0
...
make[3]: *** [drivers/scsi/st.o] Error 1

<-- snip -->

st now uses st_flush_write_buffer()

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
b174be02f3634460ac215d249617dee5ae446ae1 24-Feb-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: show options currently set in sysfs

Show the current binary tape driver and mode options is sysfs. A file
(options) is created in each directory in /sys/class/scsi_tape. The files
contain masks showing the options. The mask bit definitions are the same as
used when setting the options using the MTSETDRVBUFFER function in the
MTIOCTOP ioctl (defined in include/linux/mtio.h). For example:
> cat /sys/class/scsi_tape/nst0/options
0x00000d07

[jejb: updated doc with correction from Randy Dunlap]

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
40f6b36c6243462fb95d0343237331c423494b03 24-Feb-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: add option to use SILI in variable block reads

Add new option MT_ST_SILI to enable setting the SILI bit in reads in variable
block mode. If SILI is set, reading a block shorter than the byte count does
not result in CHECK CONDITION. The length of the block is determined using the
residual count from the HBA. Avoiding the REQUEST SENSE command for every
block speeds up some real applications considerably.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
deee13dfd6dd6c18518ea725f11111ebd9bf4fa8 22-Feb-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: compile fix when DEBUG set to one

Remove the now useless counting of adjacent pages from the debugging code in
to make it compile when DEBUG is set non-zero.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
fd66c1b4e491a2a17d7a420fa38fd04b0e8d36c1 17-Jan-2008 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: convert to unlocked_ioctl

Convert st to unlocked_ioctl. The necessary locking was already in place.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
cd81621c5c5c869b848818b506962dab4499e0d9 15-Dec-2007 FUJITA Tomonori <tomof@acm.org> [SCSI] st: fix kernel BUG at include/linux/scatterlist.h:59!

This is caused by a missing scatterlist initialisation (it only shows
up when sg list handling debugging is turned on).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
/drivers/scsi/st.c
642f149031d70415d9318b919d50b71e4724adbd 24-Oct-2007 Jens Axboe <jens.axboe@oracle.com> SG: Change sg_set_page() to take length and offset argument

Most drivers need to set length and offset as well, so may as well fold
those three lines into one.

Add sg_assign_page() for those two locations that only needed to set
the page, where the offset/length is set outside of the function context.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/scsi/st.c
45711f1af6eff1a6d010703b4862e0d2b9afd056 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Update drivers to use sg helpers

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/scsi/st.c
28f85009e0cf6a5232cd285131eac3dfe26d9e3a 29-Jul-2007 Matthias Kaehlcke <matthias.kaehlcke@gmail.com> [SCSI] st: Use mutex instead of semaphore

The SCSI Tape driver uses a semaphore as mutex. Use the mutex API
instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
45e79a3acdcf54113b3d7b23e9e64e6541dbfeb5 09-Jul-2007 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> bsg: add a request_queue argument to scsi_cmd_ioctl()

bsg uses scsi_cmd_ioctl() for some SCSI/sg ioctl
commands. scsi_cmd_ioctl() gets a request queue from a gendisk
arguement. This prevents bsg being bound to SCSI devices that don't
have a gendisk (like OSD). This adds a request_queue argument to
scsi_cmd_ioctl(). The SCSI/sg ioctl commands doesn't use a gendisk so
it's safe for any SCSI devices to use scsi_cmd_ioctl().

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/drivers/scsi/st.c
d7b8bcb0a0819315a51cae620ff7ae0c1704c069 27-Oct-2006 Michael Tokarev <mjt@tls.msk.ru> [SCSI] modalias for scsi devices

The following patch adds support for sysfs/uevent modalias
attribute for scsi devices (like disks, tapes, cdroms etc),
based on whatever current sd.c, sr.c, st.c and osst.c drivers
supports.

The modalias format is like this:

scsi:type-0x04

(for TYPE_WORM, handled by sr.c now).

Several comments.

o This hexadecimal type value is because all TYPE_XXX constants
in include/scsi/scsi.h are given in hex, but __stringify() will
not convert them to decimal (so it will NOT be scsi:type-4).
Since it does not really matter in which format it is, while
both modalias in module and modalias attribute match each other,
I descided to go for that 0x%02x format (and added a comment in
include/scsi/scsi.h to keep them that way), instead of changing
them all to decimal.

o There was no .uevent routine for SCSI bus. It might be a good
idea to add some more ueven environment variables in there.

o osst.c driver handles tapes too, like st.c, but only SOME tapes.
With this setup, hotplug scripts (or whatever is used by the
user) will try to load both st and osst modules for all SCSI
tapes found, because both modules have scsi:type-0x01 alias).
It is not harmful, but one extra module is no good either.
It is possible to solve this, by exporting more info in
modalias attribute, including vendor and device identification
strings, so that modalias becomes something like
scsi:type-0x12:vendor-Adaptec LTD:device-OnStream Tape Drive
and having that, match for all 3 attributes, not only device
type. But oh well, vendor and device strings may be large,
and they do contain spaces and whatnot.
So I left them for now, awaiting for comments first.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
405ae7d381302468ecc803f2148a2ae40a04c999 17-Feb-2007 Robert P. J. Day <rpjday@mindspring.com> Replace remaining references to "driverfs" with "sysfs".

Globally, s/driverfs/sysfs/g.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
/drivers/scsi/st.c
00977a59b951207d38380c75f03a36829950265c 12-Feb-2007 Arjan van de Ven <arjan@linux.intel.com> [PATCH] mark struct file_operations const 6

Many struct file_operations in the kernel can be "const". Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data. In addition it'll catch accidental writes at compile time to
these shared resources.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/scsi/st.c
81b7bbd1932a04869d4c8635a75222dfc6089f96 10-Feb-2007 James Bottomley <jejb@mulgrave.il.steeleye.com> Merge branch 'linus'

Conflicts:

drivers/scsi/ipr.c

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
9abe16c670bd3d4ab5519257514f9f291383d104 03-Feb-2007 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: fix Tape dies if wrong block size used, bug 7919

On Thu, 1 Feb 2007, Andrew Morton wrote:
> On Thu, 1 Feb 2007 15:34:29 -0800
> bugme-daemon@bugzilla.kernel.org wrote:
>
> > http://bugzilla.kernel.org/show_bug.cgi?id=7919
> >
> > Summary: Tape dies if wrong block size used
> > Kernel Version: 2.6.20-rc5
> > Status: NEW
> > Severity: normal
> > Owner: scsi_drivers-other@kernel-bugs.osdl.org
> > Submitter: dmartin@sccd.ctc.edu
> >
> >
> > Most recent kernel where this bug did *NOT* occur: 2.6.17.14
> >
> > Other Kernels Tested and Results:
> >
> > OK 2.6.15.7
> > OK 2.6.16.37
> > OK 2.6.17.14
> > BAD 2.6.18.6
> > BAD 2.6.18-1.2869.fc6
> > BAD 2.6.19.2 +
> > BAD 2.6.20-rc5
> >
> > NOTE: 2.6.18-1.2869.fc6 is a Fedora modified kernel, all others are from kernel.org
> >
...
> > Steps to reproduce:
> > Get a Adaptec AHA-2940U/UW/D / AIC-7881U card and a tape drive,
> > install a recent kernel
> > set the tape block size - mt setblk 4096
> > read from or write to tape using wrong block size - tar -b 7 -cvf /dev/tape foo
> >
Write does not trigger this bug because the driver refuses in fixed block
mode writes that are not a multiple of the block size. Read does trigger
it in my system.

The bug is not associated with any specific HBA. st tries to do direct i/o
in fixed block mode with reads that are not a multiple of tape block size.

The patch in this message fixes the st problem by switching to using the
driver buffer up to the next close of the device file in fixed block mode
if the user asks for a read like this.

I don't know why the bug has surfaced only after 2.6.17 although the st
problem is old. There may be another bug in the block subsystem and this
patch works around it. However, the patch fixes a problem in st and in
this way it is a valid fix.

This patch may also fix the bug 7900.

The patch compiles and is lightly tested.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
91614c054c9ffc26b47a5cb3135113aa0f6e6ff0 25-Jan-2007 Kai Makisara <Kai.Makisara@kolumbus.fi> [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>
/drivers/scsi/st.c
7ac6207b2a6a5b828bc333f2530a3bd48197af3e 08-Dec-2006 Josef Sipek <jsipek@fsl.cs.sunysb.edu> [PATCH] struct path: convert scsi

Signed-off-by: Josef Sipek <jsipek@fsl.cs.sunysb.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/scsi/st.c
0bd2af46839ad6262d25714a6ec0365db9d6b98f 22-Nov-2006 James Bottomley <jejb@mulgrave.il.steeleye.com> Merge ../scsi-rc-fixes-2.6
42252854011b31fe63ffeca44ac941e6fe8277ae 07-Nov-2006 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: log message changes

Printk -> sdev_printk change originally from Luben Tuikov
<ltuikov@yahoo.com>. Loglevel changes prompted by Matthew Wilcox
<matthew@wil.cx>.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
413f73272090a69e35a03c938272ec661b1d3d4c 05-Oct-2006 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] st: Fixup -ENOMEDIUM

Based on the original patch from Hannes Reinecke <hare@suse.de>

Fix st_open() to return -ENOMEDIUM instead of -EIO if no medium is
found.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
13026a6b985b9d1e19330d5656e211f15b5aca3b 04-Oct-2006 Jeff Garzik <jeff@garzik.org> [SCSI] SCSI st: fix error handling in module init, sysfs

- Notice and handle sysfs errors in module init, tape init

- Properly unwind errors in module init

- Remove bogus st_sysfs_class==NULL test, it is guaranteed !NULL at that point

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
4e73ea7b02a8d2759b20ab52f13f40d5f5421044 07-Jul-2006 Luben Tuikov <ltuikov@yahoo.com> [SCSI] st.c: Improve sense output

Convert this:
st0: Error with sense data: <6>st: Current: sense key: Illegal Request
Additional sense: Invalid field in cdb

To this:
st0: Current: sense key: Illegal Request
Additional sense: Invalid field in cdb

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
332959cb521af6bb0281c7aae797f1f91dcb4c42 28-Jun-2006 Martin Habets <errandir_news@mph.eclipse.co.uk> [SCSI] st: remove unused st_buffer.in_use

I noticed that in_use in st_buffer is not used. The patch below
against 2.6.17-rc3 removes it, assuming there is no future use for it.
It was tested in a sparc SS20 with a DLT4000.

Signed-off-by: Martin Habets <errandir_news@mph.eclipse.co.uk>
Acked-by: Kai M�kisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
d6e05edc59ecd79e8badf440c0d295a979bdfa3e 26-Jun-2006 Andreas Mohr <andi@lisas.de> spelling fixes

acquired (aquired)
contiguous (contigious)
successful (succesful, succesfull)
surprise (suprise)
whether (weather)
some other misspellings

Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
/drivers/scsi/st.c
75e1fcc0b18df0a65ab113198e9dc0e98999a08c 23-Jun-2006 Miklos Szeredi <miklos@szeredi.hu> [PATCH] vfs: add lock owner argument to flush operation

Pass the POSIX lock owner ID to the flush operation.

This is useful for filesystems which don't want to store any locking state
in inode->i_flock but want to handle locking/unlocking POSIX locks
internally. FUSE is one such filesystem but I think it possible that some
network filesystems would need this also.

Also add a flag to indicate that a POSIX locking request was generated by
close(), so filesystems using the above feature won't send an extra locking
request in this case.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/scsi/st.c
f0cd91a68acdc9b49d7f6738b514a426da627649 10-Jun-2006 James Bottomley <jejb@mulgrave.il.steeleye.com> Merge ../linux-2.6
6391a11375de5e2bb1eb8481e54619761dc65d9f 09-Jun-2006 Tobias Klauser <tklauser@nuerscht.ch> [SCSI] drivers/scsi: Use ARRAY_SIZE macro

Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove
duplicates of the macro.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
8b1ea24c6cc529f6860c458b1c0872f22e74c950 21-May-2006 Rene Herman <rene.herman@keyaccess.nl> [PATCH] missing newline in scsi/st.c

st: Version 20050830, fixed bufsize 32768, s/g segs 256
st 0:0:6:0: Attached scsi tape st0<4>st0: try direct i/o: yes (alignment 512 B)

Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/scsi/st.c
f018fa552c52642a6b9db2bda90477762e42163f 08-Mar-2006 Rene Herman <rene.herman@keyaccess.nl> [SCSI] MODULE_ALIAS_{BLOCK,CHAR}DEV_MAJOR for drivers/scsi

Add device-major aliases in drivers/scsi, allowing kmod autoload:

MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR)
MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR)
MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR)
MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR)
MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISKN_MAJOR)

Signed-off-by: Andrew Morton <akpm@osdl.org>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
5e3c34c1e988a0dfe177c38cf324e8e321c55ef5 19-Jan-2006 Greg KH <gregkh@suse.de> [SCSI] Remove devfs support from the SCSI subsystem

As devfs has been disabled from the kernel tree for a number of months
now (5 to be exact), here's a patch against 2.6.16-rc1-git1 that removes
support for it from the SCSI subsystem.

The patch also removes the scsi_disk devfs_name field as it's no longer
needed.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
24669f75a3231fa37444977c92d1f4838bec1233 16-Jan-2006 Jes Sorensen <jes@sgi.com> [SCSI] SCSI core kmalloc2kzalloc

Change the core SCSI code to use kzalloc rather than kmalloc+memset
where possible.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
bb1d1073a10fdc8547e3eb821ee2488260094b39 23-Jan-2006 brking@us.ibm.com <brking@us.ibm.com> [SCSI] Prevent scsi_execute_async from guessing cdb length

When the scsi_execute_async interface was added it ended up reducing
the flexibility of userspace to send arbitrary scsi commands through
sg using SG_IO. The SG_IO interface allows userspace to specify the
CDB length. This is now ignored in scsi_execute_async and it is
guessed using the COMMAND_SIZE macro, which is not always correct,
particularly for vendor specific commands. This patch adds a cmd_len
parameter to the scsi_execute_async interface to allow the caller
to specify the length of the CDB.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
776b23a0363d99ca402edc1aba1db8099b747b33 06-Jan-2006 Christoph Hellwig <hch@lst.de> [SCSI] always handle REQ_BLOCK_PC requests in common code

LLDDs should never see REQ_BLOCK_PC requests, we can handle them just
fine in the core code. There is a small behaviour change in that some
check in sr's rw_intr are bypassed, but I consider the old behaviour
a bug.

Mike found this cleanup opportunity and provdided early patches, so all
the credit goes to him, even if I redid the patches from scratch beause
that was easier than forward-porting the old patches.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
0b9506723826c68b50fa33e345700ddcac1bed36 11-Jan-2006 Arjan van de Ven <arjan@infradead.org> [SCSI] turn most scsi semaphores into mutexes

the scsi layer is using semaphores in a mutex way, this patch converts
these into using mutexes instead

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
7b16318dea8d9840dac567a2ae8c50ecdea36aea 16-Dec-2005 James Bottomley <jejb@titanic.(none)> Fix up SCSI mismerge

I forgot to do a git-update-cache on the merged files ...
/drivers/scsi/st.c
2a1e1379bae53f647c463a677cc2ec71b591c348 16-Dec-2005 James Bottomley <jejb@titanic.(none)> Merge by hand (conflicts in scsi_lib.c)

This merge is pretty extensive. The conflict is over the new
req->retries parameter, so I had to change the prototype to
scsi_setup_blk_pc_cmnd() and the usage in sd, sr and st.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
787926b1b2d21d42ca462dc736b77f1a4a30c503 13-Nov-2005 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] Fix st oops with new scsi_execute infrastructure

Patch from Kai minus last sg_segs clearing which was merged already.

> > Was there a oops or lockup or any debug output you can send me? I will try
> > some more large request tests with scsi_debug. You also have to compile your
> > kernel with SCSI_MAX_PHYS_SEGMENTS == 255 to get larger requests now.
>
It was an oops in sgl_unmap_user_pages(). The reason is this:

/* XXX: just for debug. Remove when PageReserved is removed */
BUG_ON(PageReserved(page));

I was using /dev/zero as input and it triggers this. When I used a file as
input, this did not trigger. Should this BUG_ON be removed?

In the same log I noticed that there was another ->sg_segs inconsistency.
Also, the field ->last_SRpnt was not reset when scsi_execute_async()
failed. This caused the error message "Async command already active"
later and prevented proper close.

While doing the changes, I noticed that the current code (since
2.6.0-test4) does not set the pages dirty when reading with direct i/o.

All of these st problems (including the one I sent earlier) are fixed in
the patch at the end of this message. These fixes should probably be
included already in 2.6.15.

After these fixes, the tape seems to operate as expected. Without other
changes, the largest block size with sym53c896 SCSI adapter is 384 kB. The
maximum number of sg segments is set to 96 and clustering is disabled in
the driver. 96 x 4 kB = 384 kB. OK.

I enabled clustering and set max_sectors to 10000 in the SCSI HBA driver.
Now the block size limit is 5000 kB as expected.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
8b05b773b6030de5b1bab1cbb0bf1ff8c34cdbe0 08-Nov-2005 Mike Christie <michaelc@cs.wisc.edu> [SCSI] convert st to use scsi_execute_async

convert st to always send scatterlists and kill scsi_request
usage.

This is the same as last time as it was posted, but with Kai's patches
merged and we now pass the bytes value to scsi_execute_async.

TODO:

- move DIO code to common place or make block layers usable for ULDs.
- move buffer allocation code to common place for all ULDs to use. And
make buffer allocation code handle all queue limits so we can find
out about problems before calling scsi_execute_async.
- move indirect (copy_to/from_user) paths commone place or make block
layers usable for ULDs.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
0d95716d6a1308c465d8c17ed1a217628936bb0c 11-Nov-2005 Mike Christie <michaelc@cs.wisc.edu> [SCSI] complete the whole command when it is REQ_BLOCK_PC

sd does not allow scsi_io_completion to retry commands for
SG_IO requests, and it make sense that it should not happen for st
SG_IO commands too. If for st we hit the bottom of scsi_io_completion
we will probably screw things up pretty bad. This patch returns to the
block layer that the whole command completed and relies on the caller to check
the request errors field. For initialization commands like in sd, this adds
the previous behavior where scsi_io_completion did not process the error.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
c9526497cf03ee775c3a6f8ba62335735f98de7a 09-Dec-2005 James Bottomley <James.Bottomley@steeleye.com> [SCSI] Consolidate REQ_BLOCK_PC handling path (fix ipod panic)

This follows on from Jens' patch and consolidates all of the ULD
separate handlers for REQ_BLOCK_PC into a single call which has his
fix for our direction bug.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
0ad78200baf1f85a21e6b26c225717ad80980d8f 28-Nov-2005 Arjan van de Ven <arjan@infradead.org> [SCSI] Mark some core scsi data structures const

patch below marks a few scsi core datastructures as const, so that they end up
in the .rodata section and don't cacheline share with things that get dirtied

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
032c09d76cdb448484859cc84dac4bba8f5f8f14 02-Dec-2005 Hugh Dickins <hugh@veritas.com> [SCSI] sg and st unmap_user_pages allow PageReserved

2.6.15-rc1 made sg's st_unmap_user_pages and st's sgl_unmap_user_pages
BUG on a PageReserved page. But that's wrong: they could be unmapping
the ZERO_PAGE, which is marked PG_reserved; and perhaps others (while
get_user_pages is still permitted on VM_PFNMAP areas - that may change).

More change is needed here: sg claims to dirty even pages written from,
and st claims not to dirty even pages read into; and SetPageDirty is not
adequate for this nowadays. Fixes to those follow in a later patch: for
the moment just fix the 2.6.15 regression.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
6bc733e9f71c937f3c64159bf1e569321726a44c 01-Dec-2005 Hugh Dickins <hugh@veritas.com> [SCSI] st: fix a bug in sgl_map_user_pages failure path

Nick and I had already been looking at drivers/scsi/{sg.c,st.c},
brought there by __put_page in sg.c's peculiar sg_rb_correct4mmap,
which we'd like to remove. But that's irrelevant to your pain, except...

One extract from the patches I'd like to send Doug and Kai for 2.6.15
or 2.6.16 is this below: since the incomplete get_user_pages path omits
to reset res, but has already released all the pages, it will result in
premature freeing of user pages, and behaviour just like you've seen.

Though I'd have thought incomplete get_user_pages was an exceptional
case, and a bit surprised you'd encounter it. Perhaps there's some
other premature freeing in the driver, and this instance has nothing
whatever to do with it.

If the problem were easily reproducible, it'd be great if you could
try this patch; but I think you've said it's not :-(

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
c9475cb0c358ff0dd473544280d92482df491913 07-Nov-2005 Jesper Juhl <jesper.juhl@gmail.com> [PATCH] kfree cleanup: drivers/scsi

This is the drivers/scsi/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in drivers/scsi/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/scsi/st.c
849a8924a6740ecbf9711e015beca69425f0c429 05-Nov-2005 James Bottomley <jejb@titanic.(none)> Merge by Hand

Conflicts in dec_esp.c (Thanks Bacchus), scsi_transport_iscsi.c and
scsi_transport_fc.h

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
b5810039a54e5babf428e9a1e89fc1940fabff11 30-Oct-2005 Nick Piggin <nickpiggin@yahoo.com.au> [PATCH] core remove PageReserved

Remove PageReserved() calls from core code by tightening VM_RESERVED
handling in mm/ to cover PageReserved functionality.

PageReserved special casing is removed from get_page and put_page.

All setting and clearing of PageReserved is retained, and it is now flagged
in the page_alloc checks to help ensure we don't introduce any refcount
based freeing of Reserved pages.

MAP_PRIVATE, PROT_WRITE of VM_RESERVED regions is tentatively being
deprecated. We never completely handled it correctly anyway, and is be
reintroduced in future if required (Hugh has a proof of concept).

Once PageReserved() calls are removed from kernel/power/swsusp.c, and all
arch/ and driver code, the Set and Clear calls, and the PG_reserved bit can
be trivially removed.

Last real user of PageReserved is swsusp, which uses PageReserved to
determine whether a struct page points to valid memory or not. This still
needs to be addressed (a generic page_is_ram() should work).

A last caveat: the ZERO_PAGE is now refcounted and managed with rmap (and
thus mapcounted and count towards shared rss). These writes to the struct
page could cause excessive cacheline bouncing on big systems. There are a
number of ways this could be addressed if it is an issue.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Refcount bug fix for filemap_xip.c

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/scsi/st.c
3bf743e7c891d8be8295650b7a6a9b5af083b096 25-Oct-2005 Jeff Garzik <jgarzik@pobox.com> [SCSI] use {sdev,scmd,starget,shost}_printk in generic code

rejections fixed and
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
9ccfc756a70d454dfa82f48897e2883560c01a0e 02-Oct-2005 James Bottomley <James.Bottomley@steeleye.com> [SCSI] move the mid-layer printk's over to shost/starget/sdev_printk

This should eliminate (at least in the mid layer) to make numeric
assumptions about any of the enumeration variables. As a side effect,
it will also make all the messages consistent and line us up nicely for
the error logging strategy (if it ever shows itself again).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
6fbfddcb52d8d9fa2cd209f5ac2a1c87497d55b5 28-Oct-2005 Greg KH <greg@press.(none)> Merge ../bleed-2.6
53f4654272df7c51064825024340554b39c9efba 28-Oct-2005 Greg Kroah-Hartman <gregkh@suse.de> [PATCH] Driver Core: fix up all callers of class_device_create()

The previous patch adding the ability to nest struct class_device
changed the paramaters to the call class_device_create(). This patch
fixes up all in-kernel users of the function.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/scsi/st.c
c53033f6b0bd7cc133b7f433083f0394cf29ac70 21-Oct-2005 Al Viro <viro@zeniv.linux.org.uk> [PATCH] gfp_t: drivers/scsi

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/scsi/st.c
186d330e682210100c671355580a8592e4a21692 14-Sep-2005 Timothy Thelin <Timothy.Thelin@wdc.com> [SCSI] scsi: sd, sr, st, and scsi_lib all fail to copy cmd_len to new cmd

This fixes an issue in scsi command initialization from a request
where sd, sr, st, and scsi_lib all fail to copy the request's
cmd_len to the scsi command's cmd_len field.

Signed-off-by: Timothy Thelin <timothy.thelin@wdc.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
17fa53da1239b8712c5cebbd72a74c713b6c2db9 07-Sep-2005 James Bottomley <jejb@titanic.(none)> Merge by hand (conflicts in sd.c)
07542b832309b93a2741cd162a391ab909f66438 01-Sep-2005 James Bottomley <jejb@mulgrave.(none)> This patch fixes in st.c the bug in the signed/unsigned int comparison
reported by Doug Gilbert and fixed by him in sg.c (see [PATCH] sg direct
io/mmap oops). Doug fixed the comparison in sg.c. This fix for st.c does not
touch the comparison but makes both arguments signed to remove the
problem. The new code is adapted from linux/fs/bio.c.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>

Rejections fixed up and

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
7a93aef7fbac6f4db40b6fec5c0c6b654ae7a93c 28-Aug-2005 James Bottomley <jejb@titanic.(none)> Merge HEAD from ../scsi-misc-2.6-tmp
f03a567054fea4f9d43c50ec91338266c0bd588d 02-Aug-2005 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] drivers/scsi/st.c: add reference count and related fixes

I have rediffed the patch against 2.6.13-rc5, done a couple of cosmetic
cleanups, and run some tests. Brian King has acknowledged that it fixes the
problems he has seen. Seems mature enough for inclusion into 2.6.14 (or
later)?

Nate's explanation of the changes:

I've attached patches against 2.6.13rc2. These are basically identical
to my earlier patches, as I found that all issues I'd seen in earlier
kernels still existed in this kernel.

To summarize, the changes are: (more details in my original email)

- add a kref to the scsi_tape structure, and associate reference
counting stuff

- set sr_request->end_io = blk_end_sync_rq so we get notified when an IO
is rejected when the device goes away

- check rq_status when IOs complete, else we don't know that IOs
rejected for a dead device in fact did not complete

- change last_SRpnt so it's set before an async IO is issued (in case
st_sleep_done is bypassed)

- fix a bogus use of last_SRpnt in st_chk_result

Signed-off-by: Nate Dailey <nate.dailey@stratus.com>
Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
c2c96f46f46df072e49200a1181b3086cd2f08a6 01-Aug-2005 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] Fix SCSI tape oops at module removal

Removing the SCSI tape module results in an oops in class_device_destroy if
any devices are present. The patch at the end of this message fixes the bug
by moving class_destroy() later in exit_st() so that the class still exists
when devices are removed. (The bug is old but class_simple_device_remove() did
nothing when the class did not exist.)

The patch also fixes a "class leak" in init_st() error path.

I would like to get this into 2.6.13 but it may be too late?

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
d253878b3d9ae523c76118f5336a662780ad3757 23-Mar-2005 gregkh@suse.de <gregkh@suse.de> [PATCH] class: convert drivers/scsi/* to use the new class api instead of class_simple

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/scsi/st.c
16c4b3e2071ad73e5cd2aa82961eed0414df6a7d 01-May-2005 Kai Makisara <Kai.Makisara@kolumbus.fi> [SCSI] SCSI tape: fix permissions for SG_IO, etc.

This patch is against 2.6.12-rc3 + linus-patch from April 30. The patch
contains the following fixes:

- CAP_SYS_RAWIO is used instead of CAP_SYS_ADMIN; fix from Alan Cox
- only direct sending of SCSI commands requires this permission
- the st status is modified is successful unload is performed using
SCSI_IOCTL_STOP_UNIT

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
/drivers/scsi/st.c
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
/drivers/scsi/st.c