All of lore.kernel.org
 help / color / mirror / Atom feed
From: patchwork-bot+f2fs@kernel.org
To: Chao Yu <chao@kernel.org>
Cc: jaegeuk@kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: fix to update user block counts in block_operations()
Date: Mon, 15 Jul 2024 14:40:32 +0000	[thread overview]
Message-ID: <172105443231.17443.11007255777614226894.git-patchwork-notify@kernel.org> (raw)
In-Reply-To: <20240625023239.3534605-1-chao@kernel.org>

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Tue, 25 Jun 2024 10:32:39 +0800 you wrote:
> Commit 59c9081bc86e ("f2fs: allow write page cache when writting cp")
> allows write() to write data to page cache during checkpoint, so block
> count fields like .total_valid_block_count, .alloc_valid_block_count
> and .rf_node_block_count may encounter race condition as below:
> 
> CP				Thread A
> - write_checkpoint
>  - block_operations
>   - f2fs_down_write(&sbi->node_change)
>   - __prepare_cp_block
>   : ckpt->valid_block_count = .total_valid_block_count
>   - f2fs_up_write(&sbi->node_change)
> 				- write
> 				 - f2fs_preallocate_blocks
> 				  - f2fs_map_blocks(,F2FS_GET_BLOCK_PRE_AIO)
> 				   - f2fs_map_lock
> 				    - f2fs_down_read(&sbi->node_change)
> 				   - f2fs_reserve_new_blocks
> 				    - inc_valid_block_count
> 				    : percpu_counter_add(&sbi->alloc_valid_block_count, count)
> 				    : sbi->total_valid_block_count += count
> 				    - f2fs_up_read(&sbi->node_change)
>  - do_checkpoint
>  : sbi->last_valid_block_count = sbi->total_valid_block_count
>  : percpu_counter_set(&sbi->alloc_valid_block_count, 0)
>  : percpu_counter_set(&sbi->rf_node_block_count, 0)
> 				- fsync
> 				 - need_do_checkpoint
> 				  - f2fs_space_for_roll_forward
> 				  : alloc_valid_block_count was reset to zero,
> 				    so, it may missed last data during checkpoint
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v2] f2fs: fix to update user block counts in block_operations()
    https://git.kernel.org/jaegeuk/f2fs/c/f06c0f82e38b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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

WARNING: multiple messages have this Message-ID (diff)
From: patchwork-bot+f2fs@kernel.org
To: Chao Yu <chao@kernel.org>
Cc: jaegeuk@kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: fix to update user block counts in block_operations()
Date: Mon, 15 Jul 2024 14:40:32 +0000	[thread overview]
Message-ID: <172105443231.17443.11007255777614226894.git-patchwork-notify@kernel.org> (raw)
In-Reply-To: <20240625023239.3534605-1-chao@kernel.org>

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Tue, 25 Jun 2024 10:32:39 +0800 you wrote:
> Commit 59c9081bc86e ("f2fs: allow write page cache when writting cp")
> allows write() to write data to page cache during checkpoint, so block
> count fields like .total_valid_block_count, .alloc_valid_block_count
> and .rf_node_block_count may encounter race condition as below:
> 
> CP				Thread A
> - write_checkpoint
>  - block_operations
>   - f2fs_down_write(&sbi->node_change)
>   - __prepare_cp_block
>   : ckpt->valid_block_count = .total_valid_block_count
>   - f2fs_up_write(&sbi->node_change)
> 				- write
> 				 - f2fs_preallocate_blocks
> 				  - f2fs_map_blocks(,F2FS_GET_BLOCK_PRE_AIO)
> 				   - f2fs_map_lock
> 				    - f2fs_down_read(&sbi->node_change)
> 				   - f2fs_reserve_new_blocks
> 				    - inc_valid_block_count
> 				    : percpu_counter_add(&sbi->alloc_valid_block_count, count)
> 				    : sbi->total_valid_block_count += count
> 				    - f2fs_up_read(&sbi->node_change)
>  - do_checkpoint
>  : sbi->last_valid_block_count = sbi->total_valid_block_count
>  : percpu_counter_set(&sbi->alloc_valid_block_count, 0)
>  : percpu_counter_set(&sbi->rf_node_block_count, 0)
> 				- fsync
> 				 - need_do_checkpoint
> 				  - f2fs_space_for_roll_forward
> 				  : alloc_valid_block_count was reset to zero,
> 				    so, it may missed last data during checkpoint
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v2] f2fs: fix to update user block counts in block_operations()
    https://git.kernel.org/jaegeuk/f2fs/c/f06c0f82e38b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



  reply	other threads:[~2024-07-15 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25  2:32 [f2fs-dev] [PATCH v2] f2fs: fix to update user block counts in block_operations() Chao Yu
2024-06-25  2:32 ` Chao Yu
2024-07-15 14:40 ` patchwork-bot+f2fs [this message]
2024-07-15 14:40   ` [f2fs-dev] " patchwork-bot+f2fs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=172105443231.17443.11007255777614226894.git-patchwork-notify@kernel.org \
    --to=patchwork-bot+f2fs@kernel.org \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.