[PATCH 1/4] scsi: move initialization of scmd-eh_entry

2013-06-06 Thread Hannes Reinecke
The 'eh_entry' list might be used even before scsi_softirq_done()
is called. Hence we should rather initialize it together with
the other eh-related variables.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/scsi_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 86d5220..c1774de 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -317,6 +317,8 @@ static void scsi_init_cmd_errh(struct scsi_cmnd *cmd)
memset(cmd-sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
if (cmd-cmd_len == 0)
cmd-cmd_len = scsi_command_size(cmd-cmnd);
+   INIT_LIST_HEAD(cmd-eh_entry);
+   cmd-eh_eflags = 0;
 }
 
 void scsi_device_unbusy(struct scsi_device *sdev)
@@ -1482,8 +1484,6 @@ static void scsi_softirq_done(struct request *rq)
unsigned long wait_for = (cmd-allowed + 1) * rq-timeout;
int disposition;
 
-   INIT_LIST_HEAD(cmd-eh_entry);
-
atomic_inc(cmd-device-iodone_cnt);
if (cmd-result)
atomic_inc(cmd-device-ioerr_cnt);
-- 
1.7.12.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] scsi: move initialization of scmd-eh_entry

2013-06-06 Thread Jörn Engel
On Thu, 6 June 2013 11:43:52 +0200, Hannes Reinecke wrote:
 
 The 'eh_entry' list might be used even before scsi_softirq_done()
 is called. Hence we should rather initialize it together with
 the other eh-related variables.
 
 Signed-off-by: Hannes Reinecke h...@suse.de

Tested-by: Joern Engel jo...@logfs.org

Jörn

--
It is better to die of hunger having lived without grief and fear,
than to live with a troubled spirit amid abundance.
-- Epictetus
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] scsi: move initialization of scmd-eh_entry

2013-05-25 Thread Christoph Hellwig
On Fri, May 24, 2013 at 12:57:40PM -0400, J??rn Engel wrote:
  memset(cmd-sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
  if (cmd-cmd_len == 0)
  cmd-cmd_len = scsi_command_size(cmd-cmnd);
  +   INIT_LIST_HEAD(cmd-eh_entry);
  +   cmd-eh_eflags = 0;
 
 I always suspect something subtle going on when a variable is
 initialized to 0 three lines below a memset.  Can line this go away?

The memset only zeroes the sense_buffer, not the whole scsi command
which would cause a major havoc for the callers.

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] scsi: move initialization of scmd-eh_entry

2013-05-24 Thread Hannes Reinecke
The 'eh_entry' list might be used even before scsi_softirq_done()
is called. Hence we should rather initialize it together with
the other eh-related variables.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/scsi_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c31187d..a5515ec 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -318,6 +318,8 @@ static void scsi_init_cmd_errh(struct scsi_cmnd *cmd)
memset(cmd-sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
if (cmd-cmd_len == 0)
cmd-cmd_len = scsi_command_size(cmd-cmnd);
+   INIT_LIST_HEAD(cmd-eh_entry);
+   cmd-eh_eflags = 0;
 }
 
 void scsi_device_unbusy(struct scsi_device *sdev)
@@ -1483,8 +1485,6 @@ static void scsi_softirq_done(struct request *rq)
unsigned long wait_for = (cmd-allowed + 1) * rq-timeout;
int disposition;
 
-   INIT_LIST_HEAD(cmd-eh_entry);
-
atomic_inc(cmd-device-iodone_cnt);
if (cmd-result)
atomic_inc(cmd-device-ioerr_cnt);
-- 
1.7.12.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] scsi: move initialization of scmd-eh_entry

2013-05-24 Thread Jörn Engel
On Fri, 24 May 2013 11:50:47 +0200, Hannes Reinecke wrote:
 
 The 'eh_entry' list might be used even before scsi_softirq_done()
 is called. Hence we should rather initialize it together with
 the other eh-related variables.
 
 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
  drivers/scsi/scsi_lib.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
 index c31187d..a5515ec 100644
 --- a/drivers/scsi/scsi_lib.c
 +++ b/drivers/scsi/scsi_lib.c
 @@ -318,6 +318,8 @@ static void scsi_init_cmd_errh(struct scsi_cmnd *cmd)
   memset(cmd-sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
   if (cmd-cmd_len == 0)
   cmd-cmd_len = scsi_command_size(cmd-cmnd);
 + INIT_LIST_HEAD(cmd-eh_entry);
 + cmd-eh_eflags = 0;

I always suspect something subtle going on when a variable is
initialized to 0 three lines below a memset.  Can line this go away?

Jörn

--
Those who come seeking peace without a treaty are plotting.
-- Sun Tzu
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html