All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	axboe@fb.com, shli@fb.com, snitzer@redhat.com, sitsofe@yahoo.com,
	linux-block@vger.kernel.org
Subject: Re: [PATCH] block: introduce BLKDEV_DISCARD_ZERO to fix zeroout
Date: Wed, 22 Jun 2016 09:52:17 +0200	[thread overview]
Message-ID: <20160622075217.GA31610@lst.de> (raw)
In-Reply-To: <yq1shw62d7h.fsf@sermon.lab.mkp.net>

On Tue, Jun 21, 2016 at 10:02:10PM -0400, Martin K. Petersen wrote:
> In 9082e87bfbf8 ("block: remove struct bio_batch") you changed the error
> return for blkdev_issue_write_same() to look like the one for discard:
> 
> -	if (bb.error)
> -		return bb.error;
> -	return ret;
> +	if (bio)
> +		ret = submit_bio_wait(REQ_WRITE | REQ_WRITE_SAME, bio);
> +	return ret != -EOPNOTSUPP ? ret : 0;
> 
> It's not a problem for SCSI since I'd be returning -EREMOTEIO. But if a
> stacking driver returns -EOPNOTSUPP in response to a WRITE SAME request
> we'll get data corruption.

Oh, I see what you mean, but I disagree with the analysis.  Unlike
discard outside the zeroout path, write same is a data integrity operation.
Just like in the zero out case turning an EOPNOTSUPP into 0 will get you
data corruption, as the caller will see a successful return for an
operation that did not actually write data to disk.  Same is true for
writing the actual zeroes in __blkdev_issue_zeroout.

Re stacking drivers and discard / write same:  why does
blk_set_stacking_limits set discard_zeroes_data to 1 and
max_write_same_sectors to UINT_MAX?  These seem like inherently dangerous
defaults.

  reply	other threads:[~2016-06-22  7:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 10:28 [PATCH] block: introduce BLKDEV_DISCARD_ZERO to fix zeroout Christoph Hellwig
2016-06-20 18:29 ` Jeff Moyer
2016-06-21 12:39   ` Christoph Hellwig
2016-06-21 14:02     ` Jeff Moyer
2016-06-21  0:44 ` Martin K. Petersen
2016-06-21 12:40   ` Christoph Hellwig
2016-06-22  2:02     ` Martin K. Petersen
2016-06-22  7:52       ` Christoph Hellwig [this message]
2016-06-22 13:53         ` Martin K. Petersen
2016-06-22 14:04           ` Christoph Hellwig

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=20160622075217.GA31610@lst.de \
    --to=hch@lst.de \
    --cc=axboe@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=shli@fb.com \
    --cc=sitsofe@yahoo.com \
    --cc=snitzer@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.