[PATCH] f2fs: add f2fs_bug_on in get_new_data_page

From: Chao Yu
Date: Tue Jan 05 2016 - 02:28:56 EST


In get_new_data_page, locked inode page should not be hold before
get_read_data_page, this patch adds f2fs_bug_on to detect this
condition.

Signed-off-by: Chao Yu <chao2.yu@xxxxxxxxxxx>
---
fs/f2fs/data.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 48f0bd3..2c5e3f6 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -440,6 +440,8 @@ repeat:
zero_user_segment(page, 0, PAGE_CACHE_SIZE);
SetPageUptodate(page);
} else {
+ f2fs_bug_on(F2FS_I_SB(inode), ipage);
+
f2fs_put_page(page, 1);

page = get_read_data_page(inode, index, READ_SYNC, true);
--
2.6.3


> + }
> + if (unlikely(page->mapping != mapping)) {
> + f2fs_put_page(page, 1);
> + goto repeat;
> + }

How about use get_lock_data_page to avoid duplicated code?

> }
> got_it:
> if (new_i_size && i_size_read(inode) <
> --
> 2.6.3
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/