Messages in this thread | | | From | Jeff Moyer <> | Subject | Re: [PATCH v2] fs: Invalidate the cache for a parent block-device if fsync() is called for a partition | Date | Mon, 23 Jan 2012 15:04:07 -0500 |
| |
Niels de Vos <ndevos@redhat.com> writes:
> Executing an fsync() on a file-descriptor of a partition flushes the > caches for that partition by calling blkdev_issue_flush(). However, it > seems that reading data through the parent device will still return the > old cached data.
You are mixing up two different caches. blkdev_issue_flush flushes the hard disk's cache, if it exists, and is advertised as a write-back cache. The cache that doesn't get flushed is the page cache, since you are accessing the same disk blocks via different devices (the whole device and the partition).
Nevertheless, the fix looks fine to me. There shouldn't be much cached for the whole block device if there are partitions, so this shouldn't generate an I/O storm or flush out buffers that are otherwise useful.
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
| |