From: Nicholas Krause <xerofoify@gmail.com>
To: jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH] f2fs:Fix error handling for calls to the function add_free_nid in the file node.c
Date: Sat, 8 Aug 2015 18:22:20 -0400 [thread overview]
Message-ID: <1439072540-25569-1-git-send-email-xerofoify@gmail.com> (raw)
This fixes error handling for calls to the function add_free_nid
in the functions __flush_nat_entry_set and build_free_nids to
properly check if their call to this particular function return
a error code and if so break out these function's for loops as
we cannot continue these loops if these function calls fail in
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
fs/f2fs/node.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 7dd63b7..1a3fb57 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1545,8 +1545,10 @@ static void build_free_nids(struct f2fs_sb_info *sbi)
for (i = 0; i < nats_in_cursum(sum); i++) {
block_t addr = le32_to_cpu(nat_in_journal(sum, i).block_addr);
nid = le32_to_cpu(nid_in_journal(sum, i));
- if (addr == NULL_ADDR)
- add_free_nid(sbi, nid, true);
+ if (addr == NULL_ADDR) {
+ if (add_free_nid(sbi, nid, true) < 0)
+ break;
+ }
else
remove_free_nid(nm_i, nid);
}
@@ -1879,8 +1881,10 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
__clear_nat_cache_dirty(NM_I(sbi), ne);
up_write(&NM_I(sbi)->nat_tree_lock);
- if (nat_get_blkaddr(ne) == NULL_ADDR)
- add_free_nid(sbi, nid, false);
+ if (nat_get_blkaddr(ne) == NULL_ADDR) {
+ if (add_free_nid(sbi, nid, false) < 0)
+ break;
+ }
}
if (to_journal)
--
2.1.4
------------------------------------------------------------------------------
reply other threads:[~2015-08-08 22:22 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=1439072540-25569-1-git-send-email-xerofoify@gmail.com \
--to=xerofoify@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--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 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).