lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 Feb 2023 17:01:11 +0800
From:   zhanchengbin <zhanchengbin1@...wei.com>
To:     <tytso@....edu>
CC:     <linux-ext4@...r.kernel.org>, <linfeilong@...wei.com>,
        <louhongxiang@...wei.com>, zhanchengbin <zhanchengbin1@...wei.com>
Subject: [PATCH v2] lib/ext2fs: add some msg for io error

Add msgs to show whether there is eio in fsck process, when write and
fsync methods fail.

Signed-off-by: zhanchengbin <zhanchengbin1@...wei.com>
---
v2->v1:
 - Delete return 0.

 lib/ext2fs/unix_io.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 3171c736..a6c85874 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -1265,12 +1265,16 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset,
 		return errno;
 
 	actual = write(data->dev, buf, size);
+
 	if (actual < 0)
-		return errno;
+		retval = errno;
 	if (actual != size)
-		return EXT2_ET_SHORT_WRITE;
+		retval = EXT2_ET_SHORT_WRITE;
 
-	return 0;
+	if (retval)
+		fprintf(stderr, "%s unix_write_byte error, error %d\n",
+				channel->name, errno);
+	return retval;
 }
 
 /*
@@ -1289,8 +1293,11 @@ static errcode_t unix_flush(io_channel channel)
 	retval = flush_cached_blocks(channel, data, 0);
 #endif
 #ifdef HAVE_FSYNC
-	if (!retval && fsync(data->dev) != 0)
+	if (!retval && fsync(data->dev) != 0) {
+		fprintf(stderr, "%s flush error, error %d\n",
+				channel->name, errno);
 		return errno;
+	}
 #endif
 	return retval;
 }
-- 
2.31.1

Powered by blists - more mailing lists