diff options
author | NeilBrown <neil@brown.name> | 2025-07-16 10:44:12 +1000 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-07-18 11:10:40 +0200 |
commit | 9d23967b18c64b058cc0a03a8932413bcb37ebb9 (patch) | |
tree | 02c0f6eb5ac5de414bafbad0154deda4ef9e3bf2 /lib/crypto/mpi/mpiutil.c | |
parent | 083957f9614a8b2e284dbb3a85c5fec8e2fb26b8 (diff) |
ovl: simplify an error path in ovl_copy_up_workdir()
If ovl_copy_up_data() fails the error is not immediately handled but the
code continues on to call ovl_start_write() and lock_rename(),
presumably because both of these locks are needed for the cleanup.
Only then (if the lock was successful) is the error checked.
This makes the code a little hard to follow and could be fragile.
This patch changes to handle the error after the ovl_start_write()
(which cannot fail, so there aren't multiple errors to deail with). A
new ovl_cleanup_unlocked() is created which takes the required directory
lock. This will be used extensively in later patches.
In general we need to check the parent is still correct after taking the
lock (as ovl_copy_up_workdir() does after a successful lock_rename()) so
that is included in ovl_cleanup_unlocked() using new ovl_parent_lock()
and ovl_parent_unlock() calls (it is planned to move this API into VFS code
eventually, though in a slightly different form).
Signed-off-by: NeilBrown <neil@brown.name>
Link: https://lore.kernel.org/20250716004725.1206467-2-neil@brown.name
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'lib/crypto/mpi/mpiutil.c')
0 files changed, 0 insertions, 0 deletions