mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Fries <ccfries@gmail.com>
To: jaegeuk.kim@samsung.com, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, rknize2@motorola.com,
	jason.hrycay@motorola.com
Subject: [PATCH] f2fs: Remove BUG_ON in dec_valid_node_count
Date: Sun, 12 May 2013 22:46:27 -0500	[thread overview]
Message-ID: <51906213.2020005@gmail.com> (raw)

From: Chris Fries <C.Fries@motorola.com>

Panic loops while running LTP fsstress has been able to get
a disk into two different panic loops from dec_valid_node_count.
f2fs.h:714  BUG_ON(sbi->total_valid_node_count < count);

Once, it happens during recovery itself, and the disk would cause
a panic every time it mounted.

Another time, it would happen during garbage collection, so the disk
would cause a panic within 200 seconds of mounting.

Removing this BUG_ON hasn't shown any side effects, so let's take it
out and monitor.

Signed-off-by: Chris Fries <C.Fries@motorola.com>

---
 fs/f2fs/f2fs.h | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e80a87c..b8e9679 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -722,9 +722,21 @@ static inline void dec_valid_node_count(struct f2fs_sb_info *sbi,
 {
 	spin_lock(&sbi->stat_lock);
 
-	BUG_ON(sbi->total_valid_block_count < count);
-	BUG_ON(sbi->total_valid_node_count < count);
-	BUG_ON(inode->i_blocks < count);
+	if (sbi->total_valid_block_count < count) {
+		WARN(1, "F2FS: total_valid_block_count too small- %d vs %d\n",
+			(unsigned int)sbi->total_valid_block_count, count);
+		count = sbi->total_valid_block_count;
+	}
+	if (sbi->total_valid_node_count < count) {
+		WARN(1, "F2FS: total_valid_node_count too small- %d vs %d\n",
+			sbi->total_valid_node_count, count);
+		count = sbi->total_valid_node_count;
+	}
+	if (inode->i_blocks < count) {
+		WARN(1, "F2FS: inode->i_blocks too small - %d vs %d\n",
+			(unsigned int)inode->i_blocks, count);
+		count = sbi->total_valid_node_count;
+	}
 
 	inode->i_blocks -= count;
 	sbi->total_valid_node_count -= count;
-- 
1.8.0


             reply	other threads:[~2013-05-13  3:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13  3:46 Chris Fries [this message]
2013-05-13  7:05 ` Haicheng Li
     [not found]   ` <CAGC=Z9SN1zfT7NjzEcGidDaWCsC7v40uOhqErFq8x9oCiLQhKQ@mail.gmail.com>
2013-05-14 19:26     ` Russell Knize
2013-05-15 13:11       ` Chris Fries

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=51906213.2020005@gmail.com \
    --to=ccfries@gmail.com \
    --cc=jaegeuk.kim@samsung.com \
    --cc=jason.hrycay@motorola.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rknize2@motorola.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®