Re: [PATCH v3] nilfs2: fix checkpoint root lifetime on sysfs errors
From: Aldo Ariel Panzardo
Date: Mon Sep 21 2026 - 11:46:45 EST
In-Reply-To: <CAKFNMonYVUbzjYm343Aw-=xjUk78x4EdUwGBfNRwE6zfmRVhvA@xxxxxxxxxxxxxx>
Hi Ryusuke,
Completely agree — that is cleaner. v4 (below) does exactly this:
nilfs_sysfs_create_snapshot_group():
error path does kobject_put() + wait_for_completion()
nilfs_sysfs_delete_snapshot_group():
kobject_put() + wait_for_completion()
So nilfs_find_or_create_root() and nilfs_put_root() just call the
helpers and kfree(); they never touch the completion directly.
v4 also keeps ns_cptree_lock as a spinlock and creates the sysfs
group before taking the lock, per your earlier message.
Aldo