Files
linux-stable-mirror/include/linux
Al Viro 4b0fe71fb3 shmem: fix recovery on rename failures
[ Upstream commit e1b4c6a583 ]

maple_tree insertions can fail if we are seriously short on memory;
simple_offset_rename() does not recover well if it runs into that.
The same goes for simple_offset_rename_exchange().

Moreover, shmem_whiteout() expects that if it succeeds, the caller will
progress to d_move(), i.e. that shmem_rename2() won't fail past the
successful call of shmem_whiteout().

Not hard to fix, fortunately - mtree_store() can't fail if the index we
are trying to store into is already present in the tree as a singleton.

For simple_offset_rename_exchange() that's enough - we just need to be
careful about the order of operations.

For simple_offset_rename() solution is to preinsert the target into the
tree for new_dir; the rest can be done without any potentially failing
operations.

That preinsertion has to be done in shmem_rename2() rather than in
simple_offset_rename() itself - otherwise we'd need to deal with the
possibility of failure after successful shmem_whiteout().

Fixes: a2e459555c ("shmem: stable directory offsets")
Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-01-08 10:13:54 +01:00
..
2025-11-02 22:15:22 +09:00
2025-10-15 12:00:03 +02:00
2025-03-07 18:25:35 +01:00
2025-09-11 17:21:46 +02:00
2025-12-18 13:55:17 +01:00
2025-05-29 11:03:25 +02:00
2024-12-14 20:03:35 +01:00
2026-01-08 10:13:54 +01:00
2025-09-09 18:58:04 +02:00
2025-05-29 11:03:25 +02:00
2025-05-29 11:02:23 +02:00
2025-03-28 22:03:30 +01:00
2025-01-17 13:40:50 +01:00
2025-02-08 09:57:23 +01:00
2025-12-18 13:55:18 +01:00
2025-06-19 15:32:18 +02:00
2025-04-20 10:15:25 +02:00
2025-05-29 11:02:20 +02:00
2025-08-15 12:13:35 +02:00
2025-01-23 17:22:53 +01:00
2025-02-01 18:39:35 +01:00
2025-02-27 04:30:19 -08:00
2025-08-01 09:48:43 +01:00
2025-07-10 16:05:11 +02:00