Skip to contentSkip to conversation

f2fs: delete and free dirty dir freeing inode entry when sync dirty dir inodes

PATCH In review Gu Zheng 2 participants 3 messages Oct 21, 2013 – Oct 23, 2013

Subsystems (2)
lore
Share & tools
lore

Gu Zheng

author
#0 lore raw

PATCH 1/1 f2fs: delete and free dirty dir freeing inode entry when sync dirty dir inodes

In sync_dirty_dir_inodes(), remove_dirty_dir_inode() will be called in the callback of filemap_flush to delete and free dirty dir inode entry. But for the freeing inode entry, missed this step after sbumit data bio, and this may lead to a dead loop if these is freeing inode entry in dir_inode_list. So add the delete and free step to fix it.

---
 fs/f2fs/checkpoint.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
fs/f2fs/checkpoint.c +9 -0
index 8d16071..f61838f 100644
@@ -600,7 +600,16 @@ retry:
 		 * wribacking dentry pages in the freeing inode.
 		 */
 		f2fs_submit_bio(sbi, DATA, true);
+
+		spin_lock(&sbi->dir_inode_lock);
+		list_del(&entry->list);
+#ifdef CONFIG_F2FS_STAT_FS
+		sbi->n_dirty_dirs--;
+#endif
+		spin_unlock(&sbi->dir_inode_lock);
+		kmem_cache_free(inode_entry_slab, entry);
 	}
+
 	goto retry;
 }
 
Signature · 9 lines
1.7.7


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
#1 lore raw

2013-10-21 (월), 15:19 +0800, Gu Zheng:

Quoted 5 lines

In sync_dirty_dir_inodes(), remove_dirty_dir_inode() will be called in the callback of filemap_flush to delete and free dirty dir inode entry. But for the freeing inode entry, missed this step after sbumit data bio, and this may lead to a dead loop if these is freeing inode entry in dir_inode_list. So add the delete and free step to fix it.

Hi Gu,

This dirty inode will be removed by f2fs_evict_inode() after submitting any pending bio, f2fs_submit_bio().
Thanks,

Quoted 27 lines
---
 fs/f2fs/checkpoint.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
fs/f2fs/checkpoint.c +9 -0
index 8d16071..f61838f 100644
@@ -600,7 +600,16 @@ retry:
 		 * wribacking dentry pages in the freeing inode.
 		 */
 		f2fs_submit_bio(sbi, DATA, true);
+
+		spin_lock(&sbi->dir_inode_lock);
+		list_del(&entry->list);
+#ifdef CONFIG_F2FS_STAT_FS
+		sbi->n_dirty_dirs--;
+#endif
+		spin_unlock(&sbi->dir_inode_lock);
+		kmem_cache_free(inode_entry_slab, entry);
 	}
+
 	goto retry;
 }
 
Signature · 2 lines
Jaegeuk Kim
Samsung
author
#2 lore raw

Hi Kim,

Quoted 11 lines · Jaegeuk Kim

2013-10-21 (월), 15:19 +0800, Gu Zheng:

Quoted 5 lines

In sync_dirty_dir_inodes(), remove_dirty_dir_inode() will be called in the callback of filemap_flush to delete and free dirty dir inode entry. But for the freeing inode entry, missed this step after sbumit data bio, and this may lead to a dead loop if these is freeing inode entry in dir_inode_list. So add the delete and free step to fix it.

Hi Gu,

This dirty inode will be removed by f2fs_evict_inode() after submitting any pending bio, f2fs_submit_bio().

Yeah, got it, thanks for your direction, please ignore this patch.

Regards,
Gu

Quoted 30 lines

Thanks,

Quoted 27 lines
---
 fs/f2fs/checkpoint.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
fs/f2fs/checkpoint.c +9 -0
index 8d16071..f61838f 100644
@@ -600,7 +600,16 @@ retry:
 		 * wribacking dentry pages in the freeing inode.
 		 */
 		f2fs_submit_bio(sbi, DATA, true);
+
+		spin_lock(&sbi->dir_inode_lock);
+		list_del(&entry->list);
+#ifdef CONFIG_F2FS_STAT_FS
+		sbi->n_dirty_dirs--;
+#endif
+		spin_unlock(&sbi->dir_inode_lock);
+		kmem_cache_free(inode_entry_slab, entry);
 	}
+
 	goto retry;
 }