10 Sep, 2010

2 commits

  • Barrier is deemed too heavy and will soon be replaced by FLUSH/FUA
    requests. Deprecate barrier. All REQ_HARDBARRIERs are failed with
    -EOPNOTSUPP and blk_queue_ordered() is replaced with simpler
    blk_queue_flush().

    blk_queue_flush() takes combinations of REQ_FLUSH and FUA. If a
    device has write cache and can flush it, it should set REQ_FLUSH. If
    the device can handle FUA writes, it should also set REQ_FUA.

    All blk_queue_ordered() users are converted.

    * ORDERED_DRAIN is mapped to 0 which is the default value.
    * ORDERED_DRAIN_FLUSH is mapped to REQ_FLUSH.
    * ORDERED_DRAIN_FLUSH_FUA is mapped to REQ_FLUSH | REQ_FUA.

    Signed-off-by: Tejun Heo
    Acked-by: Boaz Harrosh
    Cc: Christoph Hellwig
    Cc: Nick Piggin
    Cc: Michael S. Tsirkin
    Cc: Jeremy Fitzhardinge
    Cc: Chris Wright
    Cc: FUJITA Tomonori
    Cc: Geert Uytterhoeven
    Cc: David S. Miller
    Cc: Alasdair G Kergon
    Cc: Pierre Ossman
    Cc: Stefan Weinhuber
    Signed-off-by: Jens Axboe

    Tejun Heo
     
  • Nobody is making meaningful use of ORDERED_BY_TAG now and queue
    draining for barrier requests will be removed soon which will render
    the advantage of tag ordering moot. Kill ORDERED_BY_TAG. The
    following users are affected.

    * brd: converted to ORDERED_DRAIN.
    * virtio_blk: ORDERED_TAG path was already marked deprecated. Removed.
    * xen-blkfront: ORDERED_TAG case dropped.

    Signed-off-by: Tejun Heo
    Cc: Christoph Hellwig
    Cc: Nick Piggin
    Cc: Michael S. Tsirkin
    Cc: Jeremy Fitzhardinge
    Cc: Chris Wright
    Signed-off-by: Jens Axboe

    Tejun Heo
     

11 Aug, 2010

2 commits

  • In sd_store_cache_type the symbol 'len' is declared twice. Remove the
    second declaration to quiet the following sparse warning.

    warning: symbol 'len' shadows an earlier one

    In sd_probe the variable 'index' is declared as a u32. This variable is
    used in a call to ida_get_new which is expecting an int *. Make the
    variable an int to quiet the following sparse warning.

    warning: incorrect type in argument 2 (different signedness)

    There are 4 symbols in the file that are not exported and produce
    the following sparse warnings.

    warning: symbol 'sd_cdb_cache' was not declared. Should it be static?
    warning: symbol 'sd_cdb_pool' was not declared. Should it be static?
    warning: symbol 'sd_read_protection_type' was not declared. Should it be static?
    warning: symbol 'sd_read_app_tag_own' was not declared. Should it be static?

    Make them static to quiet the warnings.

    Signed-off-by: H Hartley Sweeten
    Cc: James E.J. Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    H Hartley Sweeten
     
  • * 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block: (149 commits)
    block: make sure that REQ_* types are seen even with CONFIG_BLOCK=n
    xen-blkfront: fix missing out label
    blkdev: fix blkdev_issue_zeroout return value
    block: update request stacking methods to support discards
    block: fix missing export of blk_types.h
    writeback: fix bad _bh spinlock nesting
    drbd: revert "delay probes", feature is being re-implemented differently
    drbd: Initialize all members of sync_conf to their defaults [Bugz 315]
    drbd: Disable delay probes for the upcomming release
    writeback: cleanup bdi_register
    writeback: add new tracepoints
    writeback: remove unnecessary init_timer call
    writeback: optimize periodic bdi thread wakeups
    writeback: prevent unnecessary bdi threads wakeups
    writeback: move bdi threads exiting logic to the forker thread
    writeback: restructure bdi forker loop a little
    writeback: move last_active to bdi
    writeback: do not remove bdi from bdi_list
    writeback: simplify bdi code a little
    writeback: do not lose wake-ups in bdi threads
    ...

    Fixed up pretty trivial conflicts in drivers/block/virtio_blk.c and
    drivers/scsi/scsi_error.c as per Jens.

    Linus Torvalds
     

08 Aug, 2010

13 commits

  • scsi-ml uses REQ_TYPE_BLOCK_PC for flush requests from file
    systems. The definition of REQ_TYPE_BLOCK_PC is that we don't retry
    requests even when we can (e.g. UNIT ATTENTION) and we send the
    response to the callers (then the callers can decide what they want).
    We need a workaround such as the commit
    77a4229719e511a0d38d9c355317ae1469adeb54 to retry BLOCK_PC flush
    requests. We will need the similar workaround for discard requests too
    since SCSI-ml handle them as BLOCK_PC internally.

    This uses REQ_TYPE_FS for flush requests from file systems instead of
    REQ_TYPE_BLOCK_PC.

    scsi-ml retries only REQ_TYPE_FS requests that have data to
    transfer when we can retry them (e.g. UNIT_ATTENTION). However, we
    also need to retry REQ_TYPE_FS requests without data because the
    callers don't.

    This also changes scsi_check_sense() to retry all the REQ_TYPE_FS
    requests when appropriate. Thanks to scsi_noretry_cmd(),
    REQ_TYPE_BLOCK_PC requests don't be retried as before.

    Note that basically, this reverts the commit
    77a4229719e511a0d38d9c355317ae1469adeb54 since now we use REQ_TYPE_FS
    for flush requests.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • Jens, any reason why this isn't included in your for-2.6.36 yet?

    =
    From: FUJITA Tomonori
    Subject: [PATCH resend] scsi: convert discard to REQ_TYPE_FS from REQ_TYPE_BLOCK_PC

    The block layer (file systems) sends discard requests as REQ_TYPE_FS
    (the role of REQ_TYPE_FS is that setting up commands and interpreting
    the results). But SCSI-ml treats discard requests as
    REQ_TYPE_BLOCK_PC.

    scsi-ml can handle discard requests as REQ_TYPE_FS
    easily. scsi_setup_discard_cmnd() sets up struct request and the bio
    nicely. Only remaining issue is that discard requests can't be
    completed partially so we need to modify sd_done.

    This conversion also fixes the problem that discard requests aren't
    retried when possible (e.g. UNIT ATTENTION).

    Signed-off-by: FUJITA Tomonori
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • Every user of the BKL in the sd driver is the
    result of the pushdown from the block layer
    into the open/close/ioctl functions.

    The only place that used to rely on the BKL is
    the sdkp->openers variable, which gets converted
    into an atomic_t.

    Nothing else seems to rely on the BKL, since the
    functions do not touch global data without holding
    another lock, and the open/close functions are
    still protected from concurrent execution using
    the bdev->bd_mutex.

    Signed-off-by: Arnd Bergmann
    Cc: linux-scsi@vger.kernel.org
    Cc: "James E.J. Bottomley"
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     
  • The open and release block_device_operations are currently
    called with the BKL held. In order to change that, we must
    first make sure that all drivers that currently rely
    on this have no regressions.

    This blindly pushes the BKL into all .open and .release
    operations for all block drivers to prepare for the
    next step. The drivers can subsequently replace the BKL
    with their own locks or remove it completely when it can
    be shown that it is not needed.

    The functions blkdev_get and blkdev_put are the only
    remaining users of the big kernel lock in the block
    layer, besides a few uses in the ioctl code, none
    of which need to serialize with blkdev_{get,put}.

    Most of these two functions is also under the protection
    of bdev->bd_mutex, including the actual calls to
    ->open and ->release, and the common code does not
    access any global data structures that need the BKL.

    Signed-off-by: Arnd Bergmann
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     
  • As a preparation for the removal of the big kernel
    lock in the block layer, this removes the BKL
    from the common ioctl handling code, moving it
    into every single driver still using it.

    Signed-off-by: Arnd Bergmann
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     
  • We leak a page allocated for discard on some error conditions
    (e.g. scsi_prep_state_check returns BLKPREP_DEFER in
    scsi_setup_blk_pc_cmnd).

    We unprep on requests that weren't prepped in the error path of
    scsi_init_io. It makes the error path to clean up scsi commands messy.

    Let's strictly apply the rule that we can't unprep on a request that
    wasn't prepped.

    Calling just scsi_put_command() in the error path of scsi_init_io() is
    enough. We don't set REQ_DONTPREP yet.

    scsi_setup_discard_cmnd can safely free a page on the error case with
    the above rule.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • This is for block's for-2.6.36.

    We need to reset q->unprep_rq_fn in sd_remove. Otherwise we hit kernel
    oops if we access to a scsi disk device via sg after removing scsi
    disk module.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • This removes q->prepare_flush_fn completely (changes the
    blk_queue_ordered API).

    Signed-off-by: FUJITA Tomonori
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • scsi-ml builds flush requests via q->prepare_flush_fn(), however,
    builds discard requests via q->prep_rq_fn.

    Using two different mechnisms for the similar requests (building
    commands in SCSI ULD) doesn't make sense.

    Handing both via q->prep_rq_fn makes the code design simpler.

    Signed-off-by: FUJITA Tomonori
    Cc: James Bottomley
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • - sd_done isn't called for pc request so we never call the code.
    - we use sd_unprep to free discard page now.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • This fixes discard page leak by using q->unprep_rq_fn facility.

    q->unprep_rq_fn is called when all the data buffer (req->bio and
    scsi_data_buffer) in the request is freed.

    sd_unprep() uses rq->buffer to free discard page allocated in
    sd_prepare_discard().

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • Allocating a fixed payload for discard requests always was a horrible hack,
    and it's not coming to byte us when adding support for discard in DM/MD.

    So change the code to leave the allocation of a payload to the lowlevel
    driver. Unfortunately that means we'll need another hack, which allows
    us to update the various block layer length fields indicating that we
    have a payload. Instead of hiding this in sd.c, which we already partially
    do for UNMAP support add a documented helper in the core block layer for it.

    Signed-off-by: Christoph Hellwig
    Acked-by: Mike Snitzer
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • Remove all the trivial wrappers for the cmd_type and cmd_flags fields in
    struct requests. This allows much easier grepping for different request
    types instead of unwinding through macros.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

28 Jul, 2010

1 commit

  • This patch (as1399) adds runtime-PM support to the sd driver. The
    support is unsophisticated: If a SCSI disk device is mounted, or if
    its device file is held open, then the device will not be
    runtime-suspended; otherwise it will (provided userspace gives
    permission by writing "auto" to the sysfs power/control attribute).

    In order to make this work, a dev_set_drvdata() call had to be moved
    from sd_probe_async() to sd_probe(). Also, a few lines of code were
    changed to use a local variable instead of recalculating the address
    of an embedded struct device.

    Signed-off-by: Alan Stern
    Signed-off-by: James Bottomley

    Alan Stern
     

03 Jun, 2010

1 commit

  • Implement sd_unlock_native_capacity() method which calls into
    hostt->unlock_native_capacity() if implemented. This will be invoked
    by block layer if partitions extend beyond the end of the device and
    can be used to implement, for example, on-demand ATA host protected
    area unlocking.

    Signed-off-by: Tejun Heo
    Cc: Ben Hutchings
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

18 May, 2010

1 commit


06 May, 2010

1 commit

  • Some arrays are giving I/O errors with ext3 filesystems when
    SYNCHRONIZE_CACHE gets a UNIT_ATTENTION. What is happening is that
    these commands have no retries, so the UNIT_ATTENTION causes the
    barrier to fail. We should be enable retries here to clear any
    transient error and allow the barrier to succeed.

    Signed-off-by: Hannes Reinecke
    Cc: Stable Tree
    Signed-off-by: James Bottomley

    Hannes Reinecke
     

12 Apr, 2010

2 commits

  • Hazard testing uncovered yet another bug in sd. Under heavy reset
    activity the retry counter might be exhausted and the command will be
    returned with sense UNIT_ATTENTION/0x29/00 (POWER ON, RESET, OR BUS
    DEVICE RESET OCCURRED). In those cases we should just increase the
    retry counter again, retrying one more to clear up this Unit Attention
    state.

    [jejb: update to work with RC16 devices and not to loop endlessly]
    Signed-off-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    James Bottomley
     
  • sd always tries to submit a READ_CAPACITY(16) CDB,
    regardless whether the host actually supports it.
    queuecommand() will then return DID_ABORT, which is
    not qualified enough to detect the true cause here.
    So better check in sd_try_rc16 first if the cdblen
    is supported.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    Hannes Reinecke
     

10 Apr, 2010

1 commit

  • * 'for-linus' of git://git.kernel.dk/linux-2.6-block: (34 commits)
    cfq-iosched: Fix the incorrect timeslice accounting with forced_dispatch
    loop: Update mtime when writing using aops
    block: expose the statistics in blkio.time and blkio.sectors for the root cgroup
    backing-dev: Handle class_create() failure
    Block: Fix block/elevator.c elevator_get() off-by-one error
    drbd: lc_element_by_index() never returns NULL
    cciss: unlock on error path
    cfq-iosched: Do not merge queues of BE and IDLE classes
    cfq-iosched: Add additional blktrace log messages in CFQ for easier debugging
    i2o: Remove the dangerous kobj_to_i2o_device macro
    block: remove 16 bytes of padding from struct request on 64bits
    cfq-iosched: fix a kbuild regression
    block: make CONFIG_BLK_CGROUP visible
    Remove GENHD_FL_DRIVERFS
    block: Export max number of segments and max segment size in sysfs
    block: Finalize conversion of block limits functions
    block: Fix overrun in lcm() and move it to lib
    vfs: improve writeback_inodes_wb()
    paride: fix off-by-one test
    drbd: fix al-to-on-disk-bitmap for 4k logical_block_size
    ...

    Linus Torvalds
     

30 Mar, 2010

1 commit

  • …it 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>

    Tejun Heo
     

19 Mar, 2010

2 commits

  • Conflicts:
    block/Kconfig

    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (69 commits)
    [SCSI] scsi_transport_fc: Fix synchronization issue while deleting vport
    [SCSI] bfa: Update the driver version to 2.1.2.1.
    [SCSI] bfa: Remove unused header files and did some cleanup.
    [SCSI] bfa: Handle SCSI IO underrun case.
    [SCSI] bfa: FCS and include file changes.
    [SCSI] bfa: Modified the portstats get/clear logic
    [SCSI] bfa: Replace bfa_get_attr() with specific APIs
    [SCSI] bfa: New portlog entries for events (FIP/FLOGI/FDISC/LOGO).
    [SCSI] bfa: Rename pport to fcport in BFA FCS.
    [SCSI] bfa: IOC fixes, check for IOC down condition.
    [SCSI] bfa: In MSIX mode, ignore spurious RME interrupts when FCoE ports are in FW mismatch state.
    [SCSI] bfa: Fix Command Queue (CPE) full condition check and ack CPE interrupt.
    [SCSI] bfa: IOC recovery fix in fcmode.
    [SCSI] bfa: AEN and byte alignment fixes.
    [SCSI] bfa: Introduce a link notification state machine.
    [SCSI] bfa: Added firmware save clear feature for BFA driver.
    [SCSI] bfa: FCS authentication related changes.
    [SCSI] bfa: PCI VPD, FIP and include file changes.
    [SCSI] bfa: Fix to copy fpma MAC when requested by user space application.
    [SCSI] bfa: RPORT state machine: direct attach mode fix.
    ...

    Linus Torvalds
     

16 Mar, 2010

1 commit

  • This flag is not used, so best discarded.

    Signed-off-by: NeilBrown
    --
    Hi Jens,
    I came across this recently - these are the only two occurances
    of "GENHD_FL_DRIVERFS" in the kernel, so it cannot be needed.
    NeilBrown
    Signed-off-by: Jens Axboe

    NeilBrown
     

08 Mar, 2010

1 commit


03 Mar, 2010

1 commit

  • Commit e3deec09 incorrectly assumed that the B0 and B1 page lengths were
    limited to 32 bytes. The B0 VPD page length is defined to be 64 bytes
    when the device supports thin provisioning. B1 is always defined to be
    64 bytes.

    Signed-off-by: Martin K. Petersen
    Reported-by: Dan Carpenter
    Signed-off-by: James Bottomley

    Martin K. Petersen
     

20 Feb, 2010

1 commit

  • Having the large CDB allocation logic in sd.c means that
    scsi_io_completion does not have access to the command buffer. That in
    turn causes garbage to be printed when a 32-byte command fails. Move the
    command printing to sd_done where the command buffer is intact. Clear
    the command buffer pointer after the extended CDB has been freed.

    Make scsi_print_command ignore commands with NULL CDB pointers to
    inhibit printing of garbled command strings.

    Signed-off-by: Martin K. Petersen
    Reviewed-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Martin K. Petersen
     

09 Feb, 2010

2 commits


19 Jan, 2010

1 commit


10 Dec, 2009

1 commit

  • Implement a function for handling discard requests that sends either
    WRITE SAME(16) or UNMAP(10) depending on parameters indicated by the
    device in the block limits VPD.

    Extract unmap constraints and report them to the block layer.

    Based in part by a patch by Christoph Hellwig .

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     

02 Oct, 2009

2 commits

  • Disks formatted with DIF Type 2 reject READ/WRITE 6/10/12/16 commands
    when protection is enabled. Only the 32-byte variants are supported.

    Implement support for issusing 32-byte READ/WRITE and enable Type 2
    drives in the protection type detection logic.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • So far we have only issued DIF commands if CONFIG_BLK_DEV_INTEGRITY is
    enabled. However, communication between initiator and target should be
    independent of protection information DMA. There are DIF-only host
    adapters coming out that will be able to take advantage of this.

    Move the relevant DIF bits to sd.c.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     

22 Sep, 2009

1 commit


12 Sep, 2009

1 commit

  • Chris Webb reported:
    p0# uname -a
    Linux f7ea8425-d45b-490f-a738-d181d0df6963.host.elastichosts.com 2.6.30.4-elastic-lon-p #2 SMP PREEMPT Thu Aug 20 14:30:50 BST 2009 x86_64 Intel(R) Xeon(R) CPU E5420 @ 2.50GHz GenuineIntel GNU/Linux
    p0# zgrep SCAN_ASYNC /proc/config.gz
    # CONFIG_SCSI_SCAN_ASYNC is not set

    p0# cat /var/log/kern/2009-08-20
    [...]
    15:27:10.485 kernel: scsi9 : iSCSI Initiator over TCP/IP
    15:27:11.493 kernel: scsi 9:0:0:0: RAID IET Controller 0001 PQ: 0 ANSI: 5
    15:27:11.493 kernel: scsi 9:0:0:0: Attached scsi generic sg6 type 12
    15:27:11.495 kernel: scsi 9:0:0:1: Direct-Access IET VIRTUAL-DISK 0001 PQ: 0 ANSI: 5
    15:27:11.495 kernel: sd 9:0:0:1: Attached scsi generic sg7 type 0
    15:27:11.495 kernel: sd 9:0:0:1: [sdg] 4194304 512-byte hardware sectors: (2.14 GB/2.00 GiB)
    15:27:11.495 kernel: sd 9:0:0:1: [sdg] Write Protect is off
    15:27:11.495 kernel: sd 9:0:0:1: [sdg] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    15:27:13.012 kernel: sdg:scsi 9:0:0:1: [sdg] Unhandled error code
    15:27:13.012 kernel: scsi 9:0:0:1: [sdg] Result: hostbyte=0x07 driverbyte=0x00
    15:27:13.012 kernel: end_request: I/O error, dev sdg, sector 0
    15:27:13.012 kernel: Buffer I/O error on device sdg, logical block 0
    15:27:13.012 kernel: ldm_validate_partition_table(): Disk read failed.
    15:27:13.012 kernel: unable to read partition table
    15:27:13.014 kernel: BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
    15:27:13.014 kernel: IP: [] disk_part_iter_next+0x74/0xfd
    15:27:13.014 kernel: PGD 82ad0b067 PUD 82cd7e067 PMD 0
    15:27:13.014 kernel: Oops: 0000 [#1] PREEMPT SMP
    15:27:13.014 kernel: last sysfs file: /sys/devices/platform/host9/session4/iscsi_session/session4/ifacename
    15:27:13.014 kernel: CPU 5
    15:27:13.014 kernel: Modules linked in:
    15:27:13.014 kernel: Pid: 13999, comm: async/0 Not tainted 2.6.30.4-elastic-lon-p #2 X7DBN
    15:27:13.014 kernel: RIP: 0010:[] [] disk_part_iter_next+0x74/0xfd
    15:27:13.014 kernel: RSP: 0018:ffff88066afa3dd0 EFLAGS: 00010246
    15:27:13.014 kernel: RAX: ffff88082b58a000 RBX: ffff88066afa3e00 RCX: 0000000000000000
    15:27:13.014 kernel: RDX: 0000000000000000 RSI: ffff88082b58a000 RDI: 0000000000000000
    15:27:13.014 kernel: RBP: ffff88066afa3df0 R08: ffff88066afa2000 R09: ffff8806a204f000
    15:27:13.014 kernel: R10: 000000fb12c7d274 R11: ffff8806c2bf0628 R12: ffff88066afa3e00
    15:27:13.014 kernel: R13: ffff88082c829a00 R14: 0000000000000000 R15: ffff8806bc50c920
    15:27:13.014 kernel: FS: 0000000000000000(0000) GS:ffff88002818a000(0000) knlGS:0000000000000000
    15:27:13.014 kernel: CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
    15:27:13.014 kernel: CR2: 0000000000000010 CR3: 000000082ade3000 CR4: 00000000000426e0
    15:27:13.014 kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    15:27:13.014 kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    15:27:13.014 kernel: Process async/0 (pid: 13999, threadinfo ffff88066afa2000, task ffff8806c2bf05e0)
    15:27:13.014 kernel: Stack:
    15:27:13.014 kernel: 0000000000000000 ffff88066afa3e00 ffff88066afa3e00 ffff88082c829a00
    15:27:13.014 kernel: ffff88066afa3e40 ffffffff80306feb ffff88082b58a000 0000000000000000
    15:27:13.014 kernel: 0000000000000001 ffff8806bc50c920 ffff88066afa3e40 ffff88082b58a000
    15:27:13.014 kernel: Call Trace:
    15:27:13.014 kernel: [] register_disk+0x122/0x13a
    15:27:13.014 kernel: [] add_disk+0xaa/0x106
    15:27:13.014 kernel: [] sd_probe_async+0x198/0x25b
    15:27:13.014 kernel: [] async_thread+0x10c/0x20d
    15:27:13.014 kernel: [] ? default_wake_function+0x0/0xf
    15:27:13.014 kernel: [] ? async_thread+0x0/0x20d
    15:27:13.014 kernel: [] kthread+0x55/0x80
    15:27:13.014 kernel: [] child_rip+0xa/0x20
    15:27:13.014 kernel: [] ? kthread+0x0/0x80
    15:27:13.014 kernel: [] ? child_rip+0x0/0x20
    15:27:13.014 kernel: Code: c8 ff 80 e1 0c b9 00 00 00 00 0f 44 c1 41 83 cd ff 48 8d 7a 20 48 be ff ff ff ff 08 00 00 00 48 b9 00 00 00 00 08 00 00 00 eb 50 42 10 41 bd 01 00 00 00 eb db 4c 63 c2 4e 8d 04 c7 4d 8b 20
    15:27:13.015 kernel: RIP [] disk_part_iter_next+0x74/0xfd
    15:27:13.015 kernel: RSP
    15:27:13.015 kernel: CR2: 0000000000000010
    15:27:13.015 kernel: ---[ end trace 6104b56ef5590e25 ]---

    The problem is caused because the async scanning split in sd.c doesn't hold
    any reference to the device when it kicks off the async piece. What's
    happening is that an iSCSI disconnect is destorying the device again *before*
    the async sd scanning thread even starts. Fix this by taking a reference
    before starting the thread and dropping it again when the thread completes.

    Reported-by: Chris Webb
    Cc: Stable Tree
    Signed-off-by: James Bottomley

    James Bottomley
     

31 Jul, 2009

1 commit

  • Some USB devices crash when we send them an inquiry with the EVPD bit
    set, regardless of page requested (i.e. including page 0).

    We only need the extended inquiry to gain access to VPD pages 0xB0 and
    0xB1. These appeared in SBC2 and SBC3 respectively, so we can restrict
    sending the extended inquiry to devices reporting SPC3 or higher.

    This fixes bugzilla.kernel.org #13657.

    Signed-off-by: Martin K. Petersen
    [jejb: added comment]
    Signed-off-by: James Bottomley

    Martin K. Petersen