From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754505Ab2I1HNp (ORCPT ); Fri, 28 Sep 2012 03:13:45 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:42222 "EHLO e23smtp08.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753709Ab2I1HNn (ORCPT ); Fri, 28 Sep 2012 03:13:43 -0400 Message-ID: <1348816410.2419.14.camel@ThinkPad-T420> Subject: Re: [PATCH scsi] Short the path length of scsi_cmd_to_driver() From: Li Zhong To: "Martin K. Petersen" Cc: James Bottomley , LKML , linux-scsi@vger.kernel.org, "Paul E. McKenney" Date: Fri, 28 Sep 2012 15:13:30 +0800 In-Reply-To: References: <1348464626.2475.13.camel@ThinkPad-T420> <1348465493.2467.3.camel@dabdike> <1348470210.2475.47.camel@ThinkPad-T420> <1348472104.2467.8.camel@dabdike> <1348721055.2509.0.camel@dabdike> <1348739495.3596.55.camel@ThinkPad-T420> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 x-cbid: 12092807-5140-0000-0000-00000223372B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2012-09-27 at 13:43 -0400, Martin K. Petersen wrote: > >>>>> "Li" == Li Zhong writes: > > > @@ -845,8 +844,11 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, > > > > scsi_eh_restore_cmnd(scmd, &ses); > > > >- if (sdrv && sdrv->eh_action) > >- rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); > >+ if (scmd->request->cmd_type == REQ_TYPE_FS) { > >+ struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); > >+ if (sdrv->eh_action) > >+ rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); > >+ } > > > > return rtn; > > } > > My only concern is whether our device lifetime rules guarantee that the > ULD is always attached when we service an error handling command? Thank you, Martin, for the review. I don't know much about scsi, it might take me some more time to have an answer to the above question. For now, if I understand correctly, maybe we could only do the not-consistent behaviours bug fix? Or could we provide two versions of scsi_cmd_to_driver(), one with NULL checking for scsi_send_eh_cmnd(), one without the checking for scsi_finish_command()? Thanks, Zhong