[SCSI] libiscsi: regression: fix header digest errors

This fixes a regression introduced with this commit:

commit d3305f3407fa3e9452079ec6cc8379067456e4aa
Author: Mike Christie <michaelc@cs.wisc.edu>
Date: Thu Aug 20 15:10:58 2009 -0500

[SCSI] libiscsi: don't increment cmdsn if cmd is not sent

in 2.6.32.

When I moved the hdr->cmdsn after init_task, I added
a bug when header digests are used. The problem is
that the LLD may calculate the header digest in init_task,
so if we then set the cmdsn after the init_task call we
change what the digest will be calculated by the target.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by Mike Christie and committed by James Bottomley 96b1f96d 70b25f89

+1 -1
+1 -1
drivers/scsi/libiscsi.c
··· 471 471 472 472 WARN_ON(hdrlength >= 256); 473 473 hdr->hlength = hdrlength & 0xFF; 474 + hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn); 474 475 475 476 if (session->tt->init_task && session->tt->init_task(task)) 476 477 return -EIO; 477 478 478 479 task->state = ISCSI_TASK_RUNNING; 479 - hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn); 480 480 session->cmdsn++; 481 481 482 482 conn->scsicmd_pdus_cnt++;