Skip to contentSkip to conversation

f2fs: fix to unlock node page when it was truncated

PATCH In review Jaegeuk Kim 2 participants 2 messages Mar 18, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: fix to unlock node page when it was truncated

If the node page was truncated, its block address became zero. This means that we don't need to write the node page, but have to unlock NODE_WRITE, decrease the number of dirty node pages, and then unlock_page before returning the f2fs_write_node_page with zero.

---
 fs/f2fs/node.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/node.c +2 -2
index e275218..3dc63f4 100644
@@ -1106,15 +1106,15 @@ static int f2fs_write_node_page(struct page *page,
 
 	/* This page is already truncated */
 	if (ni.blk_addr == NULL_ADDR)
-		return 0;
+		goto out;
 
 	set_page_writeback(page);
 
 	/* insert node offset */
 	write_node_page(sbi, page, nid, ni.blk_addr, &new_addr);
 	set_node_addr(sbi, &ni, new_addr);
+out:
 	dec_page_count(sbi, F2FS_DIRTY_NODES);
-
 	mutex_unlock_op(sbi, NODE_WRITE);
 	unlock_page(page);
 	return 0;
Signature · 1 line
1.8.1.3.566.gaa39828
Reviewed-by on v1 1/1
#1 lore raw

2013/3/18, Jaegeuk Kim <[email protected]>:

Quoted 6 lines

If the node page was truncated, its block address became zero. This means that we don't need to write the node page, but have to unlock NODE_WRITE, decrease the number of dirty node pages, and then unlock_page before returning the f2fs_write_node_page with zero.

Looks good to me~

Thanks!