[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176062915555.3343688.7371766123646609605.stgit@frogsfrogsfrogs>
Date: Thu, 16 Oct 2025 08:41:05 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: [PATCH 05/16] libext2fs: the unixfd IO manager shouldn't close its fd
From: Darrick J. Wong <djwong@...nel.org>
The unixfd IO manager didn't create the fd that was passed in, so it
should not close the fd when the io channel closes.
Cc: <linux-ext4@...r.kernel.org> # v1.43.2
Fixes: 4ccf9e4fe165cf ("libext2fs: add unixfd_io_manager")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
lib/ext2fs/unix_io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 723a5c2474cdd5..1456b4d4bbe212 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -1061,7 +1061,7 @@ static errcode_t unix_open_channel(const char *name, int fd,
cleanup:
if (data) {
- if (data->dev >= 0)
+ if (io->manager != unixfd_io_manager && data->dev >= 0)
close(data->dev);
if (data->cache) {
free_cache(data);
@@ -1147,7 +1147,7 @@ static errcode_t unix_close(io_channel channel)
retval = flush_cached_blocks(channel, data, 0);
#endif
- if (close(data->dev) < 0)
+ if (channel->manager != unixfd_io_manager && close(data->dev) < 0)
retval = errno;
free_cache(data);
free(data->cache);
Powered by blists - more mailing lists