All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@openvz.org>
To: Andrew Morton <akpm@osdl.org>,
	sct@redhat.com, linux-kernel@vger.kernel.org, saw@sw.ru,
	adilger@clusterfs.com, devel@openvz.org
Subject: [PATCH] ext3: small fix for previous retries patch in ext3_prepare_write()
Date: Tue, 28 Nov 2006 19:29:47 +0300	[thread overview]
Message-ID: <456C63FB.40604@openvz.org> (raw)

Patch from Dmitry Monakhov:
Previous fix for retries in ext3_prepare_write() violation
was a bit errorneuos:
- it missed return of error code from ext3_journal_stop()
- it missed do_journal_get_write_access() before commit_write

a few comments added also.

Signed-Off-By: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-Off-By: Kirill Korotaev <dev@openvz.org>


diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index a48ada9..1acb528 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1162,13 +1162,14 @@ static int ext3_prepare_failure(struct f
 	struct buffer_head *bh, *head, *next;
 	unsigned block_start, block_end;
 	unsigned blocksize;
+	int ret;
+	handle_t *handle = ext3_journal_current_handle();
 
 	mapping = page->mapping;
 	if (ext3_should_writeback_data(mapping->host)) {
 		/* optimization: no constraints about data */
 skip:
-		ext3_journal_stop(ext3_journal_current_handle());
-		return 0;
+		return ext3_journal_stop(handle);
 	}
 
 	head = page_buffers(page);
@@ -1186,7 +1187,19 @@ skip:
 			break;
 		}
 		if (!buffer_mapped(bh))
+		/* prepare_write failed on this bh */
 			break;
+		if (ext3_should_journal_data(mapping->host)) {
+			ret = do_journal_get_write_access(handle, bh);
+			if (ret) {
+				ext3_journal_stop(handle);
+				return ret;
+			}
+		}
+	/*
+	 * block_start here becomes the first block where the current iteration
+	 * of prepare_write failed.
+	 */
 	}
 	if (block_start <= from)
 		goto skip;

                 reply	other threads:[~2006-11-28 16:21 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=456C63FB.40604@openvz.org \
    --to=dev@openvz.org \
    --cc=adilger@clusterfs.com \
    --cc=akpm@osdl.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=saw@sw.ru \
    --cc=sct@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.