All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yunlei He <heyunlei@huawei.com>
To: linux-f2fs-devel@lists.sourceforge.net, jaegeuk@kernel.org,
	yuchao0@huawei.com
Cc: heyunlei@huwei.com
Subject: [PATCH] f2fs: walk around a panic caused by nrpages is not zero in clear_inode
Date: Tue, 6 Sep 2016 09:17:32 +0800	[thread overview]
Message-ID: <1473124652-31921-1-git-send-email-heyunlei@huawei.com> (raw)

I came across a panic twice:

[<ffffffc000088e70>] dump_backtrace+0x0/0x124
[<ffffffc000088fb4>] show_stack+0x14/0x1c
[<ffffffc000ce1c38>] dump_stack+0x20/0x28
[<ffffffc000cdfbd4>] panic+0x13c/0x258
[<ffffffc0001b2244>] clear_inode+0x8c/0xd4
[<ffffffc00030575c>] f2fs_evict_inode+0x194/0x3e0
[<ffffffc0001b30b4>] evict+0xa0/0x1cc
[<ffffffc0001b399c>] iput+0xe4/0x180
[<ffffffc0003274fc>] recover_fsync_data+0x6ec/0xe5c
[<ffffffc00030d420>] f2fs_fill_super+0xa5c/0xb9c
[<ffffffc00019cd00>] mount_bdev+0x1ac/0x1d4
[<ffffffc00030b66c>] f2fs_mount+0x14/0x1c
[<ffffffc00019d5e4>] mount_fs+0x3c/0x1bc
[<ffffffc0001b7560>] vfs_kern_mount+0x4c/0xf0
[<ffffffc0001b9970>] do_mount+0x218/0x960
[<ffffffc0001ba148>] SyS_mount+0x90/0xd0

Here, the nrpages in i_mapping in not zero but one. Maybe it's
caused by grabing cache page in truncate_partial_data_page. So
this patch walk around it.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fs/f2fs/file.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 37c24be..7d1c3f3 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -561,6 +561,12 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 	if (!offset && !cache_only)
 		return 0;
 
+	if (!offset && inode->i_state & I_FREEING)
+		return 0;
+
+	if (index > F2FS_I_SB(inode)->max_file_blocks)
+		return 0;
+
 	if (cache_only) {
 		page = f2fs_grab_cache_page(mapping, index, false);
 		if (page && PageUptodate(page))
-- 
1.9.1


------------------------------------------------------------------------------

             reply	other threads:[~2016-09-06  1:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06  1:17 Yunlei He [this message]
2016-09-07  1:47 ` [PATCH] f2fs: walk around a panic caused by nrpages is not zero in clear_inode Jaegeuk Kim
2016-09-07  2:14   ` heyunlei
2016-09-10  1:27     ` Jaegeuk Kim

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=1473124652-31921-1-git-send-email-heyunlei@huawei.com \
    --to=heyunlei@huawei.com \
    --cc=heyunlei@huwei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=yuchao0@huawei.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 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.