Blob Blame History Raw
From c7dcdc70473f524caa4d758233155df79bb1195d Mon Sep 17 00:00:00 2001
From: Lukas Czerner <lczerner@redhat.com>
Date: Thu, 21 Jun 2018 15:19:56 +0200
Subject: [PATCH 08/16] filefrag: don't ignore fsync errors

commit a691f8d844faca28524b7c55780873244a070be7

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 misc/filefrag.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc/filefrag.c b/misc/filefrag.c
index a050a226..1c16a2ef 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -274,8 +274,8 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents,
 		fm_ext.fe_flags = FIEMAP_EXTENT_MERGED;
 	}
 
-	if (sync_file)
-		fsync(fd);
+	if (sync_file && fsync(fd) != 0)
+		return -errno;
 
 	for (i = 0, logical = 0, *num_extents = 0, count = last_block = 0;
 	     i < numblocks;
-- 
2.20.1