diff mbox

[2/2] xfs_io: syncfs can fail

Message ID 20180516132738.27776-2-jlayton@kernel.org (mailing list archive)
State Superseded
Headers show

Commit Message

Jeff Layton May 16, 2018, 1:27 p.m. UTC
From: Jeff Layton <jlayton@redhat.com>

syncfs can return an error. Report one if it does.

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

Comments

Eric Sandeen May 16, 2018, 2:26 p.m. UTC | #1
On 5/16/18 8:27 AM, Jeff Layton wrote:
> From: Jeff Layton <jlayton@redhat.com>
> 
> syncfs can return an error. Report one if it does.
> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>   io/sync.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/io/sync.c b/io/sync.c
> index c77263804a35..868cea7c051e 100644
> --- a/io/sync.c
> +++ b/io/sync.c
> @@ -41,8 +41,8 @@ syncfs_f(
>   	int			argc,
>   	char			**argv)
>   {
> -	/* syncfs can't fail */
> -	syncfs(file->fd);
> +	if (syncfs(file->fd) < 0)
> +		perror("syncfs");

In light of dchinner's recent reminder on another of my patches, this
should also set exitcode=1 here, so that the overall xfs_io exit code
will be non-zero if syncfs fails.

(I could just add that on merge if you prefer... assuming I remember)

Thanks,
-Eric

>   	return 0;
>   }
>   #endif
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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