Re: BLKZEROOUT + pread should return zeroes, right?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 13, 2014 at 08:01:32PM -0700, Darrick J. Wong wrote:
> Hi everyone,
> 
> What's the intended behavior if I issue BLKZEROOUT against a range of disk
> sectors and immediately re-read the sectors into a buffer?

Should return zeros.

[...]

> I boiled the whole thing down into the attached test program, which can
> reproduce the symptoms in a few loop iterations.  If I insert "sleep(1);"
> before the pread64, I pread zeroes every time; otherwise, I only pread zeroes
> part of the time.  If I call "ioctl(fd, BLKFLSBUF);" before the BLKZEROOUT, the
> chances of preading zeroes increases dramatically, but is still not 100%.

Hint #1: buffered IO == data in page cache.
Hint #2: BLKZEROOUT operates at the bio level.

> So, uh, is this a bug?  Or is that just how BLKZEROOUT works?  Or did I fubar
> the ioctl call?

Broken usage, IMO. If you are going to use the block layer ioctls to
manipulate data int eh block device, you should be using direct Io
for all your data IO to the block device. Otherwise, coherency
problems occur....

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux