[PATCH v2 2/2] e2fsck: add sync error handle to e2fsck.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If fsync fails during fsck, it is silent and users will not perceive it, so
a function to handle fsync failure should be added to fsck.

Signed-off-by: zhanchengbin <zhanchengbin1@xxxxxxxxxx>
---
 e2fsck/ehandler.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/e2fsck/ehandler.c b/e2fsck/ehandler.c
index 71ca301c..1d95a89d 100644
--- a/e2fsck/ehandler.c
+++ b/e2fsck/ehandler.c
@@ -118,6 +118,27 @@ static errcode_t e2fsck_handle_write_error(io_channel channel,
 	return error;
 }
 
+static errcode_t e2fsck_handle_sync_error(io_channel channel,
+                                            errcode_t error)
+{
+	ext2_filsys fs = (ext2_filsys) channel->app_data;
+	e2fsck_t ctx;
+
+	ctx = (e2fsck_t) fs->priv_data;
+	if (ctx->flags & E2F_FLAG_EXITING)
+		return 0;
+
+	if (operation)
+		printf(_("Error during fsync of dirty metadata while %s: %s "),
+		       operation, error_message(error));
+	else
+		printf(_("Error during fsync of dirty metadata: %s "),
+		       error_message(error));
+	preenhalt(ctx);
+
+	return error;
+}
+
 const char *ehandler_operation(const char *op)
 {
 	const char *ret = operation;
@@ -130,4 +151,5 @@ void ehandler_init(io_channel channel)
 {
 	channel->read_error = e2fsck_handle_read_error;
 	channel->write_error = e2fsck_handle_write_error;
+	channel->sync_error = e2fsck_handle_sync_error;
 }
-- 
2.31.1




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux