linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Niels de Vos <ndevos@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Bryn M. Reeves" <bmr@redhat.com>,
	Mikulas Patocka <mpatocka@redhat.com>
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	[thread overview]
Message-ID: <x49ehuq9oeg.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <1327315109-7740-1-git-send-email-ndevos@redhat.com> (Niels de Vos's message of "Mon, 23 Jan 2012 10:38:29 +0000")

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>

  parent reply	other threads:[~2012-01-23 20:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20  1:58 [PATCH] block: Invalidate the cache for a parent block-device Mikulas Patocka
2012-01-20  9:35 ` Niels de Vos
2012-01-23 10:38   ` [PATCH v2] fs: Invalidate the cache for a parent block-device if fsync() is called for a partition Niels de Vos
2012-01-23 16:27     ` Jeff Moyer
2012-01-23 16:46       ` Niels de Vos
2012-01-23 19:23     ` Mikulas Patocka
2012-01-23 20:04     ` Jeff Moyer [this message]
2012-01-26 10:03     ` Andrew Morton
2012-01-26 11:50       ` Niels de Vos
2012-01-26 13:33         ` [PATCH v3] " Niels de Vos
2012-01-26 21:40           ` Andrew Morton
2012-01-26 21:45             ` Christoph Hellwig
2012-01-26 21:50               ` Mikulas Patocka
2012-01-27 12:19                 ` Ric Wheeler
2012-01-31 16:00               ` Niels de Vos
2012-01-31 18:58                 ` Andrew Morton
2012-01-31 19:04                   ` Christoph Hellwig
2012-01-31 19:32                     ` Andrew Morton
2012-01-31 19:37                       ` Christoph Hellwig
2012-01-31 19:48                         ` Andrew Morton
2012-01-26 21:49             ` Jeff Moyer
2012-01-26 22:13             ` Mikulas Patocka
2012-01-26 22:26               ` Kernel Oops report (Android gingerbread) Fan Zhang

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=x49ehuq9oeg.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=bmr@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=ndevos@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).