Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
* [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint
@ 2020-07-15 12:24 bugzilla-daemon
  2020-07-16 17:15 ` [f2fs-dev] [Bug 208565] " bugzilla-daemon
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-15 12:24 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

            Bug ID: 208565
           Summary: There may be dead lock for cp_rwsem during checkpoint
           Product: File System
           Version: 2.5
    Kernel Version: 4.14.181
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: f2fs
          Assignee: filesystem_f2fs@kernel-bugs.kernel.org
          Reporter: Zhiguo.Niu@unisoc.com
        Regression: No

A deadlock may happens in the following scenario, backtrace is:

PID: 257    TASK: ecdd0000  CPU: 0   COMMAND: "init"
 #0 [<c0b420ec>] (__schedule) from [<c0b423c8>]
 #1 [<c0b423c8>] (schedule) from [<c0b459d4>]
 #2 [<c0b459d4>] (rwsem_down_read_failed) from [<c0b44fa0>]
 #3 [<c0b44fa0>] (down_read) from [<c044233c>]
 #4 [<c044233c>] (f2fs_truncate_blocks) from [<c0442890>]
 #5 [<c0442890>] (f2fs_truncate) from [<c044d408>]
 #6 [<c044d408>] (f2fs_evict_inode) from [<c030be18>]
 #7 [<c030be18>] (evict) from [<c030a558>]
 #8 [<c030a558>] (iput) from [<c047c600>]
 #9 [<c047c600>] (f2fs_sync_node_pages) from [<c0465414>]
#10 [<c0465414>] (f2fs_write_checkpoint) from [<c04575f4>]
#11 [<c04575f4>] (f2fs_sync_fs) from [<c0441918>]
#12 [<c0441918>] (f2fs_do_sync_file) from [<c0441098>]
#13 [<c0441098>] (f2fs_sync_file) from [<c0323fa0>]
#14 [<c0323fa0>] (vfs_fsync_range) from [<c0324294>]
#15 [<c0324294>] (do_fsync) from [<c0324014>]
#16 [<c0324014>] (sys_fsync) from [<c0108bc0>]

f2fs_sync_node_pages tries to flush dirty inode and calls iput(). This results
in deadlock as iput() tries to hold cp_rwsem, which is already held at the
beginning by checkpoint->block_operations().

There is a similar issue and patch in android.googlesource.com with commit id
is 82cc5e607b56abea4ea77023650247f5ae41b515, but the call trace is:

- f2fs_sync_node_pages()
 - if (is_inline_node(page))
>  - flush_inline_data()
   - ilookup()
     page = f2fs_pagecache_get_page()
     if (!page)
      goto iput_out;
     iput_out:
                        -close()
                        -iput()
       iput(inode);
       - f2fs_evict_inode()
        - f2fs_truncate_blocks()
         - f2fs_lock_op()
           - down_read(&sbi->cp_rwsem);

it seems than this patch has not cover current deadlock scenario, the current
deadlock call trace is:
- f2fs_sync_node_pages()

>  - if (flush_dirty_inode(page))

  - iput(inode);

       - f2fs_evict_inode()

        - f2fs_truncate_blocks()

         - f2fs_lock_op()

           - down_read(&sbi->cp_rwsem);

please help check and confirm.

thanks!

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
@ 2020-07-16 17:15 ` bugzilla-daemon
  2020-07-24  1:31   ` Chao Yu
  2020-07-17  1:54 ` bugzilla-daemon
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-16 17:15 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

Jaegeuk Kim (jaegeuk@kernel.org) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jaegeuk@kernel.org

--- Comment #1 from Jaegeuk Kim (jaegeuk@kernel.org) ---
Thank you for the report.

I think this is valid point that we need to fix.
I'm testing a RFC patch like this. Thanks.

--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1926,8 +1926,12 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
                                goto continue_unlock;
                        }

-                       /* flush inline_data, if it's async context. */
-                       if (do_balance && is_inline_node(page)) {
+                       /* flush inline_data/inode, if it's async context. */
+                       if (!do_balance)
+                               goto write_node;
+
+                       /* flush inline_data */
+                       if (is_inline_node(page)) {
                                clear_inline_node(page);
                                unlock_page(page);
                                flush_inline_data(sbi, ino_of_node(page));
@@ -1940,7 +1944,7 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
                                if (flush_dirty_inode(page))
                                        goto lock_node;
                        }
-
+write_node:
                        f2fs_wait_on_page_writeback(page, NODE, true, true);

                        if (!clear_page_dirty_for_io(page))

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
  2020-07-16 17:15 ` [f2fs-dev] [Bug 208565] " bugzilla-daemon
@ 2020-07-17  1:54 ` bugzilla-daemon
  2020-07-17  2:02 ` bugzilla-daemon
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-17  1:54 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

Chao Yu (chao@kernel.org) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |chao@kernel.org

--- Comment #2 from Chao Yu (chao@kernel.org) ---
(In reply to Jaegeuk Kim from comment #1)
> Thank you for the report.
> 
> I think this is valid point that we need to fix.
> I'm testing a RFC patch like this. Thanks.
> 

Could you please check generic/204 testcase? as this fix diff skips codes added
in commit 052a82d85a3b ("f2fs: fix to writeout dirty inode during node flush").

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
  2020-07-16 17:15 ` [f2fs-dev] [Bug 208565] " bugzilla-daemon
  2020-07-17  1:54 ` bugzilla-daemon
@ 2020-07-17  2:02 ` bugzilla-daemon
  2020-07-17  2:26 ` bugzilla-daemon
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-17  2:02 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #3 from Jaegeuk Kim (jaegeuk@kernel.org) ---
That passed. could you check your side?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (2 preceding siblings ...)
  2020-07-17  2:02 ` bugzilla-daemon
@ 2020-07-17  2:26 ` bugzilla-daemon
  2020-07-17  6:16   ` [f2fs-dev] Fwd: " Chao Yu
  2020-07-17  2:47 ` [f2fs-dev] " bugzilla-daemon
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-17  2:26 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #4 from Chao Yu (chao@kernel.org) ---
Passed, we should ask Eric to retest in his enviornment, to make sure there is
actually no regression.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (3 preceding siblings ...)
  2020-07-17  2:26 ` bugzilla-daemon
@ 2020-07-17  2:47 ` bugzilla-daemon
  2020-07-23  7:11 ` bugzilla-daemon
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-17  2:47 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #5 from Zhiguo.Niu (Zhiguo.Niu@unisoc.com) ---

(In reply to Jaegeuk Kim from comment #1)
> Thank you for the report.
> 
> I think this is valid point that we need to fix.
> I'm testing a RFC patch like this. Thanks.
> 
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1926,8 +1926,12 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
>                                 goto continue_unlock;
>                         }
>  
> -                       /* flush inline_data, if it's async context. */
> -                       if (do_balance && is_inline_node(page)) {
> +                       /* flush inline_data/inode, if it's async context. */
> +                       if (!do_balance)
> +                               goto write_node;
> +
> +                       /* flush inline_data */
> +                       if (is_inline_node(page)) {
>                                 clear_inline_node(page);
>                                 unlock_page(page);
>                                 flush_inline_data(sbi, ino_of_node(page));
> @@ -1940,7 +1944,7 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
>                                 if (flush_dirty_inode(page))
>                                         goto lock_node;
>                         }
> -
> +write_node:
>                         f2fs_wait_on_page_writeback(page, NODE, true, true);
>  
>                         if (!clear_page_dirty_for_io(page))

Hi  Jaegeuk Kim

for comment 1, can you help provide a full diff for this patch, I can not apply
it directly because of the following error:
> fatal: patch fragment without header at line 3: @@ -1926,8 +1926,12 @@ int
> f2fs_sync_node_pages(struct f2fs_sb_info *sbi,

or Should I merge it by Manually?

thanks a lot~

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] Fwd: [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-17  2:26 ` bugzilla-daemon
@ 2020-07-17  6:16   ` Chao Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2020-07-17  6:16 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-f2fs-devel

Hi Eric,

Could you please help to test Jaegeak's patch with generic/204 testcase
to see whether there is a regression?

-------- Forwarded Message --------
Subject: [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
Date: Fri, 17 Jul 2020 02:26:47 +0000
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-f2fs-devel@lists.sourceforge.net

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #4 from Chao Yu (chao@kernel.org) ---
Passed, we should ask Eric to retest in his enviornment, to make sure there is
actually no regression.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (4 preceding siblings ...)
  2020-07-17  2:47 ` [f2fs-dev] " bugzilla-daemon
@ 2020-07-23  7:11 ` bugzilla-daemon
  2020-07-24  1:31 ` bugzilla-daemon
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-23  7:11 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #6 from Zhiguo.Niu (Zhiguo.Niu@unisoc.com) ---
Hi Jaegeuk Kim

Could I merge this patch in my code for fixing the deadlock issue?

thanks!

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-16 17:15 ` [f2fs-dev] [Bug 208565] " bugzilla-daemon
@ 2020-07-24  1:31   ` Chao Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2020-07-24  1:31 UTC (permalink / raw)
  To: bugzilla-daemon, linux-f2fs-devel

On 2020/7/17 1:15, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208565
> 
> Jaegeuk Kim (jaegeuk@kernel.org) changed:
> 
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |jaegeuk@kernel.org
> 
> --- Comment #1 from Jaegeuk Kim (jaegeuk@kernel.org) ---
> Thank you for the report.
> 
> I think this is valid point that we need to fix.
> I'm testing a RFC patch like this. Thanks.


Shouldn't we revert 34c061ad85a2 ("f2fs: Avoid double lock for cp_rwsem during checkpoint")
at the same time?

> 
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1926,8 +1926,12 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
>                                  goto continue_unlock;
>                          }
> 
> -                       /* flush inline_data, if it's async context. */
> -                       if (do_balance && is_inline_node(page)) {
> +                       /* flush inline_data/inode, if it's async context. */
> +                       if (!do_balance)
> +                               goto write_node;
> +
> +                       /* flush inline_data */
> +                       if (is_inline_node(page)) {
>                                  clear_inline_node(page);
>                                  unlock_page(page);
>                                  flush_inline_data(sbi, ino_of_node(page));
> @@ -1940,7 +1944,7 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
>                                  if (flush_dirty_inode(page))
>                                          goto lock_node;
>                          }
> -
> +write_node:
>                          f2fs_wait_on_page_writeback(page, NODE, true, true);
> 
>                          if (!clear_page_dirty_for_io(page))
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (5 preceding siblings ...)
  2020-07-23  7:11 ` bugzilla-daemon
@ 2020-07-24  1:31 ` bugzilla-daemon
  2020-07-24  3:21 ` bugzilla-daemon
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-24  1:31 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #7 from yuchao0@huawei.com ---
On 2020/7/17 1:15, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208565
> 
> Jaegeuk Kim (jaegeuk@kernel.org) changed:
> 
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |jaegeuk@kernel.org
> 
> --- Comment #1 from Jaegeuk Kim (jaegeuk@kernel.org) ---
> Thank you for the report.
> 
> I think this is valid point that we need to fix.
> I'm testing a RFC patch like this. Thanks.


Shouldn't we revert 34c061ad85a2 ("f2fs: Avoid double lock for cp_rwsem during
checkpoint")
at the same time?

> 
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1926,8 +1926,12 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
>                                  goto continue_unlock;
>                          }
> 
> -                       /* flush inline_data, if it's async context. */
> -                       if (do_balance && is_inline_node(page)) {
> +                       /* flush inline_data/inode, if it's async context. */
> +                       if (!do_balance)
> +                               goto write_node;
> +
> +                       /* flush inline_data */
> +                       if (is_inline_node(page)) {
>                                  clear_inline_node(page);
>                                  unlock_page(page);
>                                  flush_inline_data(sbi, ino_of_node(page));
> @@ -1940,7 +1944,7 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
>                                  if (flush_dirty_inode(page))
>                                          goto lock_node;
>                          }
> -
> +write_node:
>                          f2fs_wait_on_page_writeback(page, NODE, true, true);
> 
>                          if (!clear_page_dirty_for_io(page))
>

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (6 preceding siblings ...)
  2020-07-24  1:31 ` bugzilla-daemon
@ 2020-07-24  3:21 ` bugzilla-daemon
  2020-07-24  3:38   ` Chao Yu
  2020-07-24  3:38 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-24  3:21 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #8 from Jaegeuk Kim (jaegeuk@kernel.org) ---
Chao, why do we need to revert that patch?

Zhiguo,
You can see the patch here.
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=b0f3b87fb3abc42c81d76c6c5795f26dbdb2f04b

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-24  3:21 ` bugzilla-daemon
@ 2020-07-24  3:38   ` Chao Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Chao Yu @ 2020-07-24  3:38 UTC (permalink / raw)
  To: bugzilla-daemon, linux-f2fs-devel

On 2020/7/24 11:21, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208565
> 
> --- Comment #8 from Jaegeuk Kim (jaegeuk@kernel.org) ---
> Chao, why do we need to revert that patch?

After applying your new patch, below race condition should no longer
happen, right?

Thread A		Thread B
f2fs_write_checkpoint()
- block_operations(sbi)
  - f2fs_lock_all(sbi);
   - down_write(&sbi->cp_rwsem);

                         - open()
                          - igrab()
                         - write() write inline data
                         - unlink()
- f2fs_sync_node_pages()

+ if (!do_balance)
+	goto write_node;	<---- this avoids running into iput().

  - if (is_inline_node(page))
   - flush_inline_data()
    - ilookup()
      page = f2fs_pagecache_get_page()
      if (!page)
       goto iput_out;
      iput_out:
			-close()
			-iput()
        iput(inode);
        - f2fs_evict_inode()
         - f2fs_truncate_blocks()
          - f2fs_lock_op()
            - down_read(&sbi->cp_rwsem);

> 
> Zhiguo,
> You can see the patch here.
> https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=b0f3b87fb3abc42c81d76c6c5795f26dbdb2f04b
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (7 preceding siblings ...)
  2020-07-24  3:21 ` bugzilla-daemon
@ 2020-07-24  3:38 ` bugzilla-daemon
  2020-07-24  3:56 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-24  3:38 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #9 from yuchao0@huawei.com ---
On 2020/7/24 11:21, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208565
> 
> --- Comment #8 from Jaegeuk Kim (jaegeuk@kernel.org) ---
> Chao, why do we need to revert that patch?

After applying your new patch, below race condition should no longer
happen, right?

Thread A                Thread B
f2fs_write_checkpoint()
- block_operations(sbi)
  - f2fs_lock_all(sbi);
   - down_write(&sbi->cp_rwsem);

                         - open()
                          - igrab()
                         - write() write inline data
                         - unlink()
- f2fs_sync_node_pages()

+ if (!do_balance)
+       goto write_node;        <---- this avoids running into iput().

  - if (is_inline_node(page))
   - flush_inline_data()
    - ilookup()
      page = f2fs_pagecache_get_page()
      if (!page)
       goto iput_out;
      iput_out:
                        -close()
                        -iput()
        iput(inode);
        - f2fs_evict_inode()
         - f2fs_truncate_blocks()
          - f2fs_lock_op()
            - down_read(&sbi->cp_rwsem);

> 
> Zhiguo,
> You can see the patch here.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=b0f3b87fb3abc42c81d76c6c5795f26dbdb2f04b
>

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (8 preceding siblings ...)
  2020-07-24  3:38 ` bugzilla-daemon
@ 2020-07-24  3:56 ` bugzilla-daemon
  2020-07-24  6:36 ` bugzilla-daemon
  2020-07-24 17:25 ` bugzilla-daemon
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-24  3:56 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #10 from Jaegeuk Kim (jaegeuk@kernel.org) ---
if we revert it, we're not going to call f2fs_flush_inline_data() in checkpoint
path, which actually fixes generic/204?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (9 preceding siblings ...)
  2020-07-24  3:56 ` bugzilla-daemon
@ 2020-07-24  6:36 ` bugzilla-daemon
  2020-07-24 17:25 ` bugzilla-daemon
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-24  6:36 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #11 from Zhiguo.Niu (Zhiguo.Niu@unisoc.com) ---
(In reply to Jaegeuk Kim from comment #10)
> if we revert it, we're not going to call f2fs_flush_inline_data() in
> checkpoint path, which actually fixes generic/204?

Hi Jaeqeuk Kim,

I still have a problem:

As new patch modified, flush_dirty_inode will be skipped for avoiding dead
lock,

but when/where flush_dirty_inode would be done? 

thanks!

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [Bug 208565] There may be dead lock for cp_rwsem during checkpoint
  2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
                   ` (10 preceding siblings ...)
  2020-07-24  6:36 ` bugzilla-daemon
@ 2020-07-24 17:25 ` bugzilla-daemon
  11 siblings, 0 replies; 16+ messages in thread
From: bugzilla-daemon @ 2020-07-24 17:25 UTC (permalink / raw)
  To: linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=208565

--- Comment #12 from Jaegeuk Kim (jaegeuk@kernel.org) ---
It'll be called by node_inode->writepages() -> f2fs_write_node_pages(), which
should be done by flusher in vfs.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, back to index

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 12:24 [f2fs-dev] [Bug 208565] New: There may be dead lock for cp_rwsem during checkpoint bugzilla-daemon
2020-07-16 17:15 ` [f2fs-dev] [Bug 208565] " bugzilla-daemon
2020-07-24  1:31   ` Chao Yu
2020-07-17  1:54 ` bugzilla-daemon
2020-07-17  2:02 ` bugzilla-daemon
2020-07-17  2:26 ` bugzilla-daemon
2020-07-17  6:16   ` [f2fs-dev] Fwd: " Chao Yu
2020-07-17  2:47 ` [f2fs-dev] " bugzilla-daemon
2020-07-23  7:11 ` bugzilla-daemon
2020-07-24  1:31 ` bugzilla-daemon
2020-07-24  3:21 ` bugzilla-daemon
2020-07-24  3:38   ` Chao Yu
2020-07-24  3:38 ` bugzilla-daemon
2020-07-24  3:56 ` bugzilla-daemon
2020-07-24  6:36 ` bugzilla-daemon
2020-07-24 17:25 ` bugzilla-daemon

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net
	public-inbox-index linux-f2fs-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git