* [PATCH] f2fs: move f2fs_balance_fs from truncate to punch_hole
@ 2013-04-09 1:16 Jason Hrycay
2013-04-09 6:46 ` Namjae Jeon
2013-04-09 8:55 ` Jaegeuk Kim
0 siblings, 2 replies; 4+ messages in thread
From: Jason Hrycay @ 2013-04-09 1:16 UTC (permalink / raw)
To: jaegeuk.kim; +Cc: linux-kernel, linux-f2fs-devel, C.Fries, jason.hrycay
From: Jason Hrycay <jason.hrycay@motorola.com>
Move the f2fs_balance_fs out of the truncate_hole function and only
perform that in punch_hole use case. The commit:
ed60b1644e7f7e5dd67d21caf7e4425dff05dad0
intended to do this but moved it into truncate_hole to cover more
cases. However, a deadlock scenario is possible when deleting an inode
entry under specific conditions:
f2fs_delete_entry()
mutex_lock_op(sbi, DENTRY_OPS);
truncate_hole()
f2fs_balance_fs()
mutex_lock(&sbi->gc_mutex);
f2fs_gc()
write_checkpoint()
block_operations()
mutex_lock_op(sbi, DENTRY_OPS);
Lets move it into the punch_hole case to cover the original intent of
avoiding it during fallocate's expand_inode_data case.
Change-Id: I29f8ea1056b0b88b70ba8652d901b6e8431bb27e
Signed-off-by: Jason Hrycay <jason.hrycay@motorola.com>
---
fs/f2fs/file.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index e031f57..155b362 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -390,8 +390,6 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
struct dnode_of_data dn;
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
- f2fs_balance_fs(sbi);
-
mutex_lock_op(sbi, DATA_TRUNC);
set_new_dnode(&dn, inode, NULL, NULL, 0);
err = get_dnode_of_data(&dn, index, LOOKUP_NODE);
@@ -435,6 +433,9 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len, int mode)
if (pg_start < pg_end) {
struct address_space *mapping = inode->i_mapping;
loff_t blk_start, blk_end;
+ struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
+
+ f2fs_balance_fs(sbi);
blk_start = pg_start << PAGE_CACHE_SHIFT;
blk_end = pg_end << PAGE_CACHE_SHIFT;
-- 1.8.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: move f2fs_balance_fs from truncate to punch_hole
2013-04-09 1:16 [PATCH] f2fs: move f2fs_balance_fs from truncate to punch_hole Jason Hrycay
@ 2013-04-09 6:46 ` Namjae Jeon
2013-04-09 8:56 ` Jaegeuk Kim
2013-04-09 8:55 ` Jaegeuk Kim
1 sibling, 1 reply; 4+ messages in thread
From: Namjae Jeon @ 2013-04-09 6:46 UTC (permalink / raw)
To: Jason Hrycay
Cc: jaegeuk.kim, linux-kernel, linux-f2fs-devel, C.Fries,
jason.hrycay
2013/4/9, Jason Hrycay <jhrycay@gmail.com>:
> From: Jason Hrycay <jason.hrycay@motorola.com>
>
> Move the f2fs_balance_fs out of the truncate_hole function and only
> perform that in punch_hole use case. The commit:
>
> ed60b1644e7f7e5dd67d21caf7e4425dff05dad0
>
> intended to do this but moved it into truncate_hole to cover more
> cases. However, a deadlock scenario is possible when deleting an inode
> entry under specific conditions:
>
> f2fs_delete_entry()
> mutex_lock_op(sbi, DENTRY_OPS);
> truncate_hole()
> f2fs_balance_fs()
> mutex_lock(&sbi->gc_mutex);
> f2fs_gc()
> write_checkpoint()
> block_operations()
> mutex_lock_op(sbi, DENTRY_OPS);
>
> Lets move it into the punch_hole case to cover the original intent of
> avoiding it during fallocate's expand_inode_data case.
>
> Change-Id: I29f8ea1056b0b88b70ba8652d901b6e8431bb27e
> Signed-off-by: Jason Hrycay <jason.hrycay@motorola.com>
Hi,
With the latest commit 9995bf953a83749abd9fa22f72ab2b0be341025a
About introducing the global locking method in ‘f2fs’,
I think we no longer will have a case of deadlock happening in this path.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: move f2fs_balance_fs from truncate to punch_hole
2013-04-09 1:16 [PATCH] f2fs: move f2fs_balance_fs from truncate to punch_hole Jason Hrycay
2013-04-09 6:46 ` Namjae Jeon
@ 2013-04-09 8:55 ` Jaegeuk Kim
1 sibling, 0 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2013-04-09 8:55 UTC (permalink / raw)
To: Jason Hrycay; +Cc: linux-kernel, linux-f2fs-devel, C.Fries, jason.hrycay
[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]
Hi,
2013-04-08 (월), 20:16 -0500, Jason Hrycay:
> From: Jason Hrycay <jason.hrycay@motorola.com>
>
> Move the f2fs_balance_fs out of the truncate_hole function and only
> perform that in punch_hole use case. The commit:
>
> ed60b1644e7f7e5dd67d21caf7e4425dff05dad0
>
> intended to do this but moved it into truncate_hole to cover more
> cases. However, a deadlock scenario is possible when deleting an inode
> entry under specific conditions:
>
> f2fs_delete_entry()
> mutex_lock_op(sbi, DENTRY_OPS);
> truncate_hole()
> f2fs_balance_fs()
> mutex_lock(&sbi->gc_mutex);
> f2fs_gc()
> write_checkpoint()
> block_operations()
> mutex_lock_op(sbi, DENTRY_OPS);
>
> Lets move it into the punch_hole case to cover the original intent of
> avoiding it during fallocate's expand_inode_data case.
Agreed.
Thanks,
>
> Change-Id: I29f8ea1056b0b88b70ba8652d901b6e8431bb27e
> Signed-off-by: Jason Hrycay <jason.hrycay@motorola.com>
> ---
> fs/f2fs/file.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index e031f57..155b362 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -390,8 +390,6 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
> struct dnode_of_data dn;
> struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
>
> - f2fs_balance_fs(sbi);
> -
> mutex_lock_op(sbi, DATA_TRUNC);
> set_new_dnode(&dn, inode, NULL, NULL, 0);
> err = get_dnode_of_data(&dn, index, LOOKUP_NODE);
> @@ -435,6 +433,9 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len, int mode)
> if (pg_start < pg_end) {
> struct address_space *mapping = inode->i_mapping;
> loff_t blk_start, blk_end;
> + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
> +
> + f2fs_balance_fs(sbi);
>
> blk_start = pg_start << PAGE_CACHE_SHIFT;
> blk_end = pg_end << PAGE_CACHE_SHIFT;
> -- 1.8.0
--
Jaegeuk Kim
Samsung
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: move f2fs_balance_fs from truncate to punch_hole
2013-04-09 6:46 ` Namjae Jeon
@ 2013-04-09 8:56 ` Jaegeuk Kim
0 siblings, 0 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2013-04-09 8:56 UTC (permalink / raw)
To: Namjae Jeon
Cc: Jason Hrycay, linux-kernel, linux-f2fs-devel, C.Fries,
jason.hrycay
[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]
2013-04-09 (화), 15:46 +0900, Namjae Jeon:
> 2013/4/9, Jason Hrycay <jhrycay@gmail.com>:
> > From: Jason Hrycay <jason.hrycay@motorola.com>
> >
> > Move the f2fs_balance_fs out of the truncate_hole function and only
> > perform that in punch_hole use case. The commit:
> >
> > ed60b1644e7f7e5dd67d21caf7e4425dff05dad0
> >
> > intended to do this but moved it into truncate_hole to cover more
> > cases. However, a deadlock scenario is possible when deleting an inode
> > entry under specific conditions:
> >
> > f2fs_delete_entry()
> > mutex_lock_op(sbi, DENTRY_OPS);
> > truncate_hole()
> > f2fs_balance_fs()
> > mutex_lock(&sbi->gc_mutex);
> > f2fs_gc()
> > write_checkpoint()
> > block_operations()
> > mutex_lock_op(sbi, DENTRY_OPS);
> >
> > Lets move it into the punch_hole case to cover the original intent of
> > avoiding it during fallocate's expand_inode_data case.
> >
> > Change-Id: I29f8ea1056b0b88b70ba8652d901b6e8431bb27e
> > Signed-off-by: Jason Hrycay <jason.hrycay@motorola.com>
> Hi,
> With the latest commit 9995bf953a83749abd9fa22f72ab2b0be341025a
> About introducing the global locking method in ‘f2fs’,
> I think we no longer will have a case of deadlock happening in this path.
Hi, Namjae.
I found that this bug still exists in the new locking model.
Please see the v3 patch. :)
Thanks,
>
> Thanks.
--
Jaegeuk Kim
Samsung
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-09 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09 1:16 [PATCH] f2fs: move f2fs_balance_fs from truncate to punch_hole Jason Hrycay
2013-04-09 6:46 ` Namjae Jeon
2013-04-09 8:56 ` Jaegeuk Kim
2013-04-09 8:55 ` Jaegeuk Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox