All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: Remove BUG_ON in dec_valid_node_count
@ 2013-05-13  3:46 Chris Fries
  2013-05-13  7:05 ` Haicheng Li
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Fries @ 2013-05-13  3:46 UTC (permalink / raw)
  To: jaegeuk.kim, linux-f2fs-devel, linux-kernel, rknize2,
	jason.hrycay

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-15 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13  3:46 [PATCH] f2fs: Remove BUG_ON in dec_valid_node_count Chris Fries
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

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.