diff options
| author | NeilBrown <neil@brown.name> | 2025-07-16 10:44:29 +1000 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-07-18 11:10:42 +0200 |
| commit | 8afa0a736713898f04d52abad69c07caa2c2f227 (patch) | |
| tree | 68ed8d2a478e5ce3428d8aeb4f94b9ce28321f82 /fs/overlayfs/params.c | |
| parent | ovl: change ovl_cleanup_and_whiteout() to take rename lock as needed (diff) | |
| download | linux-8afa0a736713898f04d52abad69c07caa2c2f227.tar.gz linux-8afa0a736713898f04d52abad69c07caa2c2f227.zip | |
ovl: narrow locking in ovl_whiteout()
ovl_whiteout() relies on the workdir i_rwsem to provide exclusive access
to ofs->whiteout which it manipulates. Rather than depending on this,
add a new mutex, "whiteout_lock" to explicitly provide the required
locking. Use guard(mutex) for this so that we can return without
needing to explicitly unlock.
Then take the lock on workdir only when needed - to lookup the temp name
and to do the whiteout or link.
Signed-off-by: NeilBrown <neil@brown.name>
Link: https://lore.kernel.org/20250716004725.1206467-19-neil@brown.name
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/overlayfs/params.c')
| -rw-r--r-- | fs/overlayfs/params.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c index 2b9b31524c38..f4e7fff909ac 100644 --- a/fs/overlayfs/params.c +++ b/fs/overlayfs/params.c @@ -795,6 +795,8 @@ int ovl_init_fs_context(struct fs_context *fc) fc->s_fs_info = ofs; fc->fs_private = ctx; fc->ops = &ovl_context_ops; + + mutex_init(&ofs->whiteout_lock); return 0; out_err: |
