summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
Commit message (Collapse)AuthorAgeFilesLines
...
* [SCSI] st: integrate st_scsi_kern_execute and st_do_scsiKai Makisara2009-01-021-136/+66Star
| | | | | | | | | 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>
* [SCSI] st: remove unused frp_sg_currentFUJITA Tomonori2009-01-021-2/+0Star
| | | | | | | | 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>
* [SCSI] st: remove unused orig_frp_segsFUJITA Tomonori2009-01-021-4/+3Star
| | | | | | | | 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>
* [SCSI] st: simplify new_tape_bufferFUJITA Tomonori2009-01-021-15/+6Star
| | | | | | | | | | | | - 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>
* [SCSI] st: remove struct scatterlistFUJITA Tomonori2009-01-021-6/+2Star
| | | | | | | | 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>
* [SCSI] st: kill struct st_buff_fragmentFUJITA Tomonori2009-01-021-35/+43
| | | | | | | | | 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>
* [SCSI] st: remove buf_to_sgFUJITA Tomonori2009-01-021-29/+0Star
| | | | | | | | 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>
* [SCSI] st: convert dio path to use st_scsi_executeFUJITA Tomonori2009-01-021-53/+23Star
| | | | | | | | | | | 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>
* [SCSI] st: convert non-dio path to use st_scsi_executeFUJITA Tomonori2009-01-021-6/+21
| | | | | | | | | | 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>
* [SCSI] st: add st_scsi_execute helper functionFUJITA Tomonori2009-01-021-0/+54
| | | | | | | | | | | | | 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>
* [SCSI] st: add struct rq_map_data supportFUJITA Tomonori2009-01-021-0/+11
| | | | | | | | | | | 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>
* [SCSI] st: make all the fragment buffers the same sizeFUJITA Tomonori2009-01-021-9/+9
| | | | | | | | | | | | 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>
* [SCSI] st: convert st_int_ioctl to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-3/+6
| | | | | | | | 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>
* [SCSI] st: convert get_location to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-4/+11
| | | | | | | | | 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>
* [SCSI] st: convert write_mode_page to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-7/+14
| | | | | | | | | 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>
* [SCSI] st: convert read_mode_page to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-6/+10
| | | | | | | | | 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>
* [SCSI] st: convert check_tape to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-10/+18
| | | | | | | | | 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>
* [SCSI] st: convert st_flush to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-4/+10
| | | | | | | | | 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>
* [SCSI] st: convert cross_eof to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-7/+14
| | | | | | | | | 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>
* [SCSI] st: convert do_load_unload to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-4/+9
| | | | | | | | | 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>
* [SCSI] st: convert set_location to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-4/+8
| | | | | | | | | 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>
* [SCSI] st: convert test_ready to use st_scsi_kern_executeFUJITA Tomonori2008-12-291-8/+11
| | | | | | | | | 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>
* [SCSI] st: add st_scsi_kern_execute helper functionFUJITA Tomonori2008-12-291-0/+22
| | | | | | | | | | | | | | 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>
* [SCSI] st: move st_request initialization to st_allocate_request form st_do_scsiFUJITA Tomonori2008-12-291-13/+19
| | | | | | | | | | 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>
* [SCSI] st: update to use block timeoutJames Bottomley2008-12-291-19/+28
| | | | | | | | | | | 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>
* [PATCH] don't mess with file in scsi_nonblockable_ioctl()Al Viro2008-10-211-1/+2
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* [PATCH] switch scsi_cmd_ioctl() to passing fmode_tAl Viro2008-10-211-2/+2
| | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* device create: scsi: convert device_create_drvdata to device_createGreg Kroah-Hartman2008-10-161-7/+4Star
| | | | | | | | | 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>
* [SCSI] st: Remove bogus memsetKai Makisara2008-07-261-6/+2Star
| | | | | | | | | 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>
* [SCSI] st: Move buffer pointer back when data could not be written.Kai Makisara2008-07-261-1/+2
| | | | | | | | 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>
* Merge commit 'v2.6.26' into bkl-removalJonathan Corbet2008-07-141-5/+7
|\
| * SCSI: fix race in device_createGreg Kroah-Hartman2008-05-201-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | st: cdev lock_kernel() pushdownJonathan Corbet2008-06-201-2/+9
|/ | | | Signed-off-by: Jonathan Corbet <corbet@lwn.net>
* [SCSI] st: fix up after class_device removalJames Bottomley2008-04-221-5/+5
| | | | | | | | | | 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>
* SCSI: convert struct class_device to struct deviceTony Jones2008-04-201-38/+44
| | | | | | | | | | | | | 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>
* [SCSI] st: rename flush_write_buffer()Adrian Bunk2008-04-161-3/+3
| | | | | | | | | | | | | | | | | | | | 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>
* [SCSI] st: show options currently set in sysfsKai Makisara2008-04-071-0/+43
| | | | | | | | | | | | | | | 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>
* [SCSI] st: add option to use SILI in variable block readsKai Makisara2008-04-071-4/+36
| | | | | | | | | | | 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>
* [SCSI] st: compile fix when DEBUG set to oneKai Makisara2008-02-231-7/+4Star
| | | | | | | | 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>
* [SCSI] st: convert to unlocked_ioctlKai Makisara2008-01-231-5/+4Star
| | | | | | | 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>
* [SCSI] st: fix kernel BUG at include/linux/scatterlist.h:59!FUJITA Tomonori2007-12-181-0/+1
| | | | | | | | | 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>
* SG: Change sg_set_page() to take length and offset argumentJens Axboe2007-10-241-9/+5Star
| | | | | | | | | | 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>
* [SG] Update drivers to use sg helpersJens Axboe2007-10-221-4/+4
| | | | Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
* [SCSI] st: Use mutex instead of semaphoreMatthias Kaehlcke2007-07-311-8/+8
| | | | | | | | | 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>
* bsg: add a request_queue argument to scsi_cmd_ioctl()FUJITA Tomonori2007-07-161-1/+2
| | | | | | | | | | | | 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>
* [SCSI] modalias for scsi devicesMichael Tokarev2007-04-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Replace remaining references to "driverfs" with "sysfs".Robert P. J. Day2007-02-171-19/+19
| | | | | | | Globally, s/driverfs/sysfs/g. Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Signed-off-by: Adrian Bunk <bunk@stusta.de>
* [PATCH] mark struct file_operations const 6Arjan van de Ven2007-02-121-1/+1
| | | | | | | | | | | 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>
* Merge branch 'linus'James Bottomley2007-02-101-8/+11
|\ | | | | | | | | | | | | | | Conflicts: drivers/scsi/ipr.c Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
| * [SCSI] st: A MTIOCTOP/MTWEOF within the early warning will cause the file ↵Kai Makisara2007-01-271-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>