08 Aug, 2010
40 commits
-
the block layer doesn't set rq->cmd_type on flush requests. By
definition, it should be REQ_TYPE_FS (the lower layers build a command
and interpret the result of it, that is, the block layer doesn't know
the details).Signed-off-by: FUJITA Tomonori
Signed-off-by: Jens Axboe -
The struct cont_t is just a set of virtual function pointers.
Signed-off-by: Stephen Hemminger
Signed-off-by: Andrew Morton
Signed-off-by: Jens Axboe -
Use memdup_user when user data is immediately copied into the
allocated region. Some checkpatch cleanups in nearby code.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@- to = \(kmalloc@p\|kzalloc@p\)(size,flag);
+ to = memdup_user(from,size);
if (
- to==NULL
+ IS_ERR(to)
|| ...) {
}
- if (copy_from_user(to, from, size) != 0) {
-
- }
//Signed-off-by: Julia Lawall
Cc: Chirag Kantharia
Signed-off-by: Andrew Morton
Signed-off-by: Jens Axboe -
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_PCThe 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 -
cciss: cleanup interrupt_not_for_us
In the case of MSI/MSIX interrutps, we don't need to check
if the interrupt is for us, and in the case of the intx interrupt
handler, when checking if the interrupt is for us, we don't need
to check if we're using MSI/MSIX, we know we're not.Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: change printks to dev_warn, etc.
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: separate cmd_alloc() and cmd_special_alloc()
cmd_alloc() took a parameter which caused it to either allocate
from a pre-allocated pool, or allocate using pci_alloc_consistent.
This parameter is always known at compile time, so this would
be better handled by breaking the function into two functions
and differentiating the cases by function names. Same goes
for cmd_free().Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: use consistent variable names
"h", for the hba structure and "c" for the command structures.
and get rid of trivial CCISS_LOCK macro.Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: forbid hard reset of 640x boards
The 6402/6404 are two PCI devices -- two Smart Array controllers
-- that fit into one slot. It is possible to reset them independently,
however, they share a battery backed cache module. One of the pair
controls the cache and the 2nd one access the cache through the first
one. If you reset the one controlling the cache, the other one will
not be a happy camper. So we just forbid resetting this conjoined
mess.Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: sanitize max commands
Some controllers might try to tell us they support 0 commands
in performant mode. This is a lie told by buggy firmware.
We have to be wary of this lest we try to allocate a negative
number of command blocks, which will be treated as unsigned,
and get an out of memory condition.Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: Fix hard reset code.
Smart Array controllers newer than the P600 do not honor the
PCI power state method of resetting the controllers. Instead,
in these cases we can get them to reset via the "doorbell" register.This escaped notice until we began using "performant" mode because
the fact that the controllers did not reset did not normally
impede subsequent operation, and so things generally appeared to
"work". Once the performant mode code was added, if the controller
does not reset, it remains in performant mode. The code immediately
after the reset presumes the controller is in "simple" mode
(which previously, it had remained in simple mode the whole time).
If the controller remains in performant mode any code which presumes
it is in simple mode will not work. So the reset needs to be fixed.Unfortunately there are some controllers which cannot be reset by
either method. (eg. p800). We detect these cases by noticing that
the controller seems to remain in performant mode even after a
reset has been attempted. In those cases we ignore the controller,
as any commands outstanding on it will result in stale completions.
To sum up, we try to do a better job of resetting the controller if
"reset_devices" is set, and if it doesn't work, we ignore that
controller.Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_reset_devices()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
Rationale for this is that I will also need to use this code
in fixing kdump host reset code prior to having the hba structure.Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_enter_performant_mode
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_wait_for_mode_change_ack()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: make cciss_put_controller_into_performant_mode as __devinit
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: cleanup some debug ifdefs
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_p600_dma_prefetch_quirk()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_enable_scsi_prefetch()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out CISS_signature_present()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_find_board_params
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: fix leak of ioremapped memory
in cciss_pci_init error path.Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_find_cfgtables
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_wait_for_board_ready()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_find_memory_BAR()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: remove board_id parameter from cciss_interrupt_mode()
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_board_disabled
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: factor out cciss_lookup_board_id
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: save pdev pointer in per hba structure early to avoid passing it around so much.
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
cciss: Set the performant mode bit in the scsi half of the driver
In a couple of places, the performant mode bit wasn't being set in
the scsi half of the driver, causing commands to seem to hang. Use
enqueue_cmd_and_start_io() where appropriate. This fixes a bug thatecho engage scsi > /proc/driver/cciss/cciss0
would hang.
Signed-off-by: Stephen M. Cameron
Signed-off-by: Jens Axboe -
Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Jens Axboe -
This is just bd_openers, protected by the bd_mutex.
Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Jens Axboe -
This is just bd_openers, protected by the bd_mutex.
Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Jens Axboe -
Same approach as blkfront_closing:
* Grab the bdev safely, holding the info mutex.
* Zap xbdev safely, holding the info mutex.
* Try bdev removal safely, holding bd_mutex.Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge -
We cannot read backend state within bdev operations, because it risks
grabbing the state change before xenbus gets to do it.Fixed by tracking deferral with a frontend switch to Closing. State
exposure isn't strictly necessary, but the backends won't mind.For a 'clean' deferral this seems actually a more decent protocol than
raising errors.Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Jens Axboe -
We need not mind if users grab a late handle on a closing disk. We
probably even should not. But we have to make sure it's not a dead
one alreadyLet the bdev deal with a gendisk deleted under its feet. Takes the
info mutex to decide a race against backend closing.Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Jens Axboe -
The bdev .open/.release fops race against backend switches to Closing,
handled by the XenBus thread.The original code attempted to serialize block device holders and
xenbus only via bd_mutex. This is insufficient, the info->bd pointer
may already be stale (or null) while xenbus tries to bump up the
refcount.Protect blkfront_info with a dedicated mutex.
Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge -
* Current blkfront_closing is rather a xlvbd_release_gendisk.
Renamed in preparation of later patches (need the name again).* Removed the misleading comment -- this only applied to the backend
switch handler, and the queue is already flushed btw.* Break out the xenbus call, callers know better when to switch
frontend state.Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Jens Axboe -
Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge -
The call to del_gendisk follows an non-refcounted gd->queue
pointer. We release the last ref in blk_cleanup_queue. Fixed by
reordering releases accordingly.Signed-off-by: Daniel Stodden
Signed-off-by: Jeremy Fitzhardinge