All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix a infinite loop in writting checkpoint
@ 2017-08-26  4:15 Yunlei He
  2017-08-28  9:49 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Yunlei He @ 2017-08-26  4:15 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: heyunlei, morgan.wang

The loop reason is DIRTY IMETA always equal to 1:

Thread A:
-write_checkpoint
   -block_operations
       -f2fs_sync_inode_meta
           -igrab       <--- here igrab return NULL

Thread B:
-f2fs_evict_inode
   -remove_inode_page
       -truncate_xattr_node
          -__get_node_page
             -read_node_page   <---- here return -ENOENT

This patch walk around this cause.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fs/f2fs/node.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 2654c91..ec7a0e0 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)
 		return 0;
 
 	npage = get_node_page(sbi, nid);
-	if (IS_ERR(npage))
+	if (IS_ERR(npage) && PTR_ERR(npage) != -ENOENT) {
 		return PTR_ERR(npage);
+	}
 
 	f2fs_i_xnid_write(inode, 0);
 
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* Re: [PATCH] f2fs: fix a infinite loop in writting checkpoint
  2017-08-26  4:15 [PATCH] f2fs: fix a infinite loop in writting checkpoint Yunlei He
@ 2017-08-28  9:49 ` Chao Yu
  2017-09-01  4:19   ` 答复: " heyunlei
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2017-08-28  9:49 UTC (permalink / raw)
  To: Yunlei He, jaegeuk, linux-f2fs-devel; +Cc: morgan.wang

Hi Yunlei,

On 2017/8/26 12:15, Yunlei He wrote:
> The loop reason is DIRTY IMETA always equal to 1:
> 
> Thread A:
> -write_checkpoint
>    -block_operations
>        -f2fs_sync_inode_meta
>            -igrab       <--- here igrab return NULL
> 
> Thread B:
> -f2fs_evict_inode
>    -remove_inode_page
>        -truncate_xattr_node
>           -__get_node_page
>              -read_node_page   <---- here return -ENOENT
> 
> This patch walk around this cause.

It needs to figure out root cause that why xattr node entry is invalid.

Thanks,

> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  fs/f2fs/node.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 2654c91..ec7a0e0 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)
>  		return 0;
>  
>  	npage = get_node_page(sbi, nid);
> -	if (IS_ERR(npage))
> +	if (IS_ERR(npage) && PTR_ERR(npage) != -ENOENT) {
>  		return PTR_ERR(npage);
> +	}
>  
>  	f2fs_i_xnid_write(inode, 0);
>  
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* 答复: [PATCH] f2fs: fix a infinite loop in writting checkpoint
  2017-08-28  9:49 ` Chao Yu
@ 2017-09-01  4:19   ` heyunlei
  2017-09-04  1:24     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: heyunlei @ 2017-09-01  4:19 UTC (permalink / raw)
  To: Yuchao (T), jaegeuk, linux-f2fs-devel; +Cc: Wangkai (Morgan, Euler)


Hi Yunlei,

On 2017/8/26 12:15, Yunlei He wrote:
> The loop reason is DIRTY IMETA always equal to 1:
> 
> Thread A:
> -write_checkpoint
>    -block_operations
>        -f2fs_sync_inode_meta
>            -igrab       <--- here igrab return NULL
> 
> Thread B:
> -f2fs_evict_inode
>    -remove_inode_page
>        -truncate_xattr_node
>           -__get_node_page
>              -read_node_page   <---- here return -ENOENT
> 
> This patch walk around this cause.

It needs to figure out root cause that why xattr node entry is invalid.

How about this modification:

diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index b4c401d..62de5f7 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -497,7 +497,7 @@ void f2fs_evict_inode(struct inode *inode)
                f2fs_lock_op(sbi);
                err = remove_inode_page(inode);
                f2fs_unlock_op(sbi);
-               if (err == -ENOENT)
+               if (err == -ENOENT && is_bad_inode(inode))
                        err = 0;
        }

Thanks

> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  fs/f2fs/node.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 2654c91..ec7a0e0 
> 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)
>  		return 0;
>  
>  	npage = get_node_page(sbi, nid);
> -	if (IS_ERR(npage))
> +	if (IS_ERR(npage) && PTR_ERR(npage) != -ENOENT) {
>  		return PTR_ERR(npage);
> +	}
>  
>  	f2fs_i_xnid_write(inode, 0);
>  
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* Re: 答复: [PATCH] f2fs: fix a infinite loop in writting checkpoint
  2017-09-01  4:19   ` 答复: " heyunlei
@ 2017-09-04  1:24     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-09-04  1:24 UTC (permalink / raw)
  To: heyunlei, jaegeuk, linux-f2fs-devel; +Cc: Wangkai (Morgan, Euler)

On 2017/9/1 12:19, heyunlei wrote:
> 
> Hi Yunlei,
> 
> On 2017/8/26 12:15, Yunlei He wrote:
>> The loop reason is DIRTY IMETA always equal to 1:
>>
>> Thread A:
>> -write_checkpoint
>>    -block_operations
>>        -f2fs_sync_inode_meta
>>            -igrab       <--- here igrab return NULL
>>
>> Thread B:
>> -f2fs_evict_inode
>>    -remove_inode_page
>>        -truncate_xattr_node
>>           -__get_node_page
>>              -read_node_page   <---- here return -ENOENT
>>
>> This patch walk around this cause.
> 
> It needs to figure out root cause that why xattr node entry is invalid.
> 
> How about this modification:
> 
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index b4c401d..62de5f7 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -497,7 +497,7 @@ void f2fs_evict_inode(struct inode *inode)
>                 f2fs_lock_op(sbi);
>                 err = remove_inode_page(inode);
>                 f2fs_unlock_op(sbi);
> -               if (err == -ENOENT)
> +               if (err == -ENOENT && is_bad_inode(inode))

So we expect that before new inode page was allocated, it needs to set bad inode
in time covering all error paths?

Thanks,

>                         err = 0;
>         }
> 
> Thanks
> 
>>
>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>> ---
>>  fs/f2fs/node.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 2654c91..ec7a0e0 
>> 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)
>>  		return 0;
>>  
>>  	npage = get_node_page(sbi, nid);
>> -	if (IS_ERR(npage))
>> +	if (IS_ERR(npage) && PTR_ERR(npage) != -ENOENT) {
>>  		return PTR_ERR(npage);
>> +	}
>>  
>>  	f2fs_i_xnid_write(inode, 0);
>>  
>>
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

end of thread, other threads:[~2017-09-04  1:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-26  4:15 [PATCH] f2fs: fix a infinite loop in writting checkpoint Yunlei He
2017-08-28  9:49 ` Chao Yu
2017-09-01  4:19   ` 答复: " heyunlei
2017-09-04  1:24     ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.