From: Aditya Kali <adityakali@google.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Aditya Kali <adityakali@google.com>
Subject: [PATCH] Adding error check for ext4_mb_regular_allocator call.
Date: Thu, 5 Aug 2010 11:34:08 -0700 [thread overview]
Message-ID: <1281033248-29627-1-git-send-email-adityakali@google.com> (raw)
If the bitmap block on disk is bad, the 'ext4_mb_load_buddy'
returns error. This error is returned to the caller
'ext4_mb_regular_allocator' and then to 'ext4_mb_new_blocks'. But
'ext4_mb_new_blocks' did not check for the return value of
'ext4_mb_regular_allocator' and would repeatedly try to load the
bitmap block. The fix simply catches the return value and exits out
of the 'repeat' loop after cleanup.
Signed-off-by: Aditya Kali <adityakali@google.com>
---
fs/ext4/mballoc.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 0e83dfd..f8e99b9 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4322,7 +4322,14 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
ext4_mb_normalize_request(ac, ar);
repeat:
/* allocate space in core */
- ext4_mb_regular_allocator(ac);
+ *errp = ext4_mb_regular_allocator(ac);
+ if (*errp) {
+ ext4_discard_allocated_blocks(ac);
+ ac->ac_b_ex.fe_len = 0;
+ ar->len = 0;
+ ext4_mb_show_ac(ac);
+ goto out4;
+ }
/* as we've just preallocated more space than
* user requested orinally, we store allocated
@@ -4363,6 +4370,7 @@ repeat:
ext4_mb_show_ac(ac);
}
+out4:
ext4_mb_release_context(ac);
out2:
--
1.7.1
next reply other threads:[~2010-08-05 18:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 18:34 Aditya Kali [this message]
2010-08-05 20:28 ` [PATCH] Adding error check for ext4_mb_regular_allocator call Ted Ts'o
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=1281033248-29627-1-git-send-email-adityakali@google.com \
--to=adityakali@google.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).