public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: Anil kumar <anils_r@yahoo.com>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: scsi_cmnd data_buffer checksum
Date: Thu, 9 Sep 2010 10:00:28 +0200	[thread overview]
Message-ID: <20100909080028.GA4880@schmichrtp.mainz.de.ibm.com> (raw)
In-Reply-To: <35352.83946.qm@web32402.mail.mud.yahoo.com>

On Wed, Sep 08, 2010 at 08:36:32PM -0700, Anil kumar wrote:
> 
> I am writing a checksum calculation of scsi_cmnd data buffer in the driver. 
> 
> I calculate the checksum of the scsi_cmd data buffer(request_buffer) in driver queuecommand.
> 
> Now when the command is completed from the hardware and before driver sends it back to mid-layer, I calculate the checksum again of the same scsi_cmd data_buffer again.
> 
> Sometimes the checksums don't match. I mean somehow looks like OS changed the scsi_cmd data_buffer(request_buffer) in the meantime when driver is working on the command.
> I print the address of the scsi_cmd data_buffer (virtual address) and its same and the contents of the buffer is also same during both the calculations.
> 
> Can this happen?

Yes. While a write I/O is being processed in Linux or in flight, the
data buffers can change. This causes problems for other checksums as
well; i ran into this when looking at the DIF/DIX checksums for SCSI
commands.

At the moment, this problem can be avoided e.g. by running only direct
I/O on the xfs filesystem. There have been discussions about this, a
short summary is here, look for "stable pages":
http://lwn.net/Articles/399148/

Christof

  reply	other threads:[~2010-09-09  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-09  3:36 scsi_cmnd data_buffer checksum Anil kumar
2010-09-09  8:00 ` Christof Schmitt [this message]
2010-09-09  8:35   ` Anil kumar
2010-09-09  8:51     ` Christof Schmitt
2010-09-09  9:09       ` Anil kumar
2010-09-09  9:29         ` Christof Schmitt
2010-09-09 13:23         ` Martin K. Petersen
2010-09-09 19:34           ` Anil kumar
2010-09-10  3:33             ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100909080028.GA4880@schmichrtp.mainz.de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=anils_r@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox