Re: [PATCH v2] f2fs: cover the checkpoint of device aliasing ioctls with gc_lock

From: Chao Yu

Date: Tue Dec 01 2026 - 20:40:37 EST


On 12/2/26 01:19, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@xxxxxxxxxx>
>
> f2fs_ioc_reserve_dev_alias() and f2fs_ioc_release_dev_alias() write the
> checkpoint at their end after they released gc_lock. All the other
> callers of f2fs_write_checkpoint() on a mounted filesystem hold gc_lock,
> so only these two checkpoints can run while another task holds gc_lock.
>
> f2fs_ioc_reserve_dev_alias() is such a task: it moves the cursegs out of
> the range of the alias device with gc_lock held, before it takes
> f2fs_lock_op(). do_checkpoint() copies the positions of the cursegs into
> the checkpoint first and writes their summaries later. If the checkpoint
> of another alias ioctl is in progress and a curseg is moved in between,
> the checkpoint does not match it.
>
> Hold gc_lock for the checkpoint in both ioctls, as the other callers do.
>
> Test: two alias files, with a debug patch which makes do_checkpoint()
> of the release ioctl sleep after it copied the curseg positions. A
> reserve ioctl on the other alias file moved the warm data curseg during
> that sleep, and the checkpoint recorded the segment the curseg had left.
> With this patch, the reserve ioctl waits for the checkpoint and moves
> the curseg after it.
>
> Fixes: eae3faf210bd ("f2fs: support dynamic reserve/release for device aliasing")
> Cc: stable@xxxxxxxxxxxxxxx
> Suggested-by: Chao Yu <chao@xxxxxxxxxx>
> Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
Reviewed-by: Chao Yu <chao@xxxxxxxxxx>

Thanks,