Re: [PATCH] blk request timeout minor fixes...
On Mon, Dec 03 2007, [EMAIL PROTECTED] wrote: Matthew Wilcox [EMAIL PROTECTED] wrote: On Sun, Dec 02, 2007 at 05:53:30PM -0800, [EMAIL PROTECTED] wrote: Can I suggest running 'pahole' over this when compiled on 64-bit? You've just introduced a 4-byte hole. This one fixes the 4-byte hole. Thank you very much. That's all fine, but now we have two fields doing essentially the same thing. Care to cleanup the -timeout usage so we can get by with using just that field? -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] 2.6.23-rc3 can't see sd partitions on Alpha
* Bob Tracy [EMAIL PROTECTED] wrote: Finally got back in town. Starting the git-bisect process. I've got a relatively slow network connection, and the PWS 433au isn't exactly what I would call fast by modern standards, so bear with me while I get things set up and crank through this. The clone of the 2.6 tree will take several more hours to finish downloading. I anticipate the best pace I'll be able to manage after that is two iterations in a 24- hour period. once you are done with the download of the initial cloned git repository (which is 200MB+), all the bisection steps will be local and you'll be only limited by kernel rebuild speed and by bootup and testing speed, not by network bandwidth. ( once you have the cloned repository i'd suggest for you to keep it - that way you can track susequent kernels via git-pull and it uses a very network-efficient delta protocol. ) Ingo - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/28] blk_end_request: full I/O completion handler (take 3)
On Fri, Nov 30 2007, Kiyoshi Ueda wrote: Hello Jens, The following is the updated patch-set for blk_end_request(). Changes since the last version are only minor updates to catch up with the base kernel changes. Do you agree the implementation of blk_end_request()? If there's no problem, could you merge it to your tree? Or does it have to be merged to -mm tree first? Boaz, Could you review the newly added PATCH 27 which converts the bidi part, and give me your comments? It uses blk_end_request_callback() in PATCH 25, which was only for the tricky ide-cd driver. If bidi added a 'resid' member to struct request instead of reusing 'data_len' for the other purpose, it could use the standard blk_end_request() instead. -- Changes from the previous post - Changes between take2 and take3: o Rebased on top of 2.6.24-rc3-mm2 OK, so this means that I can't apply it unfortunately. It depends on other patches in -mm (bidi). SCSI sits on block, so the best approach imho is to base this patchset on mainline so I can include the block bits. -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/28] blk_end_request: full I/O completion handler (take 3)
On Fri, Nov 30 2007, Kiyoshi Ueda wrote: Hello Jens, The following is the updated patch-set for blk_end_request(). Changes since the last version are only minor updates to catch up with the base kernel changes. Do you agree the implementation of blk_end_request()? If there's no problem, could you merge it to your tree? Or does it have to be merged to -mm tree first? Looks good to me now, I'll queue it up. Thanks! -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
* Kamalesh Babulal [EMAIL PROTECTED] wrote: So 2.6.24-rc3 was OK and 2.6.24-rc3-git2 is not? Yes, the 2.6.24-rc3 was Ok and this is seen from 2.6.24-rc3-git2/3/4. just to make sure: this is a real lockup and failed bootup (or device init), not just a message, right? Ingo - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 26/28] blk_end_request: changing ide-cd (take 3)
Hi, On Monday 03 December 2007, Kiyoshi Ueda wrote: [...] Thank you for the comments. I rebased my patch on top of 2.6.24-rc3-mm2 + the patch to remove post_transform_command(). As a result, one callback function for DMA mode has been removed. What do you think about the patch below? Subject: [PATCH 26/28] blk_end_request: changing ide-cd (take 3) This patch converts ide-cd (cdrom_newpc_intr()) to use blk_end_request interfaces. In PIO mode, ide-cd (cdrom_newpc_intr()) needs to defer end_that_request_last() until the device clears DRQ_STAT and raises an interrupt after end_that_request_first(). So blk_end_request() has to return without completing request even if no leftover in the request. ide-cd uses blk_end_request_callback() and a dummy callback function, which just returns value '1', to tell blk_end_request_callback() about that. Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED] Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED] Looks good, thanks! Acked-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 24/28] blk_end_request: changing ide normal caller (take 3)
On Tuesday 04 December 2007, Kiyoshi Ueda wrote: Hi Bartlomiej, On Sat, 1 Dec 2007 23:53:05 +0100, Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote: On Saturday 01 December 2007, Kiyoshi Ueda wrote: This patch converts normal parts of ide to use blk_end_request(). Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED] Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED] --- drivers/ide/ide-cd.c |6 +++--- drivers/ide/ide-io.c | 17 ++--- 2 files changed, 9 insertions(+), 14 deletions(-) [...] Index: 2.6.24-rc3-mm2/drivers/ide/ide-io.c === --- 2.6.24-rc3-mm2.orig/drivers/ide/ide-io.c +++ 2.6.24-rc3-mm2/drivers/ide/ide-io.c @@ -78,14 +78,9 @@ static int __ide_end_request(ide_drive_t ide_dma_on(drive); } - if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { - add_disk_randomness(rq-rq_disk); - if (dequeue) { - if (!list_empty(rq-queuelist)) - blkdev_dequeue_request(rq); + if (!__blk_end_request(rq, uptodate, nr_bytes)) { + if (dequeue) HWGROUP(drive)-rq = NULL; - } - end_that_request_last(rq, uptodate); ret = 0; } Hmmm, this seems to change the old behavior (the request should be dequeued from the queue only if 'dequeue' variable is set) and AFAIR some error handling code (in ide-cd?) depends on the old behavior so please revisit this patch. blk_end_request() takes care of the dequeue like below, so I think no problem. (Please see PATCH 01) + /* rq-queuelist of dequeued request should be list_empty() */ + if (!list_empty(rq-queuelist)) + blkdev_dequeue_request(rq); In the case of ide-cd, o 'dequeue' variable is 1 only when the request is still linked to the queue (i.e. rq-queuelist is not empty) o 'dequeue' variable is 0 only when the request has already been removed from the queue (i.e. rq-queuelist is empty) So blk_end_request() can handle it correctly. It would be helpful to add the above explanation to a patch description. If there are any drivers which don't want dequeue the queued request, the code above would not work. But, as far as I investigated, I have never seen such a requirement in device drivers. Do you think that ide may still gets a problem for the 'dequeue'? Everything seems to be fine now. Acked-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/28] blk_end_request: add new request completion interface (take 3)
On Sat, Dec 01 2007 at 1:24 +0200, Kiyoshi Ueda [EMAIL PROTECTED] wrote: This patch adds 2 new interfaces for request completion: o blk_end_request() : called without queue lock o __blk_end_request() : called with queue lock held Some device drivers call some generic functions below between end_that_request_{first/chunk} and end_that_request_last(). o add_disk_randomness() o blk_queue_end_tag() o blkdev_dequeue_request() These are called in the blk_end_request() as a part of generic request completion. So all device drivers become to call above functions. Normal drivers can be converted to use blk_end_request() in a standard way shown below. a) end_that_request_{chunk/first} spin_lock_irqsave() (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request()) end_that_request_last() spin_unlock_irqrestore() = blk_end_request() b) spin_lock_irqsave() end_that_request_{chunk/first} (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request()) end_that_request_last() spin_unlock_irqrestore() = spin_lock_irqsave() __blk_end_request() spin_unlock_irqsave() c) end_that_request_last() = __blk_end_request() Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED] Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED] comments in body --- block/ll_rw_blk.c | 67 + include/linux/blkdev.h |2 + 2 files changed, 69 insertions(+) Index: 2.6.24-rc3-mm2/block/ll_rw_blk.c === --- 2.6.24-rc3-mm2.orig/block/ll_rw_blk.c +++ 2.6.24-rc3-mm2/block/ll_rw_blk.c @@ -3769,6 +3769,73 @@ void end_request(struct request *req, in } EXPORT_SYMBOL(end_request); +static void complete_request(struct request *rq, int uptodate) +{ + if (blk_rq_tagged(rq)) + blk_queue_end_tag(rq-q, rq); + + /* rq-queuelist of dequeued request should be list_empty() */ + if (!list_empty(rq-queuelist)) + blkdev_dequeue_request(rq); + + end_that_request_last(rq, uptodate); +} + +/** + * blk_end_request - Helper function for drivers to complete the request. + * @rq: the request being processed + * @uptodate: 1 for success, 0 for I/O error, 0 for specific error + * @nr_bytes: number of bytes to complete + * + * Description: + * Ends I/O on a number of bytes attached to @rq. + * If @rq has leftover, sets it up for the next range of segments. + * + * Return: + * 0 - we are done with this request + * 1 - still buffers pending for this request + **/ +int blk_end_request(struct request *rq, int uptodate, int nr_bytes) I always hated that uptodate boolean with possible negative error value. I guess it was done for backward compatibility of then users of end_that_request_first(). But since you are introducing a new API then this is not the case. Just have regular status int where 0 means ALL_OK and negative value means error code. Just my $0.02. +{ + struct request_queue *q = rq-q; + unsigned long flags = 0UL; + + if (blk_fs_request(rq) || blk_pc_request(rq)) { + if (__end_that_request_first(rq, uptodate, nr_bytes)) + return 1; + } + + add_disk_randomness(rq-rq_disk); + + spin_lock_irqsave(q-queue_lock, flags); + complete_request(rq, uptodate); + spin_unlock_irqrestore(q-queue_lock, flags); + + return 0; +} +EXPORT_SYMBOL_GPL(blk_end_request); + +/** + * __blk_end_request - Helper function for drivers to complete the request. + * + * Description: + * Must be called with queue lock held unlike blk_end_request(). + **/ +int __blk_end_request(struct request *rq, int uptodate, int nr_bytes) +{ + if (blk_fs_request(rq) || blk_pc_request(rq)) { + if (__end_that_request_first(rq, uptodate, nr_bytes)) + return 1; + } + + add_disk_randomness(rq-rq_disk); + + complete_request(rq, uptodate); + + return 0; +} +EXPORT_SYMBOL_GPL(__blk_end_request); + static void blk_rq_bio_prep(struct request_queue *q, struct request *rq, struct bio *bio) { Index: 2.6.24-rc3-mm2/include/linux/blkdev.h === --- 2.6.24-rc3-mm2.orig/include/linux/blkdev.h +++ 2.6.24-rc3-mm2/include/linux/blkdev.h @@ -725,6 +725,8 @@ static inline void blk_run_address_space * for parts of the original function. This prevents * code duplication in drivers. */ +extern int blk_end_request(struct request *rq, int uptodate, int nr_bytes); +extern int __blk_end_request(struct request *rq, int uptodate, int nr_bytes); extern int end_that_request_first(struct request *, int, int); extern int end_that_request_chunk(struct request *, int, int); extern void end_that_request_last(struct request *, int); I
Re: [PATCH 27/28] blk_end_request: changing scsi mid-layer for bidi (take 3)
On Sat, Dec 01 2007 at 1:35 +0200, Kiyoshi Ueda [EMAIL PROTECTED] wrote: This patch converts bidi of scsi mid-layer to use blk_end_request(). rq-next_rq represents a pair of bidi requests. (There are no other use of 'next_rq' of struct request.) For both requests in the pair, end_that_request_chunk() should be called before end_that_request_last() is called for one of them. Since the calls to end_that_request_first()/chunk() and end_that_request_last() are packaged into blk_end_request(), the handling of next_rq completion has to be moved into blk_end_request(), too. Bidi sets its specific value to rq-data_len before the request is completed so that upper-layer can read it. This setting must be between end_that_request_chunk() and end_that_request_last(), because rq-data_len may be used in end_that_request_chunk() by blk_trace and so on. To satisfy the requirement, use blk_end_request_callback() which is added in PATCH 25 only for the tricky drivers. If bidi didn't reuse rq-data_len and added new members to request for the specific value, it could set before end_that_request_chunk() and use the standard blk_end_request() like below. void scsi_end_bidi_request(struct scsi_cmnd *cmd) { struct request *req = cmd-request; rq-resid = scsi_out(cmd)-resid; rq-next_rq-resid = scsi_in(cmd)-resid; if (blk_end_request(req, 1, req-data_len)) BUG(); scsi_release_buffers(cmd); scsi_next_command(cmd); } Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED] Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED] --- block/ll_rw_blk.c | 18 + drivers/scsi/scsi_lib.c | 66 2 files changed, 52 insertions(+), 32 deletions(-) Index: 2.6.24-rc3-mm2/drivers/scsi/scsi_lib.c === --- 2.6.24-rc3-mm2.orig/drivers/scsi/scsi_lib.c +++ 2.6.24-rc3-mm2/drivers/scsi/scsi_lib.c @@ -629,28 +629,6 @@ void scsi_run_host_queues(struct Scsi_Ho scsi_run_queue(sdev-request_queue); } -static void scsi_finalize_request(struct scsi_cmnd *cmd, int uptodate) -{ - struct request_queue *q = cmd-device-request_queue; - struct request *req = cmd-request; - unsigned long flags; - - add_disk_randomness(req-rq_disk); - - spin_lock_irqsave(q-queue_lock, flags); - if (blk_rq_tagged(req)) - blk_queue_end_tag(q, req); - - end_that_request_last(req, uptodate); - spin_unlock_irqrestore(q-queue_lock, flags); - - /* - * This will goose the queue request function at the end, so we don't - * need to worry about launching another command. - */ - scsi_next_command(cmd); -} - /* * Function:scsi_end_request() * @@ -921,6 +899,20 @@ void scsi_release_buffers(struct scsi_cm EXPORT_SYMBOL(scsi_release_buffers); /* + * Called from blk_end_request_callback() after all DATA in rq and its next_rq + * are completed before rq is completed/freed. + */ +static int scsi_end_bidi_request_cb(struct request *rq) +{ + struct scsi_cmnd *cmd = rq-special; + + rq-data_len = scsi_out(cmd)-resid; + rq-next_rq-data_len = scsi_in(cmd)-resid; + + return 0; +} + +/* * Bidi commands Must be complete as a whole, both sides at once. * If part of the bytes were written and lld returned * scsi_in()-resid and/or scsi_out()-resid this information will be left @@ -931,22 +923,32 @@ void scsi_end_bidi_request(struct scsi_c { struct request *req = cmd-request; - end_that_request_chunk(req, 1, req-data_len); - req-data_len = scsi_out(cmd)-resid; - - end_that_request_chunk(req-next_rq, 1, req-next_rq-data_len); - req-next_rq-data_len = scsi_in(cmd)-resid; - - scsi_release_buffers(cmd); - /* *FIXME: If ll_rw_blk.c is changed to also put_request(req-next_rq) - * in end_that_request_last() then this WARN_ON must be removed. + * in blk_end_request() then this WARN_ON must be removed. * for now, upper-driver must have registered an end_io. */ WARN_ON(!req-end_io); - scsi_finalize_request(cmd, 1); + /* + * blk_end_request() family take care of data completion of next_rq. + * + * req-data_len and req-next_rq-data_len must be set after + * all data are completed, since they may be referenced during + * the data completion process. + * So use the callback feature of blk_end_request() here. + * + * NOTE: If bidi doesn't reuse the data_len field for upper-layer's + * reference (e.g. adds new members for it to struct request), + * we can use the standard blk_end_request() interface here. + */ + if (blk_end_request_callback(req, 1, req-data_len, + scsi_end_bidi_request_cb)) + /*
Re: [PATCH 00/28] blk_end_request: full I/O completion handler (take 3)
On Tue, Dec 04 2007 at 14:16 +0200, Jens Axboe [EMAIL PROTECTED] wrote: On Fri, Nov 30 2007, Kiyoshi Ueda wrote: Hello Jens, The following is the updated patch-set for blk_end_request(). Changes since the last version are only minor updates to catch up with the base kernel changes. Do you agree the implementation of blk_end_request()? If there's no problem, could you merge it to your tree? Or does it have to be merged to -mm tree first? Boaz, Could you review the newly added PATCH 27 which converts the bidi part, and give me your comments? It uses blk_end_request_callback() in PATCH 25, which was only for the tricky ide-cd driver. If bidi added a 'resid' member to struct request instead of reusing 'data_len' for the other purpose, it could use the standard blk_end_request() instead. -- Changes from the previous post - Changes between take2 and take3: o Rebased on top of 2.6.24-rc3-mm2 OK, so this means that I can't apply it unfortunately. It depends on other patches in -mm (bidi). SCSI sits on block, so the best approach imho is to base this patchset on mainline so I can include the block bits. I was wishing that the bidi work can go into 2.6.25, I guess that's James to say. If so than it is not important what order they go in. Or the patchset can be submitted in two parts, with scsi and remove-of- old-API in a later stage. Or *rant* Boaz can just rebase his work again *rant*. Kiyoshi, It's OK, if you have a maintainer that is willing to accept your work then go head, My code can wait, no problem. Just resolve the resid issue in scsi_io_completion() (See my other mail) Thanks for doing this Boaz - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Recent sym53c8xx patches
Tony Battersby wrote: Hello, I am sending this message to check up on the merge status of my recent sym53c8xx patches to make sure they aren't forgotten. Matthew Wilcox, could you give an ack/nak for these merge requests? Also, please let me know if I need to do anything else (such as resending later) to make sure these patches get merged. [PATCH] [SCSI] sym53c8xx: fix free_irq() regression in 2.6.24 http://marc.info/?t=11943826337r=1w=4 Regression fix. Should be merged in 2.6.24. OK'ed by Christoph Hellwig. [PATCH] [SCSI] sym53c8xx: fix resid calculation http://marc.info/?l=linux-scsim=119438360705773w=4 Bug fix. I would like it to be merged in 2.6.24. No replies to initial message. [PATCH] [SCSI] sym53c8xx: don't flood syslog with negotiation messages http://marc.info/?l=linux-scsim=119446914818689w=4 More an annoyance fix than a bug fix. Probably safe to merge for 2.6.24, but could wait for 2.6.25 if someone objects. No replies to initial message. [PATCH] [SCSI] sym53c8xx: fix setflag user command to control disconnects http://marc.info/?l=linux-scsim=119446790116497w=4 Fix for long-broken not-widely-used feature. Can be dropped if the disconnect attribute will be added to the SPI transport class in the near future. Is anyone working on this BTW? [PATCH] [SCSI] sym53c8xx: increase sg_tablesize for larger data transfers http://marc.info/?l=linux-scsim=119513922112712w=4 Enhancement. On hold for the moment due to speculation that it may break some 875 chips. Thanks, Tony Battersby I have waited a week, and I still have not received any replies from Matthew. I do however see that he has sent other messages to other people, so I don't believe that he is offline. At this point I am beginning to wonder if he is receiving my messages at all. I can't imagine that I did anything offensive; perhaps a well-meaning junk mail rule just doesn't like me for some reason. James, would you be willing to apply any of these patches without an explicit ack from Matthew (the sym53c8xx maintainer)? And could someone else please try contacting Matthew to see what's up? Side note: I have been operating under the assumption that patches against a driver should be acked by the maintainer of that driver before being merged. If that is not the case, then Matthew's reply isn't really that important, and I apologize for nagging. Thanks, Tony Battersby Cybernetics - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
Ingo Molnar wrote: * Kamalesh Babulal [EMAIL PROTECTED] wrote: So 2.6.24-rc3 was OK and 2.6.24-rc3-git2 is not? Yes, the 2.6.24-rc3 was Ok and this is seen from 2.6.24-rc3-git2/3/4. just to make sure: this is a real lockup and failed bootup (or device init), not just a message, right? Ingo -- Hi Ingo, This softlockup is seen in the 2.6.24-rc4 either and looks like a message because this is seen while running tbench and machine continues running other test's after the softlockup messages and some times seen with the bootup, but the machines reaches the login prompt and able to continue running tests. -- Thanks Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL. - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
MPTSAS Driver and scatter gather lists
I was doing some performance comparisons between the aic94xx sas adapter and the mptsas (lsi1078 chip) and saw that performance was slightly lower on lsi using the same drive. One thing I noticed the mptsas driver was only setting sg_tablesize to 40 which restricts the maximum size of the IO to 160kb. This is inefficient and so I changed it to 255 (max value) for testing purposes. The results were not what I expected. While CPU efficiency was improved at the larger block sizes (like I had hopped), there were drastic improvements at small (16k) block sizes which is completely surprising). So I decided to see where all the time was being spent. When doing oprofile, loss of idle ticks was confusing things so I booted with idle=poll, and magically the original mptsas driver now performs like the modified version at the small block sizes. My suspicion is that we have some some sleep delay which is minimized by going into poll mode, but I have no idea why changing the sg_tablesize gives the same results regardless of poll mode. I should reiterate that I am not talking about small difference. This is 2x performance at 1/3 cpu. Also, is there any reason we can't increase sg_tablesize for mptsas? Any thoughts or experiments to try are welcome. Steve - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] 2.6.23-rc3 can't see sd partitions on Alpha
Ingo Molnar wrote: once you are done with the download of the initial cloned git repository (which is 200MB+), all the bisection steps will be local and you'll be only limited by kernel rebuild speed and by bootup and testing speed, not by network bandwidth. ACK. Have tested two kernels in the past 24 hours, and the third is building as I type this. The builds seem to be taking about 3 hours each. First two tests good, so the offending commit is somewhere in the last 25% (roughly) of the changes between -rc2 and -rc3: git says 82 revisions left to test. Might have this painted into a corner in the next day or so. I'll try to be quick about it, since -rc4 is out. ( once you have the cloned repository i'd suggest for you to keep it - that way you can track susequent kernels via git-pull and it uses a very network-efficient delta protocol. ) Will do... I'm in the fortunate position of having enough disk space on my Alpha that I can maintain multiple trees for this kind of effort. -- Bob Tracy | They couldn't hit an elephant at this dist- [EMAIL PROTECTED] | - Last words of Union General John Sedgwick, | Battle of Spotsylvania Court House, U.S. Civil War - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Linux-usb-users] Read errors on Flash Drive Transcend TS1GJF2A
On Mon, Nov 26 2007 at 17:35 +0200, Alan Stern [EMAIL PROTECTED] wrote: Not all devices correctly report the error-causing LBA in the Information field of their sense data -- even when they set the Valid bit. This patch (as1019) makes sd much more cautious about accepting the reported LBA. If the value isn't within the range of blocks accessed during the I/O operation it is rejected, and instead the driver will try looking at the residue field (which currently it ignores completely). This fixes a data-corruption bug reported here: http://marc.info/?t=11874576475r=1w=2 Signed-off-by: Alan Stern [EMAIL PROTECTED] CC: Luben Tuikov [EMAIL PROTECTED] --- This patch should be considered for inclusion in 2.6.24. The bug in question has always existed, as far as I know, but before 2.6.18 it was masked by a different bug. This doesn't use the new SCSI accessors. In the development trees I've seen, those accessors haven't yet been imported into sd.c. If the patch needs to be rebased, please let me know where to find the current sd source. Presumably sr should use the same algorithm. That's grist for another patch. Index: usb-2.6/drivers/scsi/sd.c === --- usb-2.6.orig/drivers/scsi/sd.c +++ usb-2.6/drivers/scsi/sd.c @@ -968,7 +968,17 @@ static int sd_done(struct scsi_cmnd *SCp /* This computation should always be done in terms of * the resolution of the device's medium. */ - good_bytes = (bad_lba - start_lba)*SCpnt-device-sector_size; + if (start_lba = bad_lba bad_lba start_lba + + (xfer_size / SCpnt-device-sector_size)) + good_bytes = SCpnt-device-sector_size * + (unsigned int) (bad_lba - start_lba); + + /* If the bad_lba value is no good, maybe the residue value + * is better. + */ + else if (SCpnt-resid 0 SCpnt-resid xfer_size) + good_bytes = (xfer_size - SCpnt-resid) + (- SCpnt-device-sector_size); break; case RECOVERED_ERROR: case NO_SENSE: - perhaps below hunk should be added to your patch. Was it decided when this data corruption bugfix is merged. Also in sr.c. It does the range check but it might enjoy the resid handling as well. - drivers/scsi/scsi.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 796c0bd..1a576bc 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -714,6 +714,8 @@ void scsi_finish_command(struct scsi_cmnd *cmd) good_bytes = cmd-request_bufflen; if (cmd-request-cmd_type != REQ_TYPE_BLOCK_PC) { + if ( cmd-resid 0 cmd-resid good_bytes) + good_bytes -= cmd-resid; drv = scsi_cmd_to_driver(cmd); if (drv-done) good_bytes = drv-done(cmd); - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Linux-usb-users] Read errors on Flash Drive Transcend TS1GJF2A
On Tue, 4 Dec 2007, Boaz Harrosh wrote: perhaps below hunk should be added to your patch. It looks like a good idea. Was it decided when this data corruption bugfix is merged. I don't know -- I haven't heard anything back from James. Also in sr.c. It does the range check but it might enjoy the resid handling as well. I think the range checking in sr.c is completely wrong. The code doesn't check carefully to see that the error sector lies within the range of sectors being accessed; there's a possibility of overflow if the capacity is larger than 2**31 bytes. Also this line in particular makes no sense: error_sector = ~(block_sectors - 1); Like you said, using the residue value too wouldn't hurt. Furthermore the check for the Valid bit is done wrongly: if (!(SCpnt-sense_buffer[0] 0x90)) This will never be true because of the earlier test: if (driver_byte(result) != 0 /* An error occurred */ (SCpnt-sense_buffer[0] 0x7f) == 0x70) { /* Sense current */ It probably should test against 0x80 instead of 0x90. Alan Stern - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 24/28] blk_end_request: changing ide normal caller (take 3)
Hi Bartlomiej, On Tue, 4 Dec 2007 14:47:00 +0100, Bartlomiej Zolnierkiewicz wrote: Hmmm, this seems to change the old behavior (the request should be dequeued from the queue only if 'dequeue' variable is set) and AFAIR some error handling code (in ide-cd?) depends on the old behavior so please revisit this patch. blk_end_request() takes care of the dequeue like below, so I think no problem. (Please see PATCH 01) + /* rq-queuelist of dequeued request should be list_empty() */ + if (!list_empty(rq-queuelist)) + blkdev_dequeue_request(rq); In the case of ide-cd, o 'dequeue' variable is 1 only when the request is still linked to the queue (i.e. rq-queuelist is not empty) o 'dequeue' variable is 0 only when the request has already been removed from the queue (i.e. rq-queuelist is empty) So blk_end_request() can handle it correctly. It would be helpful to add the above explanation to a patch description. If there are any drivers which don't want dequeue the queued request, the code above would not work. But, as far as I investigated, I have never seen such a requirement in device drivers. Do you think that ide may still gets a problem for the 'dequeue'? Everything seems to be fine now. Acked-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Thank you for the check. OK, I'll add the explanation about the 'dequeue' to patch description. Thanks, Kiyoshi Ueda - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: MPTSAS Driver and scatter gather lists
On Tuesday, December 04, 2007 8:45 AM, Steven Pratt wrote: Also, is there any reason we can't increase sg_tablesize for mptsas? The default 128, set in Kconfig (look at FUSION_MAX_SGE).It only set to 40 when that is not defined. What is in your kernel .config, e.g look for CONFIG_FUSION_MAX_SGE. Eric - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] 2.6.24-rc3-git2 softlockup detected
* Kamalesh Babulal [EMAIL PROTECTED] wrote: Hi Ingo, This softlockup is seen in the 2.6.24-rc4 either and looks like a message because this is seen while running tbench and machine continues running other test's after the softlockup messages and some times seen with the bootup, but the machines reaches the login prompt and able to continue running tests. do you know whether there's any true delay when this happens, or is it a pure softlockup-detector false positive? Ingo - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
aic7-triple x build fixed in kbuild.git
akpm reported that: make mrproper make allmodconfig make drivers/scsi/aic7xxx/ were broken in recent kbuild.git - and as a logical consequence removed kbuild.git from his -mm lineup. I have now fixed it (stupid bug I made) and pushed out a fresh kbuild.git tree. As previously announced I am not very active in kbuild land the next couple of weeks so I may be slow if there is any comments. The fixed commit is included below. Sam commit 63b7c4e77e9204407ee8a5d5243ba9c502550252 Author: Vegard Nossum [EMAIL PROTECTED] Date: Fri Oct 26 13:31:13 2007 +0200 aic7(3*x): fix firmware build This patch adds the proper $(obj) and $(src) prefixes to dependency rules in aic7xxx makefile. Without this patch, there is a remote possibility that parallel make with a different output directory can fail. Also changed the deprecated EXTRA_CFLAGS construct to ccflags-y syntax. Fixed up patch to survive make drivers/scsi/ -j with BUILD_FIRMWARE enable. /Sam Signed-off-by: Vegard Nossum [EMAIL PROTECTED] Signed-off-by: Sam Ravnborg [EMAIL PROTECTED] Cc: linux-scsi@vger.kernel.org diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index 9a6ce19..e4f70c5 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile @@ -33,11 +33,10 @@ aic79xx-y += aic79xx_osm.o\ aic79xx_proc.o \ aic79xx_osm_pci.o -EXTRA_CFLAGS += -Idrivers/scsi +ccflags-y += -Idrivers/scsi ifdef WARNINGS_BECOME_ERRORS -EXTRA_CFLAGS += -Werror +ccflags-y += -Werror endif -#EXTRA_CFLAGS += -g # Files generated that shall be removed upon make clean clean-files := aic7xxx_seq.h aic7xxx_reg.h aic7xxx_reg_print.c @@ -46,53 +45,45 @@ clean-files += aic79xx_seq.h aic79xx_reg.h aic79xx_reg_print.c # Dependencies for generated files need to be listed explicitly $(obj)/aic7xxx_core.o: $(obj)/aic7xxx_seq.h +$(obj)/aic7xxx_core.o: $(obj)/aic7xxx_reg.h $(obj)/aic79xx_core.o: $(obj)/aic79xx_seq.h -$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped -$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped +$(obj)/aic79xx_core.o: $(obj)/aic79xx_reg.h -$(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_reg.h -$(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_reg.h +$(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_seq.h +$(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_seq.h -aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_seq.h \ - $(obj)/aic7xxx_reg.h +aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c aicasm-7xxx-opts-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) := \ -p $(obj)/aic7xxx_reg_print.c -i aic7xxx_osm.h ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y) -# Create a dependency chain in generated files -# to avoid concurrent invocations of the single -# rule that builds them all. -aic7xxx_seq.h: aic7xxx_reg.h -ifeq ($(CONFIG_AIC7XXX_REG_PRETTY_PRINT),y) -aic7xxx_reg.h: aic7xxx_reg_print.c -endif -$(aic7xxx-gen-y): $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm +$(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \ $(aicasm-7xxx-opts-y) -o $(obj)/aic7xxx_seq.h \ $(src)/aic7xxx.seq + +$(aic7xxx-gen-y): $(obj)/aic7xxx_seq.h +else +$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped endif -aic79xx-gen-$(CONFIG_AIC79XX_BUILD_FIRMWARE) := $(obj)/aic79xx_seq.h \ - $(obj)/aic79xx_reg.h +aic79xx-gen-$(CONFIG_AIC79XX_BUILD_FIRMWARE) := $(obj)/aic79xx_reg.h aic79xx-gen-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) += $(obj)/aic79xx_reg_print.c aicasm-79xx-opts-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) := \ -p $(obj)/aic79xx_reg_print.c -i aic79xx_osm.h ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y) -# Create a dependency chain in generated files -# to avoid concurrent invocations of the single -# rule that builds them all. -aic79xx_seq.h: aic79xx_reg.h -ifeq ($(CONFIG_AIC79XX_REG_PRETTY_PRINT),y) -aic79xx_reg.h: aic79xx_reg_print.c -endif -$(aic79xx-gen-y): $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm +$(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \ $(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \ $(src)/aic79xx.seq + +$(aic79xx-gen-y): $(obj)/aic79xx_seq.h +else +$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped endif $(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl] - To unsubscribe from this list: send the line unsubscribe
Re: [PATCH 01/28] blk_end_request: add new request completion interface (take 3)
Hi Boaz, On Tue, 04 Dec 2007 15:56:32 +0200, Boaz Harrosh [EMAIL PROTECTED] wrote: +int blk_end_request(struct request *rq, int uptodate, int nr_bytes) +{ + struct request_queue *q = rq-q; + unsigned long flags = 0UL; + + if (blk_fs_request(rq) || blk_pc_request(rq)) { + if (__end_that_request_first(rq, uptodate, nr_bytes)) + return 1; + } + + add_disk_randomness(rq-rq_disk); + + spin_lock_irqsave(q-queue_lock, flags); + complete_request(rq, uptodate); + spin_unlock_irqrestore(q-queue_lock, flags); + + return 0; +} +EXPORT_SYMBOL_GPL(blk_end_request); + +/** + * __blk_end_request - Helper function for drivers to complete the request. + * + * Description: + * Must be called with queue lock held unlike blk_end_request(). + **/ +int __blk_end_request(struct request *rq, int uptodate, int nr_bytes) +{ + if (blk_fs_request(rq) || blk_pc_request(rq)) { + if (__end_that_request_first(rq, uptodate, nr_bytes)) + return 1; + } + + add_disk_randomness(rq-rq_disk); + + complete_request(rq, uptodate); + + return 0; +} +EXPORT_SYMBOL_GPL(__blk_end_request); I don't like it that you have two Identical but slightly different implementations I wish you would do an internal-with-flags implementation and then API ones can call the internal one. Or maybe just hold the spin_lock just a bit longer and have one call the other. To prove my case see how hard it is to add new code like with the bidi patch, where you need to add exact same code in 3 places. (OK only 2 places actually, if _callback is gone) As for the internal-with-flags implementation, I once proposed something like below but it was rejected by Jens. (http://marc.info/?l=linux-kernelm=118880584720600w=2) -- static int internal_function(rq, needlock) { end_that_request_chunk(rq); if (needlock) spin_lock_irqsave(); end_that_request_last(rq); if (needlock) spin_unlock_irqrestore(); } int blk_end_request(rq) { return internal_function(rq, 1); } int __blk_end_request(rq) { return internal_function(rq, 0); } -- As for the holding-queue-lock-longer implementation, end_that_request_chunk() completes bios in the request and it can reaches filesystem layer and may take time. I guess many drivers like scsi are calling end_that_request_chunk() without queue's lock because of the reason above. I'll try to remove the duplication again by another patch-set after blk_end_request interfaces are merged. So I would like to leave the duplication for now. Is it acceptable for you? Thanks, Kiyoshi Ueda - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/28] blk_end_request: add new request completion interface (take 3)
Hi Boaz and Jens, On Tue, 04 Dec 2007 15:56:32 +0200, Boaz Harrosh [EMAIL PROTECTED] wrote: +/** + * blk_end_request - Helper function for drivers to complete the request. + * @rq: the request being processed + * @uptodate: 1 for success, 0 for I/O error, 0 for specific error + * @nr_bytes: number of bytes to complete + * + * Description: + * Ends I/O on a number of bytes attached to @rq. + * If @rq has leftover, sets it up for the next range of segments. + * + * Return: + * 0 - we are done with this request + * 1 - still buffers pending for this request + **/ +int blk_end_request(struct request *rq, int uptodate, int nr_bytes) I always hated that uptodate boolean with possible negative error value. I guess it was done for backward compatibility of then users of end_that_request_first(). But since you are introducing a new API then this is not the case. Just have regular status int where 0 means ALL_OK and negative value means error code. Just my $0.02. Thank you for the comment. I think it's quite reasonable. By doing that, we don't need end_io_error() anymore. Jens, What do you think? If you agree with the interface change above, I would prefer to separate the patch-set from blk_end_request patch-set like below: o blk_end_request: remove end_that_request_* o change interface of 'uptodate' in blk_end_request to 'error' It makes the purpose of blk_end_request patch-set clear (and also, each patch of device drivers could be smaller). But, it doubles your merging work. So if you would like to get the changes at once, I'll merge them into blk_end_request patch-set. As for the patch inclusion, do you push the driver changes to Linus all at once? Or should I ask each maintainer to take the patch? Thanks, Kiyoshi Ueda - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libsas: Don't issue commands to devices that have been hot-removed.
Hrm... does this patch help? You'll get a bunch of ATA/SAS disk errors printed to the screen if you yank the disk, but at least libsas won't get stuck waiting for the cache-flush commands to time out. --- sd will get hung up issuing commands to flush write cache if a SAS device is unplugged without warning. Change libsas to reject commands to domain devices that have already gone away. Signed-off-by: Darrick J. Wong [EMAIL PROTECTED] --- drivers/scsi/libsas/sas_ata.c |4 drivers/scsi/libsas/sas_expander.c |3 +++ drivers/scsi/libsas/sas_port.c |2 ++ drivers/scsi/libsas/sas_scsi_host.c |7 +++ include/scsi/libsas.h |1 + 5 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 0829b55..f5e5213 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -161,6 +161,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) unsigned int num = 0; unsigned int xfer = 0; + /* If the device fell off, no sense in issuing commands */ + if (dev-gone) + return AC_ERR_SYSTEM; + task = sas_alloc_task(GFP_ATOMIC); if (!task) return AC_ERR_SYSTEM; diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 27674fe..4ba4d2a 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -1680,6 +1680,7 @@ static void sas_unregister_ex_tree(struct domain_device *dev) struct domain_device *child, *n; list_for_each_entry_safe(child, n, ex-children, siblings) { + child-gone = 1; if (child-dev_type == EDGE_DEV || child-dev_type == FANOUT_DEV) sas_unregister_ex_tree(child); @@ -1699,6 +1700,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent, list_for_each_entry_safe(child, n, ex_dev-children, siblings) { if (SAS_ADDR(child-sas_addr) == SAS_ADDR(phy-attached_sas_addr)) { + child-gone = 1; if (child-dev_type == EDGE_DEV || child-dev_type == FANOUT_DEV) sas_unregister_ex_tree(child); @@ -1707,6 +1709,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent, break; } } + parent-gone = 1; sas_disable_routing(parent, phy-attached_sas_addr); memset(phy-attached_sas_addr, 0, SAS_ADDR_SIZE); sas_port_delete_phy(phy-port, phy-phy); diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index b6f0243..2e82097 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c @@ -144,6 +144,8 @@ void sas_deform_port(struct asd_sas_phy *phy) port-port_dev-pathways--; if (port-num_phys == 1) { + if (port-port_dev) + port-port_dev-gone = 1; sas_unregister_domain_devices(port); sas_port_delete(port-port); port-port = NULL; diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index c29ba47..61d2679 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -228,6 +228,13 @@ int sas_queuecommand(struct scsi_cmnd *cmd, goto out; } + /* If the device fell off, no sense in issuing commands */ + if (dev-gone) { + cmd-result = DID_BAD_TARGET 16; + scsi_done(cmd); + goto out; + } + res = -ENOMEM; task = sas_create_task(cmd, dev, GFP_ATOMIC); if (!task) diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 8ad7465..73c5b15 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -207,6 +207,7 @@ struct domain_device { }; void *lldd_dev; + int gone; }; struct sas_discovery_event { - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: MPTSAS Driver and scatter gather lists
Moore, Eric wrote: On Tuesday, December 04, 2007 8:45 AM, Steven Pratt wrote: Also, is there any reason we can't increase sg_tablesize for mptsas? The default 128, set in Kconfig (look at FUSION_MAX_SGE).It only set to 40 when that is not defined. What is in your kernel .config, e.g look for CONFIG_FUSION_MAX_SGE. RHEL5 x86_64 has this: grep CONFIG_FUSION_MAX_SGE /boot/config-2.6.18-8.el5 CONFIG_FUSION_MAX_SGE=40 Steve Eric - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libsas: Don't issue commands to devices that have been hot-removed.
Darrick J. Wong wrote: Hrm... does this patch help? You'll get a bunch of ATA/SAS disk errors printed to the screen if you yank the disk, but at least libsas won't get stuck waiting for the cache-flush commands to time out. --- sd will get hung up issuing commands to flush write cache if a SAS device is unplugged without warning. Change libsas to reject commands to domain devices that have already gone away. Signed-off-by: Darrick J. Wong [EMAIL PROTECTED] --- drivers/scsi/libsas/sas_ata.c |4 drivers/scsi/libsas/sas_expander.c |3 +++ drivers/scsi/libsas/sas_port.c |2 ++ drivers/scsi/libsas/sas_scsi_host.c |7 +++ include/scsi/libsas.h |1 + 5 files changed, 17 insertions(+), 0 deletions(-) Seems sane... diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 0829b55..f5e5213 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -161,6 +161,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) unsigned int num = 0; unsigned int xfer = 0; + /* If the device fell off, no sense in issuing commands */ + if (dev-gone) + return AC_ERR_SYSTEM; + task = sas_alloc_task(GFP_ATOMIC); if (!task) return AC_ERR_SYSTEM; As an aside, issues like this really really imply a need to move libsas away from the old libata EH stuff (like brking did with ipr, in patches). Jeff - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libsas: Don't issue commands to devices that have been hot-removed.
On Tue, Dec 04, 2007 at 05:48:33PM -0500, Jeff Garzik wrote: As an aside, issues like this really really imply a need to move libsas away from the old libata EH stuff (like brking did with ipr, in patches). Hm... does the new libata EH handle the case of device was unplugged, don't bother trying to send any more commands? In general, I agree that sas-ata should adopt the new EH. Unfortunately, I believe the old way of sas-ata configuring ATA ports is somehow not compatible with the new EH stuff and causes a crash during the device probe with my patch to move sas-ata to the new EH. If I apply the patch that migrates sas-ata to use brking's latest ata-sas configuration mechanism (the one that creates real ata_hosts), I see (a) lots and lots of ATA hosts getting created (one per ATA port; possibly undesirable if you've a SAS topology with a lot of SATA disks) and (b) NCQ disks don't seem to work if you unplug the disk and plug it back in (unless NCQ is disabled entirely). Jeff, by any chance have you tried plugging SATA devices into your SAS controllers? James Bottomley wondered if it would be easier to have sas-ata call only into the parts of libata that convert SCSI commands to ATA taskfiles, though I'm unsure how many wormy cans that would open. --D - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libsas: Don't issue commands to devices that have been hot-removed.
Darrick J. Wong wrote: On Tue, Dec 04, 2007 at 05:48:33PM -0500, Jeff Garzik wrote: As an aside, issues like this really really imply a need to move libsas away from the old libata EH stuff (like brking did with ipr, in patches). Hm... does the new libata EH handle the case of device was unplugged, don't bother trying to send any more commands? In general, I agree that sas-ata should adopt the new EH. Unfortunately, I believe the old way of sas-ata configuring ATA ports is somehow not compatible with the new EH stuff and causes a crash during the device probe with my patch to move sas-ata to the new EH. If I apply the patch that migrates sas-ata to use brking's latest ata-sas configuration mechanism (the one that creates real ata_hosts), I see (a) lots and lots of ATA hosts getting created (one per ATA port; possibly undesirable if you've a SAS topology with a lot of SATA disks) and (b) NCQ disks don't seem to work if you unplug the disk and plug it back in (unless NCQ is disabled entirely). Jeff, by any chance have you tried plugging SATA devices into your SAS controllers? aic94xx yes, bcm and mv no. Will take a look though... James Bottomley wondered if it would be easier to have sas-ata call only into the parts of libata that convert SCSI commands to ATA taskfiles, though I'm unsure how many wormy cans that would open. You want more than that. You want to make sure libata is the place for knowledge about weird ATA devices, SATA quirks, ATA device error handling (to be distinguished from ATA /link/ error handling), and other areas. That stuff shouldn't be duplicated, and you /really/ do not want to re-learn all those lessons all over again ;-) Jeff - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
iscsi update for 2.6.25
This patchset was made over scsi-rc-fixes (it also applies to Linus's git tree). It will not apply over scsi-misc, because there are some patches which went into scsi-rc-fixes/2.6.24-rc4 and scsi-misc has not been updated for the scsi-rc-fixes patches. Sorry for the bigger than normal update. There are patches from Olaf and Boaz which do the following: - Rewrite iscsi_tcp data path (from Olaf), so we do not have two ulgy abstractions for the send and recv path. Now we have one nice iscsi_segment struct that works for both paths. - Add basic iscsi spec handling we will need for Bidi support (from Boaz). This does not add bidi support. It just adds code that is common. - Device reset support. Some clustering software needed at least device reset support, so I cleaned up that code and added device logical unit reset support. I will add warm target reset support later. - Lots of fixes for things like shutdown, r2t leaks, and lots of clean up from Olaf. - sg chaining support. - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/23] libiscsi, iscsi_tcp: add device support
From: Mike Christie [EMAIL PROTECTED] This patch adds logical unit reset support. This should work for ib_iser, but I have not finished testing that driver so it is not hooked in yet. This patch also temporarily reverts the iscsi_tcp r2t write out patch. That code is completely rewritten in this patchset. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/infiniband/ulp/iser/iscsi_iser.c |6 - drivers/scsi/iscsi_tcp.c | 151 +- drivers/scsi/iscsi_tcp.h | 34 +- drivers/scsi/libiscsi.c | 494 +- drivers/scsi/scsi_transport_iscsi.c |4 +- include/scsi/iscsi_if.h |2 + include/scsi/iscsi_proto.h |2 + include/scsi/libiscsi.h | 25 +- 8 files changed, 396 insertions(+), 322 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index bad8dac..2eadb6d 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -220,12 +220,6 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn, debug_scsi(ctask deq [cid %d itt 0x%x]\n, conn-id, ctask-itt); - /* -* serialize with TMF AbortTask -*/ - if (ctask-mtask) - return error; - /* Send the cmd PDU */ if (!iser_ctask-command_sent) { error = iser_send_command(conn, ctask); diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 57ce225..4b226b8 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -197,7 +197,7 @@ iscsi_tcp_cleanup_ctask(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) if (unlikely(!sc)) return; - tcp_ctask-xmstate = XMSTATE_VALUE_IDLE; + tcp_ctask-xmstate = XMSTATE_IDLE; tcp_ctask-r2t = NULL; } @@ -369,8 +369,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) spin_lock(session-lock); iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); - if (!ctask-sc || ctask-mtask || -session-state != ISCSI_STATE_LOGGED_IN) { + if (!ctask-sc || session-state != ISCSI_STATE_LOGGED_IN) { printk(KERN_INFO iscsi_tcp: dropping R2T itt %d in recovery...\n, ctask-itt); spin_unlock(session-lock); @@ -409,11 +408,10 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) tcp_ctask-exp_datasn = r2tsn + 1; __kfifo_put(tcp_ctask-r2tqueue, (void*)r2t, sizeof(void*)); - set_bit(XMSTATE_BIT_SOL_HDR_INIT, tcp_ctask-xmstate); - list_move_tail(ctask-running, conn-xmitqueue); - - scsi_queue_work(session-host, conn-xmitwork); + tcp_ctask-xmstate |= XMSTATE_SOL_HDR_INIT; conn-r2t_pdus_cnt++; + + iscsi_requeue_ctask(ctask); spin_unlock(session-lock); return 0; @@ -1254,7 +1252,7 @@ static void iscsi_set_padding(struct iscsi_tcp_cmd_task *tcp_ctask, tcp_ctask-pad_count = ISCSI_PAD_LEN - tcp_ctask-pad_count; debug_scsi(write padding %d bytes\n, tcp_ctask-pad_count); - set_bit(XMSTATE_BIT_W_PAD, tcp_ctask-xmstate); + tcp_ctask-xmstate |= XMSTATE_W_PAD; } /** @@ -1269,7 +1267,7 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask) struct iscsi_tcp_cmd_task *tcp_ctask = ctask-dd_data; BUG_ON(__kfifo_len(tcp_ctask-r2tqueue)); - tcp_ctask-xmstate = 1 XMSTATE_BIT_CMD_HDR_INIT; + tcp_ctask-xmstate = XMSTATE_CMD_HDR_INIT; } /** @@ -1283,10 +1281,10 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask) * xmit. * * Management xmit state machine consists of these states: - * XMSTATE_BIT_IMM_HDR_INIT - calculate digest of PDU Header - * XMSTATE_BIT_IMM_HDR - PDU Header xmit in progress - * XMSTATE_BIT_IMM_DATA - PDU Data xmit in progress - * XMSTATE_VALUE_IDLE - management PDU is done + * XMSTATE_IMM_HDR_INIT- calculate digest of PDU Header + * XMSTATE_IMM_HDR - PDU Header xmit in progress + * XMSTATE_IMM_DATA- PDU Data xmit in progress + * XMSTATE_IDLE- management PDU is done **/ static int iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) @@ -1297,12 +1295,12 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) debug_scsi(mtask deq [cid %d state %x itt 0x%x]\n, conn-id, tcp_mtask-xmstate, mtask-itt); - if (test_bit(XMSTATE_BIT_IMM_HDR_INIT, tcp_mtask-xmstate)) { + if (tcp_mtask-xmstate XMSTATE_IMM_HDR_INIT) { iscsi_buf_init_iov(tcp_mtask-headbuf, (char*)mtask-hdr, sizeof(struct iscsi_hdr)); if (mtask-data_count) { -
[PATCH 07/23] libiscsi: do not block session during logout
From: Mike Christie [EMAIL PROTECTED] There is not need to block the session during logout. Since we are going to fail the commands that were blocked just fail them immediately instead. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/infiniband/ulp/iser/iser_initiator.c | 11 +-- drivers/scsi/iscsi_tcp.c |4 +- drivers/scsi/libiscsi.c | 153 ++ include/scsi/libiscsi.h |2 + include/scsi/scsi_transport_iscsi.h |1 + 5 files changed, 89 insertions(+), 82 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index a6f2303..46fc9b7 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -617,15 +617,8 @@ void iser_snd_completion(struct iser_desc *tx_desc) /* this arithmetic is legal by libiscsi dd_data allocation */ mtask = (void *) ((long)(void *)tx_desc - sizeof(struct iscsi_mgmt_task)); - if (mtask-hdr-itt == RESERVED_ITT) { - struct iscsi_session *session = conn-session; - - spin_lock(conn-session-lock); - list_del(mtask-running); - __kfifo_put(session-mgmtpool.queue, (void*)mtask, - sizeof(void*)); - spin_unlock(session-lock); - } + if (mtask-hdr-itt == RESERVED_ITT) + iscsi_free_mgmt_task(conn, mtask); } } diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index f79a457..90eae8e 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1349,9 +1349,7 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) struct iscsi_session *session = conn-session; spin_lock_bh(session-lock); - list_del(conn-mtask-running); - __kfifo_put(session-mgmtpool.queue, (void*)conn-mtask, - sizeof(void*)); + iscsi_free_mgmt_task(conn, mtask); spin_unlock_bh(session-lock); } return 0; diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index d43f909..b7a2b9a 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -37,9 +37,6 @@ #include scsi/scsi_transport_iscsi.h #include scsi/libiscsi.h -static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, -int err); - struct iscsi_session * class_to_transport_session(struct iscsi_cls_session *cls_session) { @@ -274,6 +271,53 @@ static void __iscsi_put_ctask(struct iscsi_cmd_task *ctask) iscsi_complete_command(ctask); } +/* + * session lock must be held + */ +static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask, +int err) +{ + struct scsi_cmnd *sc; + + sc = ctask-sc; + if (!sc) + return; + + if (ctask-state == ISCSI_TASK_PENDING) + /* +* cmd never made it to the xmit thread, so we should not count +* the cmd in the sequencing +*/ + conn-session-queued_cmdsn--; + else + conn-session-tt-cleanup_cmd_task(conn, ctask); + + sc-result = err; + scsi_set_resid(sc, scsi_bufflen(sc)); + if (conn-ctask == ctask) + conn-ctask = NULL; + /* release ref from queuecommand */ + __iscsi_put_ctask(ctask); +} + +/** + * iscsi_free_mgmt_task - return mgmt task back to pool + * @conn: iscsi connection + * @mtask: mtask + * + * Must be called with session lock. + */ +void iscsi_free_mgmt_task(struct iscsi_conn *conn, + struct iscsi_mgmt_task *mtask) +{ + list_del_init(mtask-running); + if (conn-login_mtask == mtask) + return; + __kfifo_put(conn-session-mgmtpool.queue, + (void*)mtask, sizeof(void*)); +} +EXPORT_SYMBOL_GPL(iscsi_free_mgmt_task); + /** * iscsi_cmd_rsp - SCSI Command Response processing * @conn: iscsi connection @@ -464,10 +508,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, */ if (iscsi_recv_pdu(conn-cls_conn, hdr, data, datalen)) rc = ISCSI_ERR_CONN_FAILED; - list_del_init(mtask-running); - if (conn-login_mtask != mtask) - __kfifo_put(session-mgmtpool.queue, - (void*)mtask, sizeof(void*)); + iscsi_free_mgmt_task(conn, mtask); break; case ISCSI_OP_SCSI_TMFUNC_RSP: if (datalen) { @@
[PATCH 08/23] iscsi class: Use our own workq instead of common system one.
From: Mike Christie [EMAIL PROTECTED] There is just too much going on through the common workq and something like a scsi device removal through sysfs affects how long it will take to recover the transport, mark it as failed, or shut it down gracefully. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/scsi_transport_iscsi.c | 16 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index b6f346c..afdc2ae 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -50,6 +50,7 @@ struct iscsi_internal { }; static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ +static struct workqueue_struct *iscsi_eh_timer_workq; /* * list of registered transports and lock that must @@ -252,7 +253,7 @@ static void session_recovery_timedout(struct work_struct *work) void iscsi_unblock_session(struct iscsi_cls_session *session) { if (!cancel_delayed_work(session-recovery_work)) - flush_scheduled_work(); + flush_workqueue(iscsi_eh_timer_workq); scsi_target_unblock(session-dev); } EXPORT_SYMBOL_GPL(iscsi_unblock_session); @@ -260,8 +261,8 @@ EXPORT_SYMBOL_GPL(iscsi_unblock_session); void iscsi_block_session(struct iscsi_cls_session *session) { scsi_target_block(session-dev); - schedule_delayed_work(session-recovery_work, -session-recovery_tmo * HZ); + queue_delayed_work(iscsi_eh_timer_workq, session-recovery_work, + session-recovery_tmo * HZ); } EXPORT_SYMBOL_GPL(iscsi_block_session); @@ -356,7 +357,7 @@ void iscsi_remove_session(struct iscsi_cls_session *session) struct iscsi_host *ihost = shost-shost_data; if (!cancel_delayed_work(session-recovery_work)) - flush_scheduled_work(); + flush_workqueue(iscsi_eh_timer_workq); mutex_lock(ihost-mutex); list_del(session-host_list); @@ -1520,8 +1521,14 @@ static __init int iscsi_transport_init(void) goto unregister_session_class; } + iscsi_eh_timer_workq = create_singlethread_workqueue(iscsi_eh); + if (!iscsi_eh_timer_workq) + goto release_nls; + return 0; +release_nls: + sock_release(nls-sk_socket); unregister_session_class: transport_class_unregister(iscsi_session_class); unregister_conn_class: @@ -1535,6 +1542,7 @@ unregister_transport_class: static void __exit iscsi_transport_exit(void) { + destroy_workqueue(iscsi_eh_timer_workq); sock_release(nls-sk_socket); transport_class_unregister(iscsi_connection_class); transport_class_unregister(iscsi_session_class); -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/23] libiscsi: grab eh_mutex during host reset
From: Mike Christie [EMAIL PROTECTED] I thought we may not need the eh mutex during host reset, but that is wrong with the new shutdown code. When start_session_recovery sets the state to terminate then drops the session lock. The scsi eh thread could then grab the session lock see that we are terminating and then return failed to scsi-ml. scsi-ml's eh then owns the command and will do whatever it wants with it. But then the iscsi eh thread could grab the session lock and want to complete the scsi commands that we in the LLD, but it no longer owns them and kaboom. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/libiscsi.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index b7a2b9a..441e351 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1079,17 +1079,19 @@ int iscsi_eh_host_reset(struct scsi_cmnd *sc) struct iscsi_session *session = iscsi_hostdata(host-hostdata); struct iscsi_conn *conn = session-leadconn; + mutex_lock(session-eh_mutex); spin_lock_bh(session-lock); if (session-state == ISCSI_STATE_TERMINATE) { failed: debug_scsi(failing host reset: session terminated [CID %d age %d]\n, conn-id, session-age); spin_unlock_bh(session-lock); + mutex_unlock(session-eh_mutex); return FAILED; } spin_unlock_bh(session-lock); - + mutex_unlock(session-eh_mutex); /* * we drop the lock here but the leadconn cannot be destoyed while * we are in the scsi eh @@ -1104,13 +1106,14 @@ failed: if (signal_pending(current)) flush_signals(current); + mutex_lock(session-eh_mutex); spin_lock_bh(session-lock); if (session-state == ISCSI_STATE_LOGGED_IN) printk(KERN_INFO iscsi: host reset succeeded\n); else goto failed; spin_unlock_bh(session-lock); - + mutex_unlock(session-eh_mutex); return SUCCESS; } EXPORT_SYMBOL_GPL(iscsi_eh_host_reset); -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/23] libiscsi: fix shutdown
From: Mike Christie [EMAIL PROTECTED] We were using the device delete sysfs file to remove each device then logout. Now in 2.6.21 and .22 this will not work because the sysfs delete file returns immediately and does not wait for the device removal to complete. This causes a hang if a cache sync is needed during shutdown. Before .21, that approach had other problems, so this patch fixes the shutdown code so that we remove the target and unbind the session before logging out and shut down the session. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/libiscsi.c |4 +- drivers/scsi/qla4xxx/ql4_init.c |4 +- drivers/scsi/qla4xxx/ql4_os.c |7 +- drivers/scsi/scsi_transport_iscsi.c | 287 +++ include/scsi/iscsi_if.h |7 + include/scsi/iscsi_proto.h |2 + include/scsi/scsi_transport_iscsi.h |7 +- 7 files changed, 175 insertions(+), 143 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 441e351..5205ef2 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1662,7 +1662,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) struct iscsi_session *session = iscsi_hostdata(shost-hostdata); struct module *owner = cls_session-transport-owner; - iscsi_unblock_session(cls_session); + iscsi_remove_session(cls_session); scsi_remove_host(shost); iscsi_pool_free(session-mgmtpool); @@ -1677,7 +1677,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) kfree(session-hwaddress); kfree(session-initiatorname); - iscsi_destroy_session(cls_session); + iscsi_free_session(cls_session); scsi_host_put(shost); module_put(owner); } diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index d692c71..cbe0a17 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c @@ -5,6 +5,7 @@ * See LICENSE.qla4xxx for copyright and licensing details. */ +#include scsi/iscsi_if.h #include ql4_def.h #include ql4_glbl.h #include ql4_dbg.h @@ -1305,7 +1306,8 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, atomic_set(ddb_entry-relogin_timer, 0); clear_bit(DF_RELOGIN, ddb_entry-flags); clear_bit(DF_NO_RELOGIN, ddb_entry-flags); - iscsi_if_create_session_done(ddb_entry-conn); + iscsi_session_event(ddb_entry-sess, + ISCSI_KEVENT_CREATE_SESSION); /* * Change the lun state to READY in case the lun TIMEOUT before * the device came back. diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 89460d2..f55b9f7 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -298,8 +298,7 @@ void qla4xxx_destroy_sess(struct ddb_entry *ddb_entry) return; if (ddb_entry-conn) { - iscsi_if_destroy_session_done(ddb_entry-conn); - iscsi_destroy_conn(ddb_entry-conn); + atomic_set(ddb_entry-state, DDB_STATE_DEAD); iscsi_remove_session(ddb_entry-sess); } iscsi_free_session(ddb_entry-sess); @@ -309,6 +308,7 @@ int qla4xxx_add_sess(struct ddb_entry *ddb_entry) { int err; + ddb_entry-sess-recovery_tmo = ddb_entry-ha-port_down_retry_count; err = iscsi_add_session(ddb_entry-sess, ddb_entry-fw_ddb_index); if (err) { DEBUG2(printk(KERN_ERR Could not add session.\n)); @@ -321,9 +321,6 @@ int qla4xxx_add_sess(struct ddb_entry *ddb_entry) DEBUG2(printk(KERN_ERR Could not add connection.\n)); return -ENOMEM; } - - ddb_entry-sess-recovery_tmo = ddb_entry-ha-port_down_retry_count; - iscsi_if_create_session_done(ddb_entry-conn); return 0; } diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index afdc2ae..0515b7d 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -116,6 +116,8 @@ static struct attribute_group iscsi_transport_group = { .attrs = iscsi_transport_attrs, }; + + static int iscsi_setup_host(struct transport_container *tc, struct device *dev, struct class_device *cdev) { @@ -125,13 +127,30 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, memset(ihost, 0, sizeof(*ihost)); INIT_LIST_HEAD(ihost-sessions); mutex_init(ihost-mutex); + + snprintf(ihost-unbind_workq_name, KOBJ_NAME_LEN, iscsi_unbind_%d, + shost-host_no); + ihost-unbind_workq = create_singlethread_workqueue( + ihost-unbind_workq_name); + if (!ihost-unbind_workq) + return -ENOMEM; +
[PATCH 11/23] libiscsi: fix nop handling
From: Mike Christie [EMAIL PROTECTED] During root boot and shutdown the target could send us nops. At this time iscsid cannot be running, so the target will drop the session and the boot or shutdown will hang. To handle this and allow us to better control when to check the network this patch moves the nop handling to the kernel. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/infiniband/ulp/iser/iscsi_iser.c |4 +- drivers/scsi/iscsi_tcp.c |4 +- drivers/scsi/libiscsi.c | 331 -- drivers/scsi/scsi_transport_iscsi.c |4 + include/scsi/iscsi_if.h | 11 + include/scsi/libiscsi.h |8 + 6 files changed, 294 insertions(+), 68 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index a2622f4..2656064 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -577,7 +577,9 @@ static struct iscsi_transport iscsi_iser_transport = { ISCSI_PERSISTENT_ADDRESS | ISCSI_TARGET_NAME | ISCSI_TPGT | ISCSI_USERNAME | ISCSI_PASSWORD | - ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN, + ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | + ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | + ISCSI_PING_TMO | ISCSI_RECV_TMO, .host_param_mask= ISCSI_HOST_HWADDRESS | ISCSI_HOST_NETDEV_NAME | ISCSI_HOST_INITIATOR_NAME, diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 90eae8e..9b41852 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -2246,7 +2246,9 @@ static struct iscsi_transport iscsi_tcp_transport = { ISCSI_TARGET_NAME | ISCSI_TPGT | ISCSI_USERNAME | ISCSI_PASSWORD | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | - ISCSI_FAST_ABORT, + ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | + ISCSI_LU_RESET_TMO | + ISCSI_PING_TMO | ISCSI_RECV_TMO, .host_param_mask= ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | ISCSI_HOST_INITIATOR_NAME | ISCSI_HOST_NETDEV_NAME, diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5205ef2..9688361 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -313,11 +313,70 @@ void iscsi_free_mgmt_task(struct iscsi_conn *conn, list_del_init(mtask-running); if (conn-login_mtask == mtask) return; + + if (conn-ping_mtask == mtask) + conn-ping_mtask = NULL; __kfifo_put(conn-session-mgmtpool.queue, (void*)mtask, sizeof(void*)); } EXPORT_SYMBOL_GPL(iscsi_free_mgmt_task); +static struct iscsi_mgmt_task * +__iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + char *data, uint32_t data_size) +{ + struct iscsi_session *session = conn-session; + struct iscsi_mgmt_task *mtask; + + if (session-state == ISCSI_STATE_TERMINATE) + return NULL; + + if (hdr-opcode == (ISCSI_OP_LOGIN | ISCSI_OP_IMMEDIATE) || + hdr-opcode == (ISCSI_OP_TEXT | ISCSI_OP_IMMEDIATE)) + /* +* Login and Text are sent serially, in +* request-followed-by-response sequence. +* Same mtask can be used. Same ITT must be used. +* Note that login_mtask is preallocated at conn_create(). +*/ + mtask = conn-login_mtask; + else { + BUG_ON(conn-c_stage == ISCSI_CONN_INITIAL_STAGE); + BUG_ON(conn-c_stage == ISCSI_CONN_STOPPED); + + if (!__kfifo_get(session-mgmtpool.queue, +(void*)mtask, sizeof(void*))) + return NULL; + } + + if (data_size) { + memcpy(mtask-data, data, data_size); + mtask-data_count = data_size; + } else + mtask-data_count = 0; + + memcpy(mtask-hdr, hdr, sizeof(struct iscsi_hdr)); + INIT_LIST_HEAD(mtask-running); + list_add_tail(mtask-running, conn-mgmtqueue); + return mtask; +} + +int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, + char *data, uint32_t data_size) +{ + struct iscsi_conn *conn = cls_conn-dd_data; + struct iscsi_session *session = conn-session; + int err = 0; + + spin_lock_bh(session-lock); + if (!__iscsi_conn_send_pdu(conn, hdr,
[PATCH 13/23] Do not fail commands immediately during logout
From: Mike Christie [EMAIL PROTECTED] If the target requests a logout, then we do not want to fail commands to scsi-ml right away. This patch just fails in pending commands for a requeue immediately, and then lets iscsid handle running commands like normal recovery. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/libiscsi.c | 14 ++ 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 9688361..b17081b 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -917,7 +917,7 @@ check_mgmt: conn-ctask = list_entry(conn-xmitqueue.next, struct iscsi_cmd_task, running); if (conn-session-state == ISCSI_STATE_LOGGING_OUT) { - fail_command(conn, conn-ctask, DID_NO_CONNECT 16); + fail_command(conn, conn-ctask, DID_IMM_RETRY 16); continue; } if (iscsi_prep_scsi_cmd_pdu(conn-ctask)) { @@ -1024,21 +1024,19 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) * be entering our queuecommand while a block is starting * up because the block code is not locked) */ - if (session-state == ISCSI_STATE_IN_RECOVERY) { + switch (session-state) { + case ISCSI_STATE_IN_RECOVERY: reason = FAILURE_SESSION_IN_RECOVERY; goto reject; - } - - switch (session-state) { + case ISCSI_STATE_LOGGING_OUT: + reason = FAILURE_SESSION_LOGGING_OUT; + goto reject; case ISCSI_STATE_RECOVERY_FAILED: reason = FAILURE_SESSION_RECOVERY_TIMEOUT; break; case ISCSI_STATE_TERMINATE: reason = FAILURE_SESSION_TERMINATE; break; - case ISCSI_STATE_LOGGING_OUT: - reason = FAILURE_SESSION_LOGGING_OUT; - break; default: reason = FAILURE_SESSION_FREED; } -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/23] clear conn-ctask when task is completed early
From: Mike Christie [EMAIL PROTECTED] If the current ctask is failed early, we legt the conn-ctask pointer pointing to a invalid task. When the xmit thread would send data for it, we would then oops. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/libiscsi.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index b17081b..4461317 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -248,13 +248,16 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask) */ static void iscsi_complete_command(struct iscsi_cmd_task *ctask) { - struct iscsi_session *session = ctask-conn-session; + struct iscsi_conn *conn = ctask-conn; + struct iscsi_session *session = conn-session; struct scsi_cmnd *sc = ctask-sc; ctask-state = ISCSI_TASK_COMPLETED; ctask-sc = NULL; /* SCSI eh reuses commands to verify us */ sc-SCp.ptr = NULL; + if (conn-ctask == ctask) + conn-ctask = NULL; list_del_init(ctask-running); __kfifo_put(session-cmdpool.queue, (void*)ctask, sizeof(void*)); sc-scsi_done(sc); -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 15/23] Drop host lock in queuecommand
From: Mike Christie [EMAIL PROTECTED] The driver does not need the host lock in queuecommand so drop it. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/libiscsi.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 4461317..b0bc8c3 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1010,8 +1010,9 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) sc-SCp.ptr = NULL; host = sc-device-host; - session = iscsi_hostdata(host-hostdata); + spin_unlock(host-host_lock); + session = iscsi_hostdata(host-hostdata); spin_lock(session-lock); /* @@ -1077,11 +1078,13 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) spin_unlock(session-lock); scsi_queue_work(host, conn-xmitwork); + spin_lock(host-host_lock); return 0; reject: spin_unlock(session-lock); debug_scsi(cmd 0x%x rejected (%d)\n, sc-cmnd[0], reason); + spin_lock(host-host_lock); return SCSI_MLQUEUE_HOST_BUSY; fault: @@ -1091,6 +1094,7 @@ fault: sc-result = (DID_NO_CONNECT 16); scsi_set_resid(sc, scsi_bufflen(sc)); sc-scsi_done(sc); + spin_lock(host-host_lock); return 0; } EXPORT_SYMBOL_GPL(iscsi_queuecommand); -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/23] libiscsi, iscsi_tcp: iscsi pool cleanup
From: Mike Christie [EMAIL PROTECTED] from [EMAIL PROTECTED] iscsi_pool_init simplified iscsi_pool_init currently has a lot of duplicate kfree() calls it does when some allocation fails. This patch simplifies the code a little by using iscsi_pool_free to tear down the pool in case of an error. iscsi_pool_init also returns a copy of the item array to the caller. Not all callers use this array, so we make it optional. Instead of allocating a second array and return that, allocate just one array, of twice the size. Update users of iscsi_pool_{init,free} This patch drops the (now useless) second argument to iscsi_pool_free, and updates all callers. It also removes the ctask-r2ts array, which was never used anyway. Since the items argument to iscsi_pool_init is now optional, we can pass NULL instead. Signed-off-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c | 12 ++- drivers/scsi/iscsi_tcp.h |3 +- drivers/scsi/libiscsi.c | 75 - include/scsi/libiscsi.h | 10 +++--- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 491845f..f79a457 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1998,8 +1998,7 @@ iscsi_r2tpool_alloc(struct iscsi_session *session) */ /* R2T pool */ - if (iscsi_pool_init(tcp_ctask-r2tpool, session-max_r2t * 4, - (void***)tcp_ctask-r2ts, + if (iscsi_pool_init(tcp_ctask-r2tpool, session-max_r2t * 4, NULL, sizeof(struct iscsi_r2t_info))) { goto r2t_alloc_fail; } @@ -2008,8 +2007,7 @@ iscsi_r2tpool_alloc(struct iscsi_session *session) tcp_ctask-r2tqueue = kfifo_alloc( session-max_r2t * 4 * sizeof(void*), GFP_KERNEL, NULL); if (tcp_ctask-r2tqueue == ERR_PTR(-ENOMEM)) { - iscsi_pool_free(tcp_ctask-r2tpool, - (void**)tcp_ctask-r2ts); + iscsi_pool_free(tcp_ctask-r2tpool); goto r2t_alloc_fail; } } @@ -2022,8 +2020,7 @@ r2t_alloc_fail: struct iscsi_tcp_cmd_task *tcp_ctask = ctask-dd_data; kfifo_free(tcp_ctask-r2tqueue); - iscsi_pool_free(tcp_ctask-r2tpool, - (void**)tcp_ctask-r2ts); + iscsi_pool_free(tcp_ctask-r2tpool); } return -ENOMEM; } @@ -2038,8 +2035,7 @@ iscsi_r2tpool_free(struct iscsi_session *session) struct iscsi_tcp_cmd_task *tcp_ctask = ctask-dd_data; kfifo_free(tcp_ctask-r2tqueue); - iscsi_pool_free(tcp_ctask-r2tpool, - (void**)tcp_ctask-r2ts); + iscsi_pool_free(tcp_ctask-r2tpool); } } diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index eb3784f..d49d876 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -175,9 +175,8 @@ struct iscsi_tcp_cmd_task { uint32_texp_datasn; /* expected target's R2TSN/DataSN */ int data_offset; struct iscsi_r2t_info *r2t; /* in progress R2T*/ - struct iscsi_queue r2tpool; + struct iscsi_pool r2tpool; struct kfifo*r2tqueue; - struct iscsi_r2t_info **r2ts; int digest_count; uint32_timmdigest; /* for imm data */ struct iscsi_bufimmbuf; /* for imm data digest */ diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5936586..d43f909 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1413,59 +1413,64 @@ done: } EXPORT_SYMBOL_GPL(iscsi_eh_device_reset); +/* + * Pre-allocate a pool of @max items of @item_size. By default, the pool + * should be accessed via kfifo_{get,put} on q-queue. + * Optionally, the caller can obtain the array of object pointers + * by passing in a non-NULL @items pointer + */ int -iscsi_pool_init(struct iscsi_queue *q, int max, void ***items, int item_size) +iscsi_pool_init(struct iscsi_pool *q, int max, void ***items, int item_size) { - int i; + int i, num_arrays = 1; - *items = kmalloc(max * sizeof(void*), GFP_KERNEL); - if (*items == NULL) - return -ENOMEM; + memset(q, 0, sizeof(*q)); q-max = max; - q-pool = kmalloc(max * sizeof(void*), GFP_KERNEL); - if (q-pool == NULL) { - kfree(*items); - return -ENOMEM; - } + + /* If the user passed an items pointer, he wants a copy of +* the array. */ + if (items) +
[PATCH 02/23] iscsi_tcp: rewrite recv path
From: Mike Christie [EMAIL PROTECTED] From Olaf Kirch: Rewrite recv path. Fixes: - data digest processing and error handling. - ahs support. Some fixups by Mike Christie Signed-off-by: [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c | 1018 +++--- drivers/scsi/iscsi_tcp.h | 66 ++-- include/scsi/libiscsi.h |4 + 3 files changed, 552 insertions(+), 536 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 4b226b8..1b540e0 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -48,7 +48,7 @@ MODULE_AUTHOR(Dmitry Yusupov [EMAIL PROTECTED], Alex Aizman [EMAIL PROTECTED]); MODULE_DESCRIPTION(iSCSI/TCP data-path); MODULE_LICENSE(GPL); -/* #define DEBUG_TCP */ +#undef DEBUG_TCP #define DEBUG_ASSERT #ifdef DEBUG_TCP @@ -67,10 +67,15 @@ MODULE_LICENSE(GPL); static unsigned int iscsi_max_lun = 512; module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO); +static int iscsi_tcp_hdr_recv_done(struct iscsi_tcp_conn *tcp_conn, + struct iscsi_chunk *chunk); + static inline void iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size) { - sg_init_one(ibuf-sg, vbuf, size); + ibuf-sg.page = virt_to_page(vbuf); + ibuf-sg.offset = offset_in_page(vbuf); + ibuf-sg.length = size; ibuf-sent = 0; ibuf-use_sendmsg = 1; } @@ -78,12 +83,13 @@ iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size) static inline void iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg) { - sg_init_table(ibuf-sg, 1); - sg_set_page(ibuf-sg, sg_page(sg), sg-length, sg-offset); + ibuf-sg.page = sg-page; + ibuf-sg.offset = sg-offset; + ibuf-sg.length = sg-length; /* * Fastpath: sg element fits into single page */ - if (sg-length + sg-offset = PAGE_SIZE !PageSlab(sg_page(sg))) + if (sg-length + sg-offset = PAGE_SIZE !PageSlab(sg-page)) ibuf-use_sendmsg = 0; else ibuf-use_sendmsg = 1; @@ -110,72 +116,331 @@ iscsi_hdr_digest(struct iscsi_conn *conn, struct iscsi_buf *buf, buf-sg.length += sizeof(u32); } +/* + * Scatterlist handling: inside the iscsi_chunk, we + * remember an index into the scatterlist, and set data/size + * to the current scatterlist entry. For highmem pages, we + * kmap as needed. + * + * Note that the page is unmapped when we return from + * TCP's data_ready handler, so we may end up mapping and + * unmapping the same page repeatedly. The whole reason + * for this is that we shouldn't keep the page mapped + * outside the softirq. + */ + +/** + * iscsi_tcp_chunk_init_sg - init indicated scatterlist entry + * @chunk: the buffer object + * @idx: index into scatterlist + * @offset: byte offset into that sg entry + * + * This function sets up the chunk so that subsequent + * data is copied to the indicated sg entry, at the given + * offset. + */ +static inline void +iscsi_tcp_chunk_init_sg(struct iscsi_chunk *chunk, + unsigned int idx, unsigned int offset) +{ + struct scatterlist *sg; + + BUG_ON(chunk-sg == NULL); + + sg = chunk-sg[idx]; + chunk-sg_index = idx; + chunk-sg_offset = offset; + chunk-size = min(sg-length - offset, chunk-total_size); + chunk-data = NULL; +} + +/** + * iscsi_tcp_chunk_map - map the current S/G page + * @chunk: iscsi chunk + * + * We only need to possibly kmap data if scatter lists are being used, + * because the iscsi passthrough and internal IO paths will never use high + * mem pages. + */ +static inline void +iscsi_tcp_chunk_map(struct iscsi_chunk *chunk) +{ + struct scatterlist *sg; + + if (chunk-data != NULL || !chunk-sg) + return; + + sg = chunk-sg[chunk-sg_index]; + BUG_ON(chunk-sg_mapped); + BUG_ON(sg-length == 0); + chunk-sg_mapped = kmap_atomic(sg-page, KM_SOFTIRQ0); + chunk-data = chunk-sg_mapped + sg-offset + chunk-sg_offset; +} + +static inline void +iscsi_tcp_chunk_unmap(struct iscsi_chunk *chunk) +{ + if (chunk-sg_mapped) { + kunmap_atomic(chunk-sg_mapped, KM_SOFTIRQ0); + chunk-sg_mapped = NULL; + chunk-data = NULL; + } +} + +/* + * Splice the digest buffer into the buffer + */ +static inline void +iscsi_tcp_chunk_splice_digest(struct iscsi_chunk *chunk, void *digest) +{ + chunk-data = digest; + chunk-digest_len = ISCSI_DIGEST_SIZE; + chunk-total_size += ISCSI_DIGEST_SIZE; + chunk-size = ISCSI_DIGEST_SIZE; + chunk-copied = 0; + chunk-sg = NULL; + chunk-sg_index = 0; + chunk-hash = NULL; +} + +/** + * iscsi_tcp_chunk_done - check whether the chunk is complete + * @chunk: iscsi chunk to check + * + * Check if we're done receiving this chunk. If the receive + * buffer is full but we expect
[PATCH 18/23] iscsi_tcp: drop session when itt does not match any command
From: Mike Christie [EMAIL PROTECTED] A target should never send us a itt that does not match a running task. If it does we do not really know what is coming down after the header, unless we evaluate the hdr and do some guessing sometimes. However, even if we know what is coming we probably do not have buffers for it or we cannot respond (if it is a r2t for example), so just drop the session. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index ecba606..65df908 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -755,11 +755,7 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) opcode = hdr-opcode ISCSI_OPCODE_MASK; /* verify itt (itt encoding: age+cid+itt) */ rc = iscsi_verify_itt(conn, hdr, itt); - if (rc == ISCSI_ERR_NO_SCSI_CMD) { - /* XXX: what does this do? */ - tcp_conn-in.datalen = 0; /* force drop */ - return 0; - } else if (rc) + if (rc) return rc; debug_tcp(opcode 0x%x ahslen %d datalen %d\n, -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/23] libiscsi, iscsi class: set tmf to a safe default and export in sysfs
From: Mike Christie [EMAIL PROTECTED] Older tools will not be setting the tmf time outs since they did not exists, so set them to a safe default. And export abort and lu reset timeout values in sysfs. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/libiscsi.c |2 ++ drivers/scsi/scsi_transport_iscsi.c |8 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index f15df8d..6573223 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1732,6 +1732,8 @@ iscsi_session_setup(struct iscsi_transport *iscsit, session-host = shost; session-state = ISCSI_STATE_FREE; session-fast_abort = 1; + session-lu_reset_timeout = 15; + session-abort_timeout = 10; session-mgmtpool_max = ISCSI_MGMT_CMDS_MAX; session-cmds_max = cmds_max; session-queued_cmdsn = session-cmdsn = initial_cmdsn; diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index fb8a765..d3db318 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -30,7 +30,7 @@ #include scsi/scsi_transport_iscsi.h #include scsi/iscsi_if.h -#define ISCSI_SESSION_ATTRS 16 +#define ISCSI_SESSION_ATTRS 18 #define ISCSI_CONN_ATTRS 11 #define ISCSI_HOST_ATTRS 4 #define ISCSI_TRANSPORT_VERSION 2.0-724 @@ -1241,7 +1241,9 @@ iscsi_session_attr(username, ISCSI_PARAM_USERNAME, 1); iscsi_session_attr(username_in, ISCSI_PARAM_USERNAME_IN, 1); iscsi_session_attr(password, ISCSI_PARAM_PASSWORD, 1); iscsi_session_attr(password_in, ISCSI_PARAM_PASSWORD_IN, 1); -iscsi_session_attr(fast_abort, ISCSI_PARAM_FAST_ABORT, 1); +iscsi_session_attr(fast_abort, ISCSI_PARAM_FAST_ABORT, 0); +iscsi_session_attr(abort_tmo, ISCSI_PARAM_ABORT_TMO, 0); +iscsi_session_attr(lu_reset_tmo, ISCSI_PARAM_LU_RESET_TMO, 0); #define iscsi_priv_session_attr_show(field, format)\ static ssize_t \ @@ -1466,6 +1468,8 @@ iscsi_register_transport(struct iscsi_transport *tt) SETUP_SESSION_RD_ATTR(username, ISCSI_PASSWORD); SETUP_SESSION_RD_ATTR(username_in, ISCSI_PASSWORD_IN); SETUP_SESSION_RD_ATTR(fast_abort, ISCSI_FAST_ABORT); + SETUP_SESSION_RD_ATTR(abort_tmo, ISCSI_ABORT_TMO); + SETUP_SESSION_RD_ATTR(lu_reset_tmo,ISCSI_LU_RESET_TMO); SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo); BUG_ON(count ISCSI_SESSION_ATTRS); -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 20/23] iscsi_tcp: enable sg chaining
From: Mike Christie [EMAIL PROTECTED] The previous patches converted iscsi_tcp to support sg chaining. This patch sets the proper flags and sets sg_table size to 4096. This allows fs io to be capped at max_sectors, but passthrough IO to be limited by some other part of the kernel. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c |5 +++-- drivers/scsi/iscsi_tcp.h |3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 65df908..84c4a50 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1928,13 +1928,14 @@ static struct scsi_host_template iscsi_sht = { .queuecommand = iscsi_queuecommand, .change_queue_depth = iscsi_change_queue_depth, .can_queue = ISCSI_DEF_XMIT_CMDS_MAX - 1, - .sg_tablesize = ISCSI_SG_TABLESIZE, + .sg_tablesize = 4096, .max_sectors= 0x, .cmd_per_lun= ISCSI_DEF_CMD_PER_LUN, .eh_abort_handler = iscsi_eh_abort, .eh_device_reset_handler= iscsi_eh_device_reset, .eh_host_reset_handler = iscsi_eh_host_reset, .use_clustering = DISABLE_CLUSTERING, + .use_sg_chaining= ENABLE_SG_CHAINING, .slave_configure= iscsi_tcp_slave_configure, .proc_name = iscsi_tcp, .this_id= -1, @@ -1974,7 +1975,7 @@ static struct iscsi_transport iscsi_tcp_transport = { .host_template = iscsi_sht, .conndata_size = sizeof(struct iscsi_conn), .max_conn = 1, - .max_cmd_len= ISCSI_TCP_MAX_CMD_LEN, + .max_cmd_len= 16, /* session management */ .create_session = iscsi_tcp_session_create, .destroy_session= iscsi_tcp_session_destroy, diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 893cd2e..ed0b991 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -24,9 +24,6 @@ #include scsi/libiscsi.h -#define ISCSI_SG_TABLESIZE SG_ALL -#define ISCSI_TCP_MAX_CMD_LEN 16 - struct crypto_hash; struct socket; struct iscsi_tcp_conn; -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 21/23] iscsi_tcp: hold lock during data rsp processing
From: Mike Christie [EMAIL PROTECTED] iscsi_data_rsp needs to hold the sesison lock when it calls iscsi_update_cmdsn. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c | 14 ++ 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 84c4a50..edebdf2 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -641,13 +641,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) } /* fill-in new R2T associated with the task */ - spin_lock(session-lock); iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); if (!ctask-sc || session-state != ISCSI_STATE_LOGGED_IN) { printk(KERN_INFO iscsi_tcp: dropping R2T itt %d in recovery...\n, ctask-itt); - spin_unlock(session-lock); return 0; } @@ -660,7 +658,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) printk(KERN_ERR iscsi_tcp: invalid R2T with zero data len\n); __kfifo_put(tcp_ctask-r2tpool.queue, (void*)r2t, sizeof(void*)); - spin_unlock(session-lock); return ISCSI_ERR_DATALEN; } @@ -676,7 +673,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) r2t-data_offset, scsi_bufflen(ctask-sc)); __kfifo_put(tcp_ctask-r2tpool.queue, (void*)r2t, sizeof(void*)); - spin_unlock(session-lock); return ISCSI_ERR_DATALEN; } @@ -690,8 +686,6 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) conn-r2t_pdus_cnt++; iscsi_requeue_ctask(ctask); - spin_unlock(session-lock); - return 0; } @@ -764,7 +758,9 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) switch(opcode) { case ISCSI_OP_SCSI_DATA_IN: ctask = session-cmds[itt]; + spin_lock(conn-session-lock); rc = iscsi_data_rsp(conn, ctask); + spin_unlock(conn-session-lock); if (rc) return rc; if (tcp_conn-in.datalen) { @@ -806,9 +802,11 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) ctask = session-cmds[itt]; if (ahslen) rc = ISCSI_ERR_AHSLEN; - else if (ctask-sc-sc_data_direction == DMA_TO_DEVICE) + else if (ctask-sc-sc_data_direction == DMA_TO_DEVICE) { + spin_lock(session-lock); rc = iscsi_r2t_rsp(conn, ctask); - else + spin_unlock(session-lock); + } else rc = ISCSI_ERR_PROTO; break; case ISCSI_OP_LOGIN_RSP: -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 22/23] libiscsi: use is_power_of_2
From: Mike Christie [EMAIL PROTECTED] Patch from vignesh babu [EMAIL PROTECTED]: Replacing n (n - 1) for power of 2 check by is_power_of_2(n) Signed-off-by: vignesh babu [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/libiscsi.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 6573223..553168a 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -24,6 +24,7 @@ #include linux/types.h #include linux/kfifo.h #include linux/delay.h +#include linux/log2.h #include asm/unaligned.h #include net/tcp.h #include scsi/scsi_cmnd.h @@ -1700,7 +1701,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit, qdepth = ISCSI_DEF_CMD_PER_LUN; } - if (cmds_max 2 || (cmds_max (cmds_max - 1)) || + if (!is_power_of_2(cmds_max) || cmds_max = ISCSI_MGMT_ITT_OFFSET) { if (cmds_max != 0) printk(KERN_ERR iscsi: invalid can_queue of %d. -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 23/23] iscsi_tcp: fix setting of r2t
From: Mike Christie [EMAIL PROTECTED] If we negotiate for X r2ts we have to use only X r2ts. We cannot round up (we could send less though). It is ok to fail if it is not something the driver can handle, so this patch just does that. Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index edebdf2..e5be5fd 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1774,12 +1774,12 @@ iscsi_conn_set_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, break; case ISCSI_PARAM_MAX_R2T: sscanf(buf, %d, value); - if (session-max_r2t == roundup_pow_of_two(value)) + if (value = 0 || !is_power_of_2(value)) + return -EINVAL; + if (session-max_r2t == value) break; iscsi_r2tpool_free(session); iscsi_set_param(cls_conn, param, buf, buflen); - if (session-max_r2t (session-max_r2t - 1)) - session-max_r2t = roundup_pow_of_two(session-max_r2t); if (iscsi_r2tpool_alloc(session)) return -ENOMEM; break; -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/23] iscsi_tcp: update the website URL
From: FUJITA Tomonori [EMAIL PROTECTED] Use open-iscsi.org instead of linux-iscsi.sf.net, which hasn't been updated for ages. Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/Kconfig |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index a6676be..ab965f5 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -341,7 +341,7 @@ config ISCSI_TCP The userspace component needed to initialize the driver, documentation, and sample configuration files can be found here: -http://linux-iscsi.sf.net +http://open-iscsi.org config SGIWD93_SCSI tristate SGI WD93C93 SCSI Driver -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/23] Prettify resid handling and some extra checks
From: Mike Christie [EMAIL PROTECTED] from Boaz Harrosh: - Check to see that OVERFLOW is not negative indicating a bug. - Unify handling of UNDERFLOW and OVERFLOW to the same code. - Also handle BIDI_OVERFLOW. Signed-off-by: Boaz Harrosh [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c | 16 +++- drivers/scsi/libiscsi.c | 12 +++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 1b540e0..fd88777 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -507,22 +507,20 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) } if (rhdr-flags ISCSI_FLAG_DATA_STATUS) { + sc-result = (DID_OK 16) | rhdr-cmd_status; conn-exp_statsn = be32_to_cpu(rhdr-statsn) + 1; - if (rhdr-flags ISCSI_FLAG_DATA_UNDERFLOW) { + if (rhdr-flags (ISCSI_FLAG_DATA_UNDERFLOW | + ISCSI_FLAG_DATA_OVERFLOW)) { int res_count = be32_to_cpu(rhdr-residual_count); if (res_count 0 - res_count = scsi_bufflen(sc)) { + (rhdr-flags ISCSI_FLAG_CMD_OVERFLOW || +res_count = scsi_bufflen(sc))) scsi_set_resid(sc, res_count); - sc-result = (DID_OK 16) | rhdr-cmd_status; - } else + else sc-result = (DID_BAD_TARGET 16) | rhdr-cmd_status; - } else if (rhdr-flags ISCSI_FLAG_DATA_OVERFLOW) { - scsi_set_resid(sc, be32_to_cpu(rhdr-residual_count)); - sc-result = (DID_OK 16) | rhdr-cmd_status; - } else - sc-result = (DID_OK 16) | rhdr-cmd_status; + } } conn-datain_pdus_cnt++; diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 176458f..0beb4c6 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -291,17 +291,19 @@ invalid_datalen: min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); } - if (rhdr-flags ISCSI_FLAG_CMD_UNDERFLOW) { + if (rhdr-flags (ISCSI_FLAG_CMD_UNDERFLOW | + ISCSI_FLAG_CMD_OVERFLOW)) { int res_count = be32_to_cpu(rhdr-residual_count); - if (res_count 0 res_count = scsi_bufflen(sc)) + if (res_count 0 + (rhdr-flags ISCSI_FLAG_CMD_OVERFLOW || +res_count = scsi_bufflen(sc))) scsi_set_resid(sc, res_count); else sc-result = (DID_BAD_TARGET 16) | rhdr-cmd_status; - } else if (rhdr-flags ISCSI_FLAG_CMD_BIDI_UNDERFLOW) + } else if (rhdr-flags (ISCSI_FLAG_CMD_BIDI_UNDERFLOW | + ISCSI_FLAG_CMD_BIDI_OVERFLOW)) sc-result = (DID_BAD_TARGET 16) | rhdr-cmd_status; - else if (rhdr-flags ISCSI_FLAG_CMD_OVERFLOW) - scsi_set_resid(sc, be32_to_cpu(rhdr-residual_count)); out: debug_scsi(done [sc %lx res %d itt 0x%x]\n, -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 17/23] iscsi_tcp: stop leaking r2t_info's when the incoming R2T is bad
From: Mike Christie [EMAIL PROTECTED] from [EMAIL PROTECTED]: iscsi_r2t_rsp checks the incoming R2T for sanity, and if it thinks it's fishy, it will drop it silently. In this case, we leaked an r2t_info object. If we do this often enough, we run into a BUG_ON some time later. Removed r2t wrappers and update patch by Mike Christie Signed-off-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 7212fe9..ecba606 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -658,6 +658,8 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) r2t-data_length = be32_to_cpu(rhdr-data_length); if (r2t-data_length == 0) { printk(KERN_ERR iscsi_tcp: invalid R2T with zero data len\n); + __kfifo_put(tcp_ctask-r2tpool.queue, (void*)r2t, + sizeof(void*)); spin_unlock(session-lock); return ISCSI_ERR_DATALEN; } @@ -669,10 +671,12 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) r2t-data_offset = be32_to_cpu(rhdr-data_offset); if (r2t-data_offset + r2t-data_length scsi_bufflen(ctask-sc)) { - spin_unlock(session-lock); printk(KERN_ERR iscsi_tcp: invalid R2T with data len %u at offset %u and total length %d\n, r2t-data_length, r2t-data_offset, scsi_bufflen(ctask-sc)); + __kfifo_put(tcp_ctask-r2tpool.queue, (void*)r2t, + sizeof(void*)); + spin_unlock(session-lock); return ISCSI_ERR_DATALEN; } -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/23] iscsi_tcp, libiscsi: initial AHS Support
From: Mike Christie [EMAIL PROTECTED] at libiscsi generic code - currently code assumes a storage space of pdu header is allocated at llds ctask and is pointed to by iscsi_cmd_task-hdr. Here I add a hdr_max field pertaining to that storage, and an hdr_len that accumulates the current use of the pdu-header. - Add an iscsi_next_hdr() inline which returns the next free space to write new Header at. Also iscsi_next_hdr() is used to retrieve the address at which to write the header-digest. - Add iscsi_add_hdr(length). What the user do is calls iscsi_next_hdr() for address of the new header, than calls iscsi_add_hdr(length) with the size of the new header. iscsi_add_hdr() will check if space is available and update to the new size. length must be padded according to standard. - Add 2 padding inline helpers thanks to Olaf. Current patch does not use them but Following patches will. Also moved definition of ISCSI_PAD_LEN to iscsi_proto.h which had PAD_WORD_LEN that was never used anywhere. - Let iscsi_prep_scsi_cmd_pdu() signal an Error return since now it is possible that it will fail. - I was tired of yet again writing a this is a digest comment next to sizeof(__u32) so I defined a new ISCSI_DIGEST_SIZE. Now I don't need any comments. Changed all places that used sizeof(__u32) or 4 in connection to a digest. iscsi_tcp specific code - At struct iscsi_tcp_cmd_task allocate maximum space allowed in standard for all headers following the iscsi_cmd header. and mark it so in iscsi_tcp_session_create() - At iscsi_send_cmd_hdr() retrieve the correct headers size and write header digest at iscsi_next_hdr(). Signed-off-by: Boaz Harrosh [EMAIL PROTECTED] Acked-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/scsi/iscsi_tcp.c | 16 drivers/scsi/iscsi_tcp.h | 13 +++-- drivers/scsi/libiscsi.c| 41 +++-- include/scsi/iscsi_proto.h | 10 +- include/scsi/libiscsi.h| 33 +++-- 5 files changed, 94 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index fd88777..491845f 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -113,7 +113,7 @@ iscsi_hdr_digest(struct iscsi_conn *conn, struct iscsi_buf *buf, struct iscsi_tcp_conn *tcp_conn = conn-dd_data; crypto_hash_digest(tcp_conn-tx_hash, buf-sg, buf-sg.length, crc); - buf-sg.length += sizeof(u32); + buf-sg.length += ISCSI_DIGEST_SIZE; } /* @@ -220,6 +220,7 @@ static inline int iscsi_tcp_chunk_done(struct iscsi_chunk *chunk) { static unsigned char padbuf[ISCSI_PAD_LEN]; + unsigned int pad; if (chunk-copied chunk-size) { iscsi_tcp_chunk_map(chunk); @@ -243,10 +244,8 @@ iscsi_tcp_chunk_done(struct iscsi_chunk *chunk) } /* Do we need to handle padding? */ - if (chunk-total_copied (ISCSI_PAD_LEN-1)) { - unsigned int pad; - - pad = ISCSI_PAD_LEN - (chunk-total_copied (ISCSI_PAD_LEN-1)); + pad = iscsi_padding(chunk-total_copied); + if (pad != 0) { debug_tcp(consume %d pad bytes\n, pad); chunk-total_size += pad; chunk-size = pad; @@ -1385,11 +1384,11 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) } iscsi_buf_init_iov(tcp_ctask-headbuf, (char*)ctask-hdr, - sizeof(struct iscsi_hdr)); + ctask-hdr_len); if (conn-hdrdgst_en) iscsi_hdr_digest(conn, tcp_ctask-headbuf, -(u8*)tcp_ctask-hdrext); +iscsi_next_hdr(ctask)); tcp_ctask-xmstate = ~XMSTATE_CMD_HDR_INIT; tcp_ctask-xmstate |= XMSTATE_CMD_HDR_XMIT; } @@ -2176,7 +2175,8 @@ iscsi_tcp_session_create(struct iscsi_transport *iscsit, struct iscsi_cmd_task *ctask = session-cmds[cmd_i]; struct iscsi_tcp_cmd_task *tcp_ctask = ctask-dd_data; - ctask-hdr = tcp_ctask-hdr; + ctask-hdr = tcp_ctask-hdr.cmd_hdr; + ctask-hdr_max = sizeof(tcp_ctask-hdr) - ISCSI_DIGEST_SIZE; } for (cmd_i = 0; cmd_i session-mgmtpool_max; cmd_i++) { diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index f1c5411..eb3784f 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -41,7 +41,6 @@ #define XMSTATE_IMM_HDR_INIT 0x1000 #define XMSTATE_SOL_HDR_INIT 0x2000 -#define ISCSI_PAD_LEN 4 #define ISCSI_SG_TABLESIZE SG_ALL #define ISCSI_TCP_MAX_CMD_LEN 16 @@ -130,14 +129,14 @@ struct iscsi_buf {
[PATCH 05/23] iser patching for AHS support
From: Mike Christie [EMAIL PROTECTED] from Boaz Harrosh [EMAIL PROTECTED] - The default initialization of hdr_max is the minimum - sizeof(struct iscsi_cmd) - Once this patch goes into iser the default initialization at libiscsi can be removed. - This is not yet full support for AHSs at iser end. But it should be easy. Just allocate more space at iser_desc right after iscsi_hdr. Than at transmission time use ctask-hdr_len to retrieve the total size of all iscsi pdu headers. See previous patch at iscsi_tcp.[ch] Signed-off-by: Boaz Harrosh [EMAIL PROTECTED] Signed-off-by: Mike Christie [EMAIL PROTECTED] --- drivers/infiniband/ulp/iser/iscsi_iser.c |1 + drivers/scsi/libiscsi.c |1 - 2 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 2eadb6d..a2622f4 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -400,6 +400,7 @@ iscsi_iser_session_create(struct iscsi_transport *iscsit, ctask = session-cmds[i]; iser_ctask = ctask-dd_data; ctask-hdr = (struct iscsi_cmd *)iser_ctask-desc.iscsi_header; + ctask-hdr_max = sizeof(iser_ctask-desc.iscsi_header); } for (i = 0; i session-mgmtpool_max; i++) { diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 0d7914f..5936586 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1570,7 +1570,6 @@ iscsi_session_setup(struct iscsi_transport *iscsit, if (cmd_task_size) ctask-dd_data = ctask[1]; ctask-itt = cmd_i; - ctask-hdr_max = sizeof(struct iscsi_cmd); INIT_LIST_HEAD(ctask-running); } -- 1.5.1.2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE PATCH] Add a missing spin_unlock() found when a BLS frame was mis-delivered.
Add a missing spin_unlock() found when a BLS frame was mis-delivered. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/openfc/openfc_scsi.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/ofc/openfc/openfc_scsi.c b/drivers/scsi/ofc/openfc/openfc_scsi.c index 86e6895..5fa0ad6 100644 --- a/drivers/scsi/ofc/openfc/openfc_scsi.c +++ b/drivers/scsi/ofc/openfc/openfc_scsi.c @@ -548,6 +548,8 @@ void openfc_scsi_abort_iocontext(struct fc_scsi_pkt *fsp) fsp-status_code = OPENFC_ERROR; fsp-io_status = (SUGGEST_RETRY 24); (*fsp-done) (fsp); + } else { + spin_unlock(qp-scsi_pkt_lock); } } - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE PATCH] Don't deliver BLS frames to the fast path.
Don't deliver BLS frames to the fast path. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/libfc/fc_local_port.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/ofc/libfc/fc_local_port.c b/drivers/scsi/ofc/libfc/fc_local_port.c index 55de5d3..66a1d47 100644 --- a/drivers/scsi/ofc/libfc/fc_local_port.c +++ b/drivers/scsi/ofc/libfc/fc_local_port.c @@ -1607,7 +1607,8 @@ void fc_local_port_recv(struct fc_local_port *lp, struct fc_frame *fp) /* fall through */ case FC_EOF_N: mp = lp-fl_vf-vf_exch_mgr; - if ((f_ctl (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX) { + if ((f_ctl (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX + fh-fh_type != FC_TYPE_BLS) { fc_exch_recv_seq_resp(mp, fp); } else if (f_ctl FC_FC_SEQ_CTX) { fc_exch_recv_resp(mp, fp); - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE PATCH] fcoe_create() fails without destroying the kmem slab.
fcoe_create() fails without destroying the kmem slab. This causes the next create to panic. The destroy should be done in openfc_put_dev. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/openfc/openfc_if.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ofc/openfc/openfc_if.c b/drivers/scsi/ofc/openfc/openfc_if.c index 0d9c370..6f9a276 100644 --- a/drivers/scsi/ofc/openfc/openfc_if.c +++ b/drivers/scsi/ofc/openfc/openfc_if.c @@ -1115,7 +1115,6 @@ void openfc_unregister(struct fcdev *dev) fc_remove_host(openfcp-host); scsi_remove_host(openfcp-host); fcs_destroy(openfcp-fcs_state); - openfc_destroy_scsi_slab(openfcp); } EXPORT_SYMBOL(openfc_unregister); @@ -1127,9 +1126,7 @@ void openfc_put_dev(struct fcdev *dev) { struct openfc_softc *openfcp = openfc_get_softc(dev); - /* -* put back the scsi host structure -*/ + openfc_destroy_scsi_slab(openfcp); scsi_host_put(openfcp-host); } EXPORT_SYMBOL(openfc_put_dev); - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE PATCH] If expecting pre-T11 frames, a T11 frame caused a data fault.
If expecting pre-T11 frames, a T11 frame caused a data fault. This is because the T11 frames have zeros where the old length/SOF field was, and a length of less than the size of the FC header was not checked for. Also limit length error messages to frames (per-CPU actually). Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/fcoe/fcoe_dev.c | 23 +++ 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ofc/fcoe/fcoe_dev.c b/drivers/scsi/ofc/fcoe/fcoe_dev.c index df652b6..878efd4 100644 --- a/drivers/scsi/ofc/fcoe/fcoe_dev.c +++ b/drivers/scsi/ofc/fcoe/fcoe_dev.c @@ -485,8 +485,9 @@ int fcoe_percpu_receive_thread(void *arg) hp = (struct fcoe_hdr *)skb-data; if (unlikely(FC_FCOE_DECAPS_VER(hp) != FC_FCOE_VER)) { - SA_LOG(unknown FCoE version %x, - FC_FCOE_DECAPS_VER(hp)); + if (stats-ErrorFrames 5) + SA_LOG(unknown FCoE version %x, + FC_FCOE_DECAPS_VER(hp)); stats-ErrorFrames++; kfree_skb(skb); continue; @@ -505,20 +506,25 @@ int fcoe_percpu_receive_thread(void *arg) skb_pull(skb, sizeof(*fchp)); fr_len = FC_FCOE_DECAPS_LEN(len); fr_len = fr_len * FCOE_WORD_TO_BYTE; + if (unlikely(fr_len sizeof(struct fc_frame_header) + + sizeof(cp-fcoe_crc32))) { + if (stats-ErrorFrames 5) + SA_LOG(length error: len_sof %x, len); + stats-ErrorFrames++; + kfree_skb(skb); + continue; + } sof = FC_FCOE_DECAPS_SOF(len); fr_len -= sizeof(cp-fcoe_crc32); tlen = sizeof(struct fcoe_crc_eof_old); } if (skb_is_nonlinear(skb)) -#if LINUX_VERSION_CODE KERNEL_VERSION(2,6,18) - skb_linearize(skb, GFP_KERNEL); /* not ideal */ -#else skb_linearize(skb); /* not ideal */ -#endif if (unlikely(fr_len + tlen skb-len)) { - SA_LOG(short frame fr_len %x skb-len %x\n, - fr_len + tlen, skb-len); + if (stats-ErrorFrames 5) + SA_LOG(length error fr_len 0x%x skb-len 0x%x, + fr_len + tlen, skb-len); stats-ErrorFrames++; kfree_skb(skb); continue; @@ -540,6 +546,7 @@ int fcoe_percpu_receive_thread(void *arg) * and it'll be more cache-efficient. */ fh = fc_frame_header_get(fp); + ASSERT(fh); if (fh-fh_r_ctl == FC_RCTL_DD_SOL_DATA fh-fh_type == FC_TYPE_FCP) { fp-fr_flags |= FCPHF_CRC_UNCHECKED; - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE PATCH] [PATCH] Performance improvement, combine received data copy with CRC.
[PATCH] Performance improvement, combine received data copy with CRC. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/openfc/openfc_scsi.c | 130 +++-- 1 files changed, 90 insertions(+), 40 deletions(-) diff --git a/drivers/scsi/ofc/openfc/openfc_scsi.c b/drivers/scsi/ofc/openfc/openfc_scsi.c index 5fa0ad6..b5fc393 100644 --- a/drivers/scsi/ofc/openfc/openfc_scsi.c +++ b/drivers/scsi/ofc/openfc/openfc_scsi.c @@ -62,7 +62,6 @@ static void openfc_tm_done(struct fc_seq *, struct fc_frame *, void *); static void openfc_scsi_error(enum fc_event, void *); static int openfc_abort_internal(struct fcdev *, struct fc_scsi_pkt *, struct fc_frame *); -int openfc_cp_to_user(struct fc_scsi_pkt *, uint, void *, int); void openfc_scsi_cleanup(struct fc_scsi_pkt *); static void openfc_timeout_error(struct fc_scsi_pkt *); void openfc_scsi_rec_rcv(struct fc_seq *, struct fc_frame *, void *); @@ -102,9 +101,13 @@ static void openfc_scsi_recv_data(struct fc_scsi_pkt *fsp, struct fc_frame *fp) struct fcoe_dev_stats *sp; struct fc_frame_header *fh; size_t offset; + u32 crc; + u32 copy_len = 0; size_t len; void *buf; + if (!sc-request_buffer) + return; /* XXX possible? */ fh = fc_frame_header_get(fp); offset = net32_get(fh-fh_parm_offset); len = fp-fr_len - sizeof(*fh); @@ -115,13 +118,8 @@ static void openfc_scsi_recv_data(struct fc_scsi_pkt *fsp, struct fc_frame *fp) * this should never happen */ if ((fp-fr_flags FCPHF_CRC_UNCHECKED) - fc_frame_crc_check(fp)) { - sp = openfcp-fd.dev_stats[smp_processor_id()]; - sp-ErrorFrames++; - if (sp-InvalidCRCCount++ 5) - SA_LOG(CRC error on data frame); - return; /* just ignore the frame */ - } + fc_frame_crc_check(fp)) + goto crc_err; if (openfc_debug) { SA_LOG(data received past end. len %zx offset %zx @@ -130,42 +128,95 @@ static void openfc_scsi_recv_data(struct fc_scsi_pkt *fsp, struct fc_frame *fp) openfc_scsi_retry(fsp); return; } - - /* -* Eventually, do scatter/gather buffer system to avoid -* this copy. A NULL buffer means we discard the data. -*/ + crc = 0; if (sc-use_sg) { - len = openfc_cp_to_user(fsp, offset, buf, len); - ASSERT_NOTIMPL(len 0); - } else if (sc-request_buffer != NULL) { - __memcpy((void *)sc-request_buffer + offset, buf, len); - } + struct scatterlist *sg; + struct scatterlist *sg_limit; + size_t remaining, sg_bytes; + size_t off; + void *page_addr; - /* -* If the lower layer didn't do the CRC check, do it here. -* This is the only type of frame the transport might not check. -* Eventually we could do the CRC calculation during the copy above. -*/ - if ((fp-fr_flags FCPHF_CRC_UNCHECKED) fc_frame_crc_check(fp)) { - sp = openfcp-fd.dev_stats[smp_processor_id()]; - sp-ErrorFrames++; - if (sp-InvalidCRCCount++ 5) - SA_LOG(CRC error on data frame); + if (fp-fr_flags FCPHF_CRC_UNCHECKED) + crc = crc32_sb8_64_bit(~0, (u8 *) fh, sizeof(*fh)); - /* -* Assume the frame is total garbage. -* We may have copied it over the good part of the buffer. -* If so, we need to retry the entire operation. -* Otherwise, ignore it. -*/ - if (offset fsp-xfer_len) - openfc_scsi_retry(fsp); - return; - } + sg = (struct scatterlist *)sc-request_buffer; + sg_limit = sg + sc-use_sg; + remaining = len; - fsp-xfer_len += len; + while (remaining 0 sg sg_limit) { + if (offset = sg-length) { + offset -= sg-length; + sg++; + continue; + } + sg_bytes = min(remaining, sg-length - offset); + /* +* The scatterlist item may be bigger than PAGE_SIZE, +* but we are limited to mapping PAGE_SIZE at a time. +*/ + off = offset + sg-offset; + sg_bytes = min(sg_bytes, + (PAGE_SIZE - (off
[OpenFCoE PATCH] Don't use netdev for FCoE if pause is not correctly set, even for VLANs.
Don't use netdev for FCoE if pause is not correctly set, even for VLANs. This modifies the previous tests to require that the underlying net-dev supports the ethtool get_pauseparam operation. NICs that are 10/100/1000 must have pause autonegotiation turned on. All NICs must have RX and TX pause on. If not, they are treated as if there is no link. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/fcoe/fcoe_def.h |1 drivers/scsi/ofc/fcoe/fcoe_if.c | 90 ++ drivers/scsi/ofc/fcoe/fcoeinit.c | 66 3 files changed, 71 insertions(+), 86 deletions(-) diff --git a/drivers/scsi/ofc/fcoe/fcoe_def.h b/drivers/scsi/ofc/fcoe/fcoe_def.h index 0c71dc7..6550c73 100644 --- a/drivers/scsi/ofc/fcoe/fcoe_def.h +++ b/drivers/scsi/ofc/fcoe/fcoe_def.h @@ -109,6 +109,7 @@ int fcoe_create_interface(struct fcoe_info *, void *); intfcoe_xmit(struct fcdev *, struct fc_frame *); intfcoe_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); +intfcoe_link_ok(struct fcdev *); struct fc_frame *fcoe_frame_alloc(size_t); void fcoe_put_dev(struct fcdev *dev); struct fcoe_softc *fcoe_find_fcdev(char *); diff --git a/drivers/scsi/ofc/fcoe/fcoe_if.c b/drivers/scsi/ofc/fcoe/fcoe_if.c index d87ede1..fd3c7a7 100644 --- a/drivers/scsi/ofc/fcoe/fcoe_if.c +++ b/drivers/scsi/ofc/fcoe/fcoe_if.c @@ -160,6 +160,48 @@ int fcoe_destroy_interface(struct fcdev *fd) } /* + * Return non-zero if link is OK for use by FCoE. + * Any permanently-disqualifying conditions have been previously checked. + * This checks pause settings, which can change with link. + * This also updates the speed setting, which may change with link for 100/1000. + */ +int fcoe_link_ok(struct fcdev *fdev) +{ + struct fcoe_softc *fc = (struct fcoe_softc *)fdev-drv_priv; + struct net_device *dev = fc-real_dev; + struct ethtool_pauseparam pause = { ETHTOOL_GPAUSEPARAM }; + struct ethtool_cmd ecmd = { ETHTOOL_GSET }; + int rc = 0; + + if ((dev-flags IFF_UP) netif_carrier_ok(dev)) { + dev-ethtool_ops-get_pauseparam(dev, pause); + if (dev-ethtool_ops-get_settings) { + dev-ethtool_ops-get_settings(dev, ecmd); + fdev-fd_speed_support = + ~(OFC_SPEED_1GBIT | OFC_SPEED_10GBIT); + if (ecmd.supported (SUPPORTED_1000baseT_Half | + SUPPORTED_1000baseT_Full)) + fdev-fd_speed_support |= OFC_SPEED_1GBIT; + if (ecmd.supported SUPPORTED_1baseT_Full) + fdev-fd_speed_support |= OFC_SPEED_10GBIT; + if (ecmd.speed == SPEED_1000) + fdev-fd_speed = OFC_SPEED_1GBIT; + if (ecmd.speed == SPEED_1) + fdev-fd_speed = OFC_SPEED_10GBIT; + + /* +* for 10 G (and faster), ignore autoneg requirement. +*/ + if (ecmd.speed = SPEED_1) + pause.autoneg = 1; + } + if (pause.autoneg pause.tx_pause pause.rx_pause) + rc = 1; + } + return rc; +} + +/* * This function creates the fcoe interface * create struct fcdev which is a shared structure between opefc * and transport level protocol. @@ -171,8 +213,6 @@ int fcoe_create_interface(struct fcoe_info *fci, void *ptr) struct fcoe_cfg *cfg = ptr; struct fcoe_softc *fc; struct fcoe_dev_stats *p; - struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; - struct ethtool_cmd ecmd = { ETHTOOL_GSET }; int rc = 0; int i; #ifdef HAVE_SET_RX_MODE @@ -207,12 +247,6 @@ int fcoe_create_interface(struct fcoe_info *fci, void *ptr) goto out; } - fdev-fd_link_status = TRANS_LINK_DOWN; - if ((fc-real_dev-flags IFF_UP) != 0 - netif_carrier_ok(fc-real_dev)) { - fdev-fd_link_status = TRANS_LINK_UP; - } - /* * Do not support for bonding device */ @@ -224,38 +258,16 @@ int fcoe_create_interface(struct fcoe_info *fci, void *ptr) } /* -* if it is not a vlan driver then do more check */ - if (!(fc-real_dev-priv_flags IFF_802_1Q_VLAN)) { - - if (!fc-real_dev-ethtool_ops) { - rc = -EOPNOTSUPP; - goto out; - } - if (!fc-real_dev-ethtool_ops-get_pauseparam) { - rc = -EOPNOTSUPP; - goto out; - } - fc-real_dev-ethtool_ops-get_pauseparam(fc-real_dev, -
Re: [OpenFCoE PATCH] Add a missing spin_unlock() found when a BLS frame was mis-delivered.
Joe Eykholt wrote: Add a missing spin_unlock() found when a BLS frame was mis-delivered. Please disregard this patch. It got merged into the wrong function. A better one is coming. Joe Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/openfc/openfc_scsi.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/ofc/openfc/openfc_scsi.c b/drivers/scsi/ofc/openfc/openfc_scsi.c index 86e6895..5fa0ad6 100644 --- a/drivers/scsi/ofc/openfc/openfc_scsi.c +++ b/drivers/scsi/ofc/openfc/openfc_scsi.c @@ -548,6 +548,8 @@ void openfc_scsi_abort_iocontext(struct fc_scsi_pkt *fsp) fsp-status_code = OPENFC_ERROR; fsp-io_status = (SUGGEST_RETRY 24); (*fsp-done) (fsp); + } else { + spin_unlock(qp-scsi_pkt_lock); } } - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: broken dpt_i2o in 2.6.23 (was: ext2_check_page: bad entry in directory)
On Thu, 29 Nov 2007 13:31:50 +0100 Anders Henke [EMAIL PROTECTED] wrote: On November 28 2007, Anders Henke wrote: As everything is reported as being zero is quite odd an Jan took a guess that it might be block-layer or driver-related, I've assumed that the driver is responsible for this; just out of the curiousity, I've manually replaced the dpt_i2o driver by the 2.6.19 one by copying driver/scsi/dpt_i2o.c driver/scsi/dpti.h and driver/scsi/dpt/ into a vanilla 2.6.23.1. kernel; using this kernel fixed the issue for me. I haven't yet fine-tested from which kernel release on the dpt_i2o driver behaves like this and spews out zeroed blocks when trying to mount the rootfs. Maybe this is just some timing issue. I've started the fine-tests and can say so far that dpt_i2o from 2.6.22 is still fine. Test is simple: [EMAIL PROTECTED]:/usr/src/linux-2.6.22/drivers/scsi/dpt$ cp -r dpt/ dpt_i2o.c dpti.h /usr/src/linux-2.6.23.1/drivers/scsi/ ... recompile the kernel, reboot: works. 2.6.22 and 2.6.23 differ in terms of the dpt_i2o driver by two different patch sets: -one 2 Kb small set of patches from 2.6.22 to 2.6.22-rc1 -one 7 Kb set of patches from 2.6.23-rc2 to 2.6.23-rc3 -one 162 Kb set of patches from 2.6.23-rc9 to 2.6.23-rc10. When applying the 2.6.23-rc1-based driver to my 2.6.31.1 kernel, the zero blocks-symptom show up, so it's the lucky situation that the smallest patch actually seams to be the broken one. According to the 2.6.23-rc1 short-form changelog, there is one major edit on the dpt_i2o driver: FUJITA Tomonori [SCSI] dpt_i2o: convert to use the data buffer accessors Stephen Rothwell dpt_i2o depends on virt_to_bus Fujita, would you please take a look at this? He won't have seen this. cc's added. I think that something's broken in there, leading to the dpt_i2o sending out blocks of zeroes right after initialization, at least on some specific controllers (in this case, Adaptec 2010S on Intel SE7501WV2S-based boxes). I don't have insight kernel driver development knowledge, so I'm quite out of help right now. Nevertheless, I'll add the diff from 2.6.22 to 2.6.23-rc1 in terms of dpt_i2o: Can you please confirm that this revert (against 2.6.24-rc4) fixes the data corruption problems? Thanks. diff -puN drivers/scsi/dpt_i2o.c~revert-dpt_i2o-convert-to-use-the-data-buffer-accessors drivers/scsi/dpt_i2o.c --- a/drivers/scsi/dpt_i2o.c~revert-dpt_i2o-convert-to-use-the-data-buffer-accessors +++ a/drivers/scsi/dpt_i2o.c @@ -2062,13 +2062,12 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH u32 *lenptr; int direction; int scsidir; - int nseg; u32 len; u32 reqlen; s32 rcode; memset(msg, 0 , sizeof(msg)); - len = scsi_bufflen(cmd); + len = cmd-request_bufflen; direction = 0x; scsidir = 0x; // DATA NO XFER @@ -2125,21 +2124,21 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH lenptr=mptr++; /* Remember me - fill in when we know */ reqlen = 14;// SINGLE SGE /* Now fill in the SGList and command */ + if(cmd-use_sg) { + struct scatterlist *sg = (struct scatterlist *)cmd-request_buffer; + int sg_count = pci_map_sg(pHba-pDev, sg, cmd-use_sg, + cmd-sc_data_direction); - nseg = scsi_dma_map(cmd); - BUG_ON(nseg 0); - if (nseg) { - struct scatterlist *sg; len = 0; - scsi_for_each_sg(cmd, sg, nseg, i) { + for(i = 0 ; i sg_count; i++) { *mptr++ = direction|0x1000|sg_dma_len(sg); len+=sg_dma_len(sg); *mptr++ = sg_dma_address(sg); - /* Make this an end of list */ - if (i == nseg - 1) - mptr[-2] = direction|0xD000|sg_dma_len(sg); + sg++; } + /* Make this an end of list */ + mptr[-2] = direction|0xD000|sg_dma_len(sg-1); reqlen = mptr - msg; *lenptr = len; @@ -2148,8 +2147,16 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pH len, cmd-underflow); } } else { - *lenptr = len = 0; - reqlen = 12; + *lenptr = len = cmd-request_bufflen; + if(len == 0) { + reqlen = 12; + } else { + *mptr++ = 0xD000|direction|cmd-request_bufflen; + *mptr++ = pci_map_single(pHba-pDev, + cmd-request_buffer, + cmd-request_bufflen, + cmd-sc_data_direction); + } } /*
Re: broken dpt_i2o in 2.6.23 (was: ext2_check_page: bad entry in directory)
On Tue, 4 Dec 2007 16:57:38 -0800 Andrew Morton [EMAIL PROTECTED] wrote: On Thu, 29 Nov 2007 13:31:50 +0100 Anders Henke [EMAIL PROTECTED] wrote: On November 28 2007, Anders Henke wrote: As everything is reported as being zero is quite odd an Jan took a guess that it might be block-layer or driver-related, I've assumed that the driver is responsible for this; just out of the curiousity, I've manually replaced the dpt_i2o driver by the 2.6.19 one by copying driver/scsi/dpt_i2o.c driver/scsi/dpti.h and driver/scsi/dpt/ into a vanilla 2.6.23.1. kernel; using this kernel fixed the issue for me. I haven't yet fine-tested from which kernel release on the dpt_i2o driver behaves like this and spews out zeroed blocks when trying to mount the rootfs. Maybe this is just some timing issue. I've started the fine-tests and can say so far that dpt_i2o from 2.6.22 is still fine. Test is simple: [EMAIL PROTECTED]:/usr/src/linux-2.6.22/drivers/scsi/dpt$ cp -r dpt/ dpt_i2o.c dpti.h /usr/src/linux-2.6.23.1/drivers/scsi/ ... recompile the kernel, reboot: works. 2.6.22 and 2.6.23 differ in terms of the dpt_i2o driver by two different patch sets: -one 2 Kb small set of patches from 2.6.22 to 2.6.22-rc1 -one 7 Kb set of patches from 2.6.23-rc2 to 2.6.23-rc3 -one 162 Kb set of patches from 2.6.23-rc9 to 2.6.23-rc10. When applying the 2.6.23-rc1-based driver to my 2.6.31.1 kernel, the zero blocks-symptom show up, so it's the lucky situation that the smallest patch actually seams to be the broken one. According to the 2.6.23-rc1 short-form changelog, there is one major edit on the dpt_i2o driver: FUJITA Tomonori [SCSI] dpt_i2o: convert to use the data buffer accessors Stephen Rothwell dpt_i2o depends on virt_to_bus Fujita, would you please take a look at this? He won't have seen this. cc's added. I think that something's broken in there, leading to the dpt_i2o sending out blocks of zeroes right after initialization, at least on some specific controllers (in this case, Adaptec 2010S on Intel SE7501WV2S-based boxes). I don't have insight kernel driver development knowledge, so I'm quite out of help right now. Nevertheless, I'll add the diff from 2.6.22 to 2.6.23-rc1 in terms of dpt_i2o: Can you please confirm that this revert (against 2.6.24-rc4) fixes the data corruption problems? Anders said that my patch is fine and seems that Matthew's hotplug conversion patch leads to the problem: http://marc.info/?l=linux-kernelm=119641892129732w=2 - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: broken dpt_i2o in 2.6.23 (was: ext2_check_page: bad entry in directory)
On Wed, 05 Dec 2007 10:04:03 +0900 FUJITA Tomonori [EMAIL PROTECTED] wrote: On Tue, 4 Dec 2007 16:57:38 -0800 Andrew Morton [EMAIL PROTECTED] wrote: On Thu, 29 Nov 2007 13:31:50 +0100 Anders Henke [EMAIL PROTECTED] wrote: On November 28 2007, Anders Henke wrote: As everything is reported as being zero is quite odd an Jan took a guess that it might be block-layer or driver-related, I've assumed that the driver is responsible for this; just out of the curiousity, I've manually replaced the dpt_i2o driver by the 2.6.19 one by copying driver/scsi/dpt_i2o.c driver/scsi/dpti.h and driver/scsi/dpt/ into a vanilla 2.6.23.1. kernel; using this kernel fixed the issue for me. I haven't yet fine-tested from which kernel release on the dpt_i2o driver behaves like this and spews out zeroed blocks when trying to mount the rootfs. Maybe this is just some timing issue. I've started the fine-tests and can say so far that dpt_i2o from 2.6.22 is still fine. Test is simple: [EMAIL PROTECTED]:/usr/src/linux-2.6.22/drivers/scsi/dpt$ cp -r dpt/ dpt_i2o.c dpti.h /usr/src/linux-2.6.23.1/drivers/scsi/ ... recompile the kernel, reboot: works. 2.6.22 and 2.6.23 differ in terms of the dpt_i2o driver by two different patch sets: -one 2 Kb small set of patches from 2.6.22 to 2.6.22-rc1 -one 7 Kb set of patches from 2.6.23-rc2 to 2.6.23-rc3 -one 162 Kb set of patches from 2.6.23-rc9 to 2.6.23-rc10. When applying the 2.6.23-rc1-based driver to my 2.6.31.1 kernel, the zero blocks-symptom show up, so it's the lucky situation that the smallest patch actually seams to be the broken one. According to the 2.6.23-rc1 short-form changelog, there is one major edit on the dpt_i2o driver: FUJITA Tomonori [SCSI] dpt_i2o: convert to use the data buffer accessors Stephen Rothwell dpt_i2o depends on virt_to_bus Fujita, would you please take a look at this? He won't have seen this. cc's added. I think that something's broken in there, leading to the dpt_i2o sending out blocks of zeroes right after initialization, at least on some specific controllers (in this case, Adaptec 2010S on Intel SE7501WV2S-based boxes). I don't have insight kernel driver development knowledge, so I'm quite out of help right now. Nevertheless, I'll add the diff from 2.6.22 to 2.6.23-rc1 in terms of dpt_i2o: Can you please confirm that this revert (against 2.6.24-rc4) fixes the data corruption problems? Anders said that my patch is fine and seems that Matthew's hotplug conversion patch leads to the problem: http://marc.info/?l=linux-kernelm=119641892129732w=2 Oh. Jan broke message threading :( So it's been nearly a week and nothing has happened? Do we revert that change? - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE PATCH] Add a missing spin_unlock() found when a BLS frame was mis-delivered.
Add a missing spin_unlock() found when a BLS frame was mis-delivered. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- drivers/scsi/ofc/openfc/openfc_scsi.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/ofc/openfc/openfc_scsi.c b/drivers/scsi/ofc/openfc/openfc_scsi.c index 9e66c5f..6adfd59 100644 --- a/drivers/scsi/ofc/openfc/openfc_scsi.c +++ b/drivers/scsi/ofc/openfc/openfc_scsi.c @@ -580,6 +580,8 @@ static void openfc_scsi_rcv(struct fc_seq *sp, struct fc_frame *fp, void *arg) fc_seq_exch_complete(sp); fsp-state = OPENFC_SRB_RCV_STATUS; (*fsp-done) (fsp); + } else { + spin_unlock(qp-scsi_pkt_lock); } out: fc_frame_free(fp); - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: broken dpt_i2o in 2.6.23 (was: ext2_check_page: bad entry in directory)
On Tue, 4 Dec 2007 17:11:55 -0800 Andrew Morton [EMAIL PROTECTED] wrote: On Wed, 05 Dec 2007 10:04:03 +0900 FUJITA Tomonori [EMAIL PROTECTED] wrote: On Tue, 4 Dec 2007 16:57:38 -0800 Andrew Morton [EMAIL PROTECTED] wrote: On Thu, 29 Nov 2007 13:31:50 +0100 Anders Henke [EMAIL PROTECTED] wrote: On November 28 2007, Anders Henke wrote: As everything is reported as being zero is quite odd an Jan took a guess that it might be block-layer or driver-related, I've assumed that the driver is responsible for this; just out of the curiousity, I've manually replaced the dpt_i2o driver by the 2.6.19 one by copying driver/scsi/dpt_i2o.c driver/scsi/dpti.h and driver/scsi/dpt/ into a vanilla 2.6.23.1. kernel; using this kernel fixed the issue for me. I haven't yet fine-tested from which kernel release on the dpt_i2o driver behaves like this and spews out zeroed blocks when trying to mount the rootfs. Maybe this is just some timing issue. I've started the fine-tests and can say so far that dpt_i2o from 2.6.22 is still fine. Test is simple: [EMAIL PROTECTED]:/usr/src/linux-2.6.22/drivers/scsi/dpt$ cp -r dpt/ dpt_i2o.c dpti.h /usr/src/linux-2.6.23.1/drivers/scsi/ ... recompile the kernel, reboot: works. 2.6.22 and 2.6.23 differ in terms of the dpt_i2o driver by two different patch sets: -one 2 Kb small set of patches from 2.6.22 to 2.6.22-rc1 -one 7 Kb set of patches from 2.6.23-rc2 to 2.6.23-rc3 -one 162 Kb set of patches from 2.6.23-rc9 to 2.6.23-rc10. When applying the 2.6.23-rc1-based driver to my 2.6.31.1 kernel, the zero blocks-symptom show up, so it's the lucky situation that the smallest patch actually seams to be the broken one. According to the 2.6.23-rc1 short-form changelog, there is one major edit on the dpt_i2o driver: FUJITA Tomonori [SCSI] dpt_i2o: convert to use the data buffer accessors Stephen Rothwell dpt_i2o depends on virt_to_bus Fujita, would you please take a look at this? He won't have seen this. cc's added. I think that something's broken in there, leading to the dpt_i2o sending out blocks of zeroes right after initialization, at least on some specific controllers (in this case, Adaptec 2010S on Intel SE7501WV2S-based boxes). I don't have insight kernel driver development knowledge, so I'm quite out of help right now. Nevertheless, I'll add the diff from 2.6.22 to 2.6.23-rc1 in terms of dpt_i2o: Can you please confirm that this revert (against 2.6.24-rc4) fixes the data corruption problems? Anders said that my patch is fine and seems that Matthew's hotplug conversion patch leads to the problem: http://marc.info/?l=linux-kernelm=119641892129732w=2 Oh. Jan broke message threading :( So it's been nearly a week and nothing has happened? Do we revert that change? SCSI people really want this conversion... Matthew, did you have a chance to look at it? - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE usr PATCH] Don't deliver BLS frames to the fast path.
Don't deliver BLS frames to the fast path. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- usr/common/libfc/src/fc/fc_local_port.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/usr/common/libfc/src/fc/fc_local_port.c b/usr/common/libfc/src/fc/fc_local_port.c index ba909d0..a798765 100644 --- a/usr/common/libfc/src/fc/fc_local_port.c +++ b/usr/common/libfc/src/fc/fc_local_port.c @@ -1611,7 +1611,8 @@ void fc_local_port_recv(struct fc_local_port *lp, struct fc_frame *fp) /* fall through */ case FC_EOF_N: mp = lp-fl_vf-vf_exch_mgr; - if ((f_ctl (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX) { + if ((f_ctl (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX + fh-fh_type != FC_TYPE_BLS) { fc_exch_recv_seq_resp(mp, fp); } else if (f_ctl FC_FC_SEQ_CTX) { fc_exch_recv_resp(mp, fp); - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE usr PATCH] Change the default FCoE protocol version to the T11 standard-track one.
Change the default FCoE protocol version to the T11 standard-track one. The old version can still be selected using 'fcconf ethX fcoe_version old'. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- usr/ofc/tools/fcconf/src/fcc_adapt.c |1 + usr/ofc/tools/fcconf/src/fcc_eth.c |1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/usr/ofc/tools/fcconf/src/fcc_adapt.c b/usr/ofc/tools/fcconf/src/fcc_adapt.c index eca2d1d..e0fae76 100644 --- a/usr/ofc/tools/fcconf/src/fcc_adapt.c +++ b/usr/ofc/tools/fcconf/src/fcc_adapt.c @@ -335,6 +335,7 @@ fcc_adapt_hba_get(void) snprintf(pp-fp_name, sizeof (pp-fp_name), %s, pp-fp_attr.OSDeviceName); pp-fp_fcoe = 1; +pp-fp_fcoe_t11 = 1; } else { if (strstr(ap-fa_attr.Manufacturer, QLogic) != NULL) { pp-fp_fid_alt_format = 1; diff --git a/usr/ofc/tools/fcconf/src/fcc_eth.c b/usr/ofc/tools/fcconf/src/fcc_eth.c index f1d4bf9..863a4ba 100644 --- a/usr/ofc/tools/fcconf/src/fcc_eth.c +++ b/usr/ofc/tools/fcconf/src/fcc_eth.c @@ -231,6 +231,7 @@ fcc_eth_init_dev(struct dirent *dp, void *arg) } pp-fp_fcoe = 1; +pp-fp_fcoe_t11 = 1; snprintf(ap-fa_attr.Model, sizeof (ap-fa_attr.Model), %s, FCC_FCOE_ADAPT_MODEL); ap-fa_attr.NodeWWN = pp-fp_attr.NodeWWN; - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[OpenFCoE usr PATCH] Change the default FCoE protocol version to the T11 (Aug. 2007) version.
Change the default FCoE protocol version to the T11 (Aug. 2007) version. Use environment to override: export FCOE_OLD_ALL=1 to use the old protocol on all interfaces, or FCOE_OLD_eth0=1 to use it on eth0. Signed-off-by: Joe Eykholt [EMAIL PROTECTED] --- usr/common/libfc/src/encaps/fcoe.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/usr/common/libfc/src/encaps/fcoe.c b/usr/common/libfc/src/encaps/fcoe.c index 017e41e..4a0d9f0 100644 --- a/usr/common/libfc/src/encaps/fcoe.c +++ b/usr/common/libfc/src/encaps/fcoe.c @@ -60,8 +60,8 @@ #define FCOE_ET_VAR FCOE_ETHERTYPE/* env. var. for ethertype */ #define FCOE_OUI_VARFCOE_OUI /* env. var. for OUI */ -#define FCOE_NEW_VARFCOE_NEW_%s /* env. var. for new version */ -#define FCOE_NEW_ALL_VAR FCOE_NEW_ALL /* env. var. for new version */ +#define FCOE_OLD_VARFCOE_OLD_%s /* env. var. for old version */ +#define FCOE_OLD_ALL_VAR FCOE_OLD_ALL /* env. var. for old version */ #define FC_FCOE_BUFLEN 2200/* buffer size for reads */ #define FC_FCOE_SOCKBUF_LEN (512 * 1024) /* requested receive socket buf size */ @@ -158,11 +158,11 @@ fc_fcoe_create(const char *ifname, u_int vlan, charbuf[40]; /* - * Test for presense of env. variables FCOE_NEW_ifname or FCOE_NEW. - * If these are not there, the older version is used. + * Test for presense of env. variables FCOE_OLD_ifname or FCOE_OLD_ALL. + * If any of these are there, the older protocol version is used. */ -snprintf(buf, sizeof (buf), FCOE_NEW_VAR, ifname); -if ((getenv(buf) == NULL getenv(FCOE_NEW_ALL_VAR) == NULL) || +snprintf(buf, sizeof (buf), FCOE_OLD_VAR, ifname); +if (getenv(buf) != NULL || getenv(FCOE_OLD_ALL_VAR) != NULL || (options FC_OPT_FCOE_OLD) != 0) { return (fc_fcoe_create_old(ifname, vlan, src_mac, dest_mac, options)); } - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: broken dpt_i2o in 2.6.23 (was: ext2_check_page: bad entry in directory)
On Wed, 05 Dec 2007 10:30:54 +0900 FUJITA Tomonori [EMAIL PROTECTED] wrote: On Tue, 4 Dec 2007 17:11:55 -0800 Andrew Morton [EMAIL PROTECTED] wrote: On Wed, 05 Dec 2007 10:04:03 +0900 FUJITA Tomonori [EMAIL PROTECTED] wrote: On Tue, 4 Dec 2007 16:57:38 -0800 Andrew Morton [EMAIL PROTECTED] wrote: On Thu, 29 Nov 2007 13:31:50 +0100 Anders Henke [EMAIL PROTECTED] wrote: On November 28 2007, Anders Henke wrote: As everything is reported as being zero is quite odd an Jan took a guess that it might be block-layer or driver-related, I've assumed that the driver is responsible for this; just out of the curiousity, I've manually replaced the dpt_i2o driver by the 2.6.19 one by copying driver/scsi/dpt_i2o.c driver/scsi/dpti.h and driver/scsi/dpt/ into a vanilla 2.6.23.1. kernel; using this kernel fixed the issue for me. I haven't yet fine-tested from which kernel release on the dpt_i2o driver behaves like this and spews out zeroed blocks when trying to mount the rootfs. Maybe this is just some timing issue. I've started the fine-tests and can say so far that dpt_i2o from 2.6.22 is still fine. Test is simple: [EMAIL PROTECTED]:/usr/src/linux-2.6.22/drivers/scsi/dpt$ cp -r dpt/ dpt_i2o.c dpti.h /usr/src/linux-2.6.23.1/drivers/scsi/ ... recompile the kernel, reboot: works. 2.6.22 and 2.6.23 differ in terms of the dpt_i2o driver by two different patch sets: -one 2 Kb small set of patches from 2.6.22 to 2.6.22-rc1 -one 7 Kb set of patches from 2.6.23-rc2 to 2.6.23-rc3 -one 162 Kb set of patches from 2.6.23-rc9 to 2.6.23-rc10. When applying the 2.6.23-rc1-based driver to my 2.6.31.1 kernel, the zero blocks-symptom show up, so it's the lucky situation that the smallest patch actually seams to be the broken one. According to the 2.6.23-rc1 short-form changelog, there is one major edit on the dpt_i2o driver: FUJITA Tomonori [SCSI] dpt_i2o: convert to use the data buffer accessors Stephen Rothwell dpt_i2o depends on virt_to_bus Fujita, would you please take a look at this? He won't have seen this. cc's added. I think that something's broken in there, leading to the dpt_i2o sending out blocks of zeroes right after initialization, at least on some specific controllers (in this case, Adaptec 2010S on Intel SE7501WV2S-based boxes). I don't have insight kernel driver development knowledge, so I'm quite out of help right now. Nevertheless, I'll add the diff from 2.6.22 to 2.6.23-rc1 in terms of dpt_i2o: Can you please confirm that this revert (against 2.6.24-rc4) fixes the data corruption problems? Anders said that my patch is fine and seems that Matthew's hotplug conversion patch leads to the problem: http://marc.info/?l=linux-kernelm=119641892129732w=2 Oh. Jan broke message threading :( So it's been nearly a week and nothing has happened? Do we revert that change? SCSI people really want this conversion... Matthew, did you have a chance to look at it? It seems pretty improbably that a change of that nature could cause data corruption. Anders, are you able to determine whether the revert (against current Linus mainline or 2.6.24-rc4) fixes things? Because it would be very strange... This is a grave bug. It's really quite urgent... Thanks. drivers/scsi/dpt_i2o.c | 132 ++- drivers/scsi/dpti.h|9 ++ 2 files changed, 68 insertions(+), 73 deletions(-) diff -puN drivers/scsi/dpt_i2o.c~revert-dpt_i2o-convert-to-scsi-hotplug-model drivers/scsi/dpt_i2o.c --- a/drivers/scsi/dpt_i2o.c~revert-dpt_i2o-convert-to-scsi-hotplug-model +++ a/drivers/scsi/dpt_i2o.c @@ -173,20 +173,20 @@ static struct pci_device_id dptids[] = { }; MODULE_DEVICE_TABLE(pci,dptids); -static void adpt_exit(void); - -static int adpt_detect(void) +static int adpt_detect(struct scsi_host_template* sht) { struct pci_dev *pDev = NULL; adpt_hba* pHba; + adpt_init(); + PINFO(Detecting Adaptec I2O RAID controllers...\n); /* search for all Adatpec I2O RAID cards */ while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { if(pDev-device == PCI_DPT_DEVICE_ID || pDev-device == PCI_DPT_RAPTOR_DEVICE_ID){ - if(adpt_install_hba(pDev) ){ + if(adpt_install_hba(sht, pDev) ){ PERROR(Could not Init an I2O RAID device\n); PERROR(Will not try to detect others.\n); return hba_count-1; @@ -248,33 +248,34 @@ rebuild_sys_tab: } for (pHba = hba_chain; pHba;
[patch 10/18] sg: nopage
Convert SG from nopage to fault. Signed-off-by: Nick Piggin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: linux-scsi@vger.kernel.org Cc: [EMAIL PROTECTED] --- drivers/scsi/sg.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) Index: linux-2.6/drivers/scsi/sg.c === --- linux-2.6.orig/drivers/scsi/sg.c +++ linux-2.6/drivers/scsi/sg.c @@ -1144,23 +1144,22 @@ sg_fasync(int fd, struct file *filp, int return (retval 0) ? retval : 0; } -static struct page * -sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type) +static int +sg_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { Sg_fd *sfp; - struct page *page = NOPAGE_SIGBUS; unsigned long offset, len, sa; Sg_scatter_hold *rsv_schp; struct scatterlist *sg; int k; if ((NULL == vma) || (!(sfp = (Sg_fd *) vma-vm_private_data))) - return page; + return VM_FAULT_SIGBUS; rsv_schp = sfp-reserve; - offset = addr - vma-vm_start; + offset = vmf-pgoff PAGE_SHIFT; if (offset = rsv_schp-bufflen) - return page; - SCSI_LOG_TIMEOUT(3, printk(sg_vma_nopage: offset=%lu, scatg=%d\n, + return VM_FAULT_SIGBUS; + SCSI_LOG_TIMEOUT(3, printk(sg_vma_fault: offset=%lu, scatg=%d\n, offset, rsv_schp-k_use_sg)); sg = rsv_schp-buffer; sa = vma-vm_start; @@ -1169,21 +1168,21 @@ sg_vma_nopage(struct vm_area_struct *vma len = vma-vm_end - sa; len = (len sg-length) ? len : sg-length; if (offset len) { + struct page *page; page = virt_to_page(page_address(sg_page(sg)) + offset); get_page(page); /* increment page count */ - break; + vmf-page = page; + return 0; /* success */ } sa += len; offset -= len; } - if (type) - *type = VM_FAULT_MINOR; - return page; + return VM_FAULT_SIGBUS; } static struct vm_operations_struct sg_mmap_vm_ops = { - .nopage = sg_vma_nopage, + .fault = sg_vma_fault, }; static int -- - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html