linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] f2fs: wait on page's writeback in writepages path
@ 2016-01-30  0:52 Jaegeuk Kim
  2016-01-30  0:52 ` [PATCH 2/3] f2fs: flush bios to handle cp_error in put_super Jaegeuk Kim
  2016-01-30  0:52 ` [PATCH 3/3] f2fs: fix conflict on page->private usage Jaegeuk Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2016-01-30  0:52 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

Likewise f2fs_write_cache_pages, let's do for node and meta pages too.
Especially, for node blocks, we should do this before marking its fsync
and dentry flags.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/checkpoint.c | 4 +++-
 fs/f2fs/node.c       | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 112e19f..96d606d 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -232,7 +232,6 @@ static int f2fs_write_meta_page(struct page *page,
 	if (unlikely(f2fs_cp_error(sbi)))
 		goto redirty_out;
 
-	f2fs_wait_on_page_writeback(page, META, true);
 	write_meta_page(sbi, page);
 	dec_page_count(sbi, F2FS_DIRTY_META);
 	unlock_page(page);
@@ -315,6 +314,9 @@ continue_unlock:
 				goto continue_unlock;
 			}
 
+			f2fs_wait_on_page_writeback(page, META, true);
+
+			BUG_ON(PageWriteback(page));
 			if (!clear_page_dirty_for_io(page))
 				goto continue_unlock;
 
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index eae8977..511c0e7 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1297,6 +1297,9 @@ continue_unlock:
 				continue;
 			}
 
+			f2fs_wait_on_page_writeback(page, NODE, true);
+
+			BUG_ON(PageWriteback(page));
 			if (!clear_page_dirty_for_io(page))
 				goto continue_unlock;
 
@@ -1402,8 +1405,6 @@ static int f2fs_write_node_page(struct page *page,
 	if (unlikely(f2fs_cp_error(sbi)))
 		goto redirty_out;
 
-	f2fs_wait_on_page_writeback(page, NODE, true);
-
 	/* get old block addr of this node page */
 	nid = nid_of_node(page);
 	f2fs_bug_on(sbi, page->index != nid);
-- 
2.6.3

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

* [PATCH 2/3] f2fs: flush bios to handle cp_error in put_super
  2016-01-30  0:52 [PATCH 1/3] f2fs: wait on page's writeback in writepages path Jaegeuk Kim
@ 2016-01-30  0:52 ` Jaegeuk Kim
  2016-01-30  0:52 ` [PATCH 3/3] f2fs: fix conflict on page->private usage Jaegeuk Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2016-01-30  0:52 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

Sometimes, if cp_error is set, there remains under-writeback pages, resulting in
kernel hang in put_super.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/super.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 9962021..aa2d3d9 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -582,6 +582,13 @@ static void f2fs_put_super(struct super_block *sb)
 	f2fs_leave_shrinker(sbi);
 	mutex_unlock(&sbi->umount_mutex);
 
+	/* our cp_error case, we can wait for any writeback page */
+	if (get_pages(sbi, F2FS_WRITEBACK)) {
+		f2fs_submit_merged_bio(sbi, DATA, WRITE);
+		f2fs_submit_merged_bio(sbi, NODE, WRITE);
+		f2fs_submit_merged_bio(sbi, META, WRITE);
+	}
+
 	iput(sbi->node_inode);
 	iput(sbi->meta_inode);
 
-- 
2.6.3

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

* [PATCH 3/3] f2fs: fix conflict on page->private usage
  2016-01-30  0:52 [PATCH 1/3] f2fs: wait on page's writeback in writepages path Jaegeuk Kim
  2016-01-30  0:52 ` [PATCH 2/3] f2fs: flush bios to handle cp_error in put_super Jaegeuk Kim
@ 2016-01-30  0:52 ` Jaegeuk Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2016-01-30  0:52 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch fixes confilct on page->private value between f2fs_trace_pid and
atomic page.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/segment.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index ee44d34..cd7111b 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -183,7 +183,7 @@ struct segment_allocation {
  * this value is set in page as a private data which indicate that
  * the page is atomically written, and it is in inmem_pages list.
  */
-#define ATOMIC_WRITTEN_PAGE		0x0000ffff
+#define ATOMIC_WRITTEN_PAGE		((unsigned long)-1)
 
 #define IS_ATOMIC_WRITTEN_PAGE(page)			\
 		(page_private(page) == (unsigned long)ATOMIC_WRITTEN_PAGE)
-- 
2.6.3

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

end of thread, other threads:[~2016-01-30  0:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-30  0:52 [PATCH 1/3] f2fs: wait on page's writeback in writepages path Jaegeuk Kim
2016-01-30  0:52 ` [PATCH 2/3] f2fs: flush bios to handle cp_error in put_super Jaegeuk Kim
2016-01-30  0:52 ` [PATCH 3/3] f2fs: fix conflict on page->private usage Jaegeuk Kim

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).