[PATCH v2] xfs_io: syncfs can fail

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

 



From: Jeff Layton <jlayton@xxxxxxxxxx>

syncfs can return an error. Report one if it does. Also, ensure that
xfs_io will exit with a non-zero status in that case.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 io/sync.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

v2: also set exitcode when reporting error

diff --git a/io/sync.c b/io/sync.c
index c77263804a35..20ab50a7fcd4 100644
--- a/io/sync.c
+++ b/io/sync.c
@@ -41,8 +41,10 @@ syncfs_f(
 	int			argc,
 	char			**argv)
 {
-	/* syncfs can't fail */
-	syncfs(file->fd);
+	if (syncfs(file->fd) < 0) {
+		perror("syncfs");
+		exitcode = 1;
+	}
 	return 0;
 }
 #endif
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux