linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Wright <timw@splhi.com>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH] Forward port of 2.4 fsync_buffers_list() fix.
Date: 14 Oct 2002 17:01:20 -0700	[thread overview]
Message-ID: <1034640080.2017.33.camel@kryten.internal.splhi.com> (raw)

Hi,
there was a bug in fysnc_buffers_list() in 2.4 (fixed in 2.4.19) that
could cause the function to return without having written the current
contents of all the buffers. Obviously, this could be bad for anybody
relying on ordering using O_SYNC or fsync(). If an I/O was already in
flight for a particular bh at the time of the call to
fsync_buffers_list(), ll_rw_block() will not initiate a new I/O even
though the contents may have changed. It is therefore necessary to wait
before the call. Here's a patch against 2.5.42 that applies the same
fix.

Regards,

Tim

--- linux-2.5.42/fs/buffer.c	Mon Oct 14 16:38:53 2002
+++ linux/fs/buffer.c	Mon Oct 14 16:51:54 2002
@@ -812,6 +812,13 @@
 			if (buffer_dirty(bh)) {
 				get_bh(bh);
 				spin_unlock(lock);
+				/*
+				 * Ensure any pending I/O completes so that
+				 * ll_rw_block() actually writes the current
+				 * contents - it is a noop if I/O is still in
+				 * flight on potentially older contents.
+				 */
+				wait_on_buffer(bh);
 				ll_rw_block(WRITE, 1, &bh);
 				brelse(bh);
 				spin_lock(lock);


                 reply	other threads:[~2002-10-14 23:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1034640080.2017.33.camel@kryten.internal.splhi.com \
    --to=timw@splhi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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).