Re: [Question] why not flush device cache at _vg_commit_raw
Heming Zhao <[email protected]> Thu, 25 Jan 2024 07:17:51 +0800
| Newsgroups | dev.linux.lists.linux-lvm |
|---|---|
| Message-ID | <[email protected]> |
On 1/24/24 21:13, Anthony Iliopoulos wrote: > On Wed, Jan 24, 2024 at 01:35:49PM +0100, Zdenek Kabelac wrote: >> I guess our dev_flush() function is mostly handling all those cases properly >> with the use of ioctl(BLKFLSBUF). > > This ioctl by itself will only flush the page cache and not device > caches, but it is indeed followed by a fsync on the blockdev which is > basically the only way for userspace to trigger a device cache flush > when operating directly on a block device. > >> The only problem is - it's usage somehow vanished - and even in the past >> it's been basically used only for non-direct usage so likely still not >> correct. > > Indeed, the device cache flushing is required for data integrity > irrespective of the io mode (unless O_DSYNC/RWF_DSYNC), direct-io only > obviates the need for flushing the page cache. > In my view, vg_commit() is a good place to call dev_flush(). This could only affect (important) metadata IOs, make all write IOs to persistent storage ASAP. Thanks, Heming