Re: [PATCH] block: correctly fallback for zeroout
From: Shaohua Li
Date: Thu Jun 02 2016 - 12:59:21 EST
On Sat, May 28, 2016 at 10:27:55AM +0100, Sitsofe Wheeler wrote:
> On Sat, May 28, 2016 at 08:55:43AM +0000, Sitsofe Wheeler wrote:
> > On Thu, May 26, 2016 at 11:08:14AM -0700, Shaohua Li wrote:
> > > blkdev_issue_zeroout try discard/writesame first, if they fail, zeroout
> > > fallback to regular write. The problem is discard/writesame doesn't
> > > return error for -EOPNOTSUPP, then zeroout can't do fallback and leave
> > > disk data not changed. zeroout should have guaranteed zero-fill
> > > behavior.
> >
> > It sounds like at least this patch should go in so BLKZEROOUT can always
> > fall back (since those zeros are essential) but it would still be nice
> > to see the disabling of write same being copied up to md device's
> > write_same_max_bytes so everyone knows not to try using it in the future
> > but perhaps someone will say "what if I re-enable it on the device
> > below?" etc.
>
> I've tested Shaohua's original patch on top of Linus' tree and even
> without the suggested changes (above and below) it at least resolves the
> success being returned but data not being zeroed (with both PVSCSI and
> scsi_debug underlying devices) issue so:
>
> Tested-by: Sitsofe Wheeler <sitsofe@xxxxxxxxx>
Jens,
any chance you could merge this one? I'll fix the MD part later and make sure
write_same_max_bytes sets to 0 after IO failure.
Thanks,
Shaohua