All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Jens Axboe <axboe@suse.de>
Subject: [patch] Fix file-corrupting bug, kernels 2.5.41 to 2.5.44
Date: Sun, 27 Oct 2002 20:11:48 -0800	[thread overview]
Message-ID: <3DBCB904.FA9CC188@digeo.com> (raw)



This patch fixes a filesystem corrupting bug, present in 2.5.41 through
2.5.44.  It can cause ext2 indirect blocks to not be written out.  A
fsck will fix it up.

Under heavy memory pressure a PF_MEMALLOC task attemtps to write out a
blockdev page whose buffers are already under writeback and which were
dirtied while under writeback.

The writepage call returns -EAGAIN but because the caller is
PF_MEMALLOC, the page was not being marked dirty again.

The page sits on mapping->clean_pages for ever and it not written out.

The fix is to mark that page dirty again for all callers, regardless of
PF_MEMALLOC state.



 fs/mpage.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

--- 25/fs/mpage.c~set_page_dirty-pf_memalloc	Sun Oct 27 19:22:44 2002
+++ 25-akpm/fs/mpage.c	Sun Oct 27 19:24:18 2002
@@ -591,6 +591,10 @@ mpage_writepages(struct address_space *m
 					test_clear_page_dirty(page)) {
 			if (writepage) {
 				ret = (*writepage)(page);
+				if (ret == -EAGAIN) {
+					__set_page_dirty_nobuffers(page);
+					ret = 0;
+				}
 			} else {
 				bio = mpage_writepage(bio, page, get_block,
 						&last_block_in_bio, &ret);
@@ -601,10 +605,6 @@ mpage_writepages(struct address_space *m
 					pagevec_deactivate_inactive(&pvec);
 				page = NULL;
 			}
-			if (ret == -EAGAIN && page) {
-				__set_page_dirty_nobuffers(page);
-				ret = 0;
-			}
 			if (ret || (--(wbc->nr_to_write) <= 0))
 				done = 1;
 			if (wbc->nonblocking && bdi_write_congested(bdi)) {

.

             reply	other threads:[~2002-10-28  4:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-28  4:11 Andrew Morton [this message]
2002-10-28 11:04 ` [patch] Fix file-corrupting bug, kernels 2.5.41 to 2.5.44 Jens Axboe

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=3DBCB904.FA9CC188@digeo.com \
    --to=akpm@digeo.com \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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.