diff options
author | Christian Brauner <brauner@kernel.org> | 2024-04-17 13:49:56 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-04-17 13:49:56 +0200 |
commit | 193feb69af4c8c8c2e2a178b9f9c2bffff10b860 (patch) | |
tree | f7d87bd744a18af5356ace95128e2b46cce59a2d /mm | |
parent | c6854e5a267c28300ff045480b5a7ee7f6f1d913 (diff) | |
parent | ad191eb6d6942bb835a0b20b647f7c53c1d99ca4 (diff) |
Merge patch series 'Fix shmem_rename2 directory offset calculation' of https://lore.kernel.org/r/20240415152057.4605-1-cel@kernel.org
Pull shmem_rename2() offset fixes from Chuck Lever:
The existing code in shmem_rename2() allocates a fresh directory
offset value when renaming over an existing destination entry. User
space does not expect this behavior. In particular, applications
that rename while walking a directory can loop indefinitely because
they never reach the end of the directory.
* 'Fix shmem_rename2 directory offset calculation' of https://lore.kernel.org/r/20240415152057.4605-1-cel@kernel.org: (3 commits)
shmem: Fix shmem_rename2()
libfs: Add simple_offset_rename() API
libfs: Fix simple_offset_rename_exchange()
fs/libfs.c | 55 +++++++++++++++++++++++++++++++++++++++++-----
include/linux/fs.h | 2 ++
mm/shmem.c | 3 +--
3 files changed, 52 insertions(+), 8 deletions(-)
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 0aad0d9a621b..c0fb65223963 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3473,8 +3473,7 @@ static int shmem_rename2(struct mnt_idmap *idmap, return error; } - simple_offset_remove(shmem_get_offset_ctx(old_dir), old_dentry); - error = simple_offset_add(shmem_get_offset_ctx(new_dir), old_dentry); + error = simple_offset_rename(old_dir, old_dentry, new_dir, new_dentry); if (error) return error; |