linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21@cam.ac.uk>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: fsdevel <linux-fsdevel@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: Bug in error recovery in fs/buffer.c::__block_prepare_write()
Date: Fri, 10 Jun 2005 14:05:15 +0100	[thread overview]
Message-ID: <1118408715.31710.62.camel@imp.csi.cam.ac.uk> (raw)
In-Reply-To: <1118408464.31710.54.camel@imp.csi.cam.ac.uk>

Here is the second patch (patch B).

On Fri, 2005-06-10 at 14:01 +0100, Anton Altaparmakov wrote:
[snip]
> B) If we cannot safely allow buffer_new buffers to "leak out" of
> __block_prepare_write(), then we simply would need to run a quick loop
> over the buffers clearing buffer_new on each of them if it is set just
> before returning "success" to the caller of __block_prepare_write().
[snip]

The patch for this is simple, too (it is below).

> Andrew/Linus, I would suggest that you apply at least A and perhaps B if
> you deem it necessary or want to be on the safe side.
> 
> Having had a look at the code it would seem perfectly safe to leave
> buffer_new() set and ignore patch B but I may be wrong which is why I
> did both.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

Best regards,

        Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

--- linux-2.6.git/fs/buffer.c.old2	2005-06-10 13:35:03.000000000 +0100
+++ linux-2.6.git/fs/buffer.c	2005-06-10 13:38:14.000000000 +0100
@@ -1992,9 +1992,14 @@ static int __block_prepare_write(struct 
 		if (!buffer_uptodate(*wait_bh))
 			err = -EIO;
 	}
-	if (!err)
+	if (!err) {
+		bh = head;
+		do {
+			if (buffer_new(bh))
+				clear_buffer_new(bh);
+		} while ((bh = bh->b_this_page) != head);
 		return err;
-
+	}
 	/* Error case: */
 	/*
 	 * Zero out any newly allocated blocks to avoid exposing stale



  reply	other threads:[~2005-06-10 13:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-10 13:01 Bug in error recovery in fs/buffer.c::__block_prepare_write() Anton Altaparmakov
2005-06-10 13:05 ` Anton Altaparmakov [this message]
2005-06-10 14:15   ` Anton Altaparmakov

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=1118408715.31710.62.camel@imp.csi.cam.ac.uk \
    --to=aia21@cam.ac.uk \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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).