From: Jeff Layton <jlayton@kernel.org>
To: sandeen@sandeen.net
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH v2] xfs_io: syncfs can fail
Date: Wed, 16 May 2018 13:17:52 -0400 [thread overview]
Message-ID: <20180516171752.26583-1-jlayton@kernel.org> (raw)
In-Reply-To: <20180516132738.27776-2-jlayton@kernel.org>
From: Jeff Layton <jlayton@redhat.com>
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@redhat.com>
---
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
next prev parent reply other threads:[~2018-05-16 17:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 13:27 [PATCH 1/2] xfs_io: add the ability to do an O_PATH open Jeff Layton
2018-05-16 13:27 ` [PATCH 2/2] xfs_io: syncfs can fail Jeff Layton
2018-05-16 14:26 ` Eric Sandeen
2018-05-16 17:17 ` Jeff Layton [this message]
2018-05-23 21:37 ` [PATCH v2] " Eric Sandeen
2018-05-16 14:32 ` [PATCH 1/2] xfs_io: add the ability to do an O_PATH open Eric Sandeen
2018-05-16 17:14 ` [PATCH v3] xfs_io: Allow -P and -L to be given to open for O_PATH and O_NOFOLLOW Jeff Layton
2018-05-23 21:51 ` Eric Sandeen
2018-05-23 22:03 ` Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180516171752.26583-1-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).