Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088Ab3FZJVF (ORCPT ); Wed, 26 Jun 2013 05:21:05 -0400 Received: from juliette.telenet-ops.be ([195.130.137.74]:35619 "EHLO juliette.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751408Ab3FZJVB (ORCPT ); Wed, 26 Jun 2013 05:21:01 -0400 Message-ID: <51CAB27A.3080805@acm.org> Date: Wed, 26 Jun 2013 11:20:58 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Maxim Uvarov CC: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, JBottomley@parallels.com Subject: Re: [PATCH] scsi_prep_fn() check for empty queue References: <1372237363-5156-1-git-send-email-maxim.uvarov@oracle.com> In-Reply-To: <1372237363-5156-1-git-send-email-maxim.uvarov@oracle.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2518 Lines: 57 On 06/26/13 11:02, Maxim Uvarov wrote: > This fix: > end_request: I/O error, dev sdc, sector 976576 > rport-0:0-3: blocked FC remote port time out: removing target and saving > binding > BUG: unable to handle kernel NULL pointer dereference at 0000000000000400 > IP: [] scsi_prep_state_check+0xe/0x99 > [] scsi_setup_blk_pc_cmnd+0x1b/0x115 > [] scsi_prep_fn+0x29/0x3b > [] blk_peek_request+0xe1/0x1b3 > [] scsi_request_fn+0x3a/0x4d2 > [] __generic_unplug_device+0x32/0x36 > [] blk_execute_rq_nowait+0x77/0x9e > [] blk_execute_rq+0xa6/0xde > [] ? printk+0x41/0x46 > [] ? get_rdac_req+0x81/0xe8 [scsi_dh_rdac] > [] send_mode_select+0x29f/0x489 [scsi_dh_rdac] > [] ? probe_workqueue_execution+0xb1/0xce > [] worker_thread+0x1a9/0x237 > [] ? send_mode_select+0x0/0x489 [scsi_dh_rdac] > [] ? autoremove_wake_function+0x0/0x39 > [] ? worker_thread+0x0/0x237 > [] kthread+0x7f/0x87 > [] child_rip+0xa/0x20 > [] ? kthread+0x0/0x87 > [] ? child_rip+0x0/0x20 > Signed-off-by: Maxim Uvarov > --- > drivers/scsi/scsi_lib.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 86d5220..8e89ed9 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -1295,6 +1295,9 @@ int scsi_prep_fn(struct request_queue *q, struct request *req) > struct scsi_device *sdev = q->queuedata; > int ret = BLKPREP_KILL; > > + if (!sdev) > + return ret; > + > if (req->cmd_type == REQ_TYPE_BLOCK_PC) > ret = scsi_setup_blk_pc_cmnd(sdev, req); > return scsi_prep_return(q, req, ret); Sorry but this patch does not look like a proper fix to me. What you probably need is a scsi_device_get() call in scsi_dh_rdac.c somewhere before the queue_work(kmpath_rdacd, &ctlr->ms_work) call and a scsi_device_put() call once send_mode_select() has finished using the sdev. Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/