From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs_io: report io error for pwrite -W and -w
Date: Thu, 12 Oct 2017 15:02:45 -0700 [thread overview]
Message-ID: <20171012220245.GM7122@magnolia> (raw)
In-Reply-To: <20171012204949.8225-1-bo.li.liu@oracle.com>
On Thu, Oct 12, 2017 at 02:49:49PM -0600, Liu Bo wrote:
> When IO error occurs, xfs_io -c "pwrite -W/w" doesn't report errors
> while xfs_io -c "pwrite" -c "fsync" does.
>
> This changes "pwrite -W/w" to report errors when it should.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> io/pwrite.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/io/pwrite.c b/io/pwrite.c
> index 1c5dfca..71bcccc 100644
> --- a/io/pwrite.c
> +++ b/io/pwrite.c
> @@ -379,11 +379,18 @@ pwrite_f(
> }
> if (c < 0)
> goto done;
> - if (Wflag)
> - fsync(file->fd);
> - if (wflag)
> - fdatasync(file->fd);
> + if (Wflag) {
> + if (fsync(file->fd) < 0) {
> + perror("fsync");
> + goto done;
> + }
> + }
> + if (wflag) {
> + if (fdatasync(file->fd) < 0) {
> + perror("fdatasync");
Ok.
> + goto done;
So this is a new behavior -- previously we'd print the timing info even
if the f{data,}sync call fails. I don't know that the timing matters if
we fail to guarantee the data is on stable storage, but does anyone else
have opinions?
--D
> + }
> + }
> if (qflag)
> goto done;
> gettimeofday(&t2, NULL);
> --
> 2.9.4
>
> @@ -390,0 +397,0 @@
> --
> 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
next prev parent reply other threads:[~2017-10-12 22:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 20:49 [PATCH] xfs_io: report io error for pwrite -W and -w Liu Bo
2017-10-12 22:02 ` Darrick J. Wong [this message]
2017-10-13 13:31 ` Brian Foster
2017-11-07 17:37 ` 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=20171012220245.GM7122@magnolia \
--to=darrick.wong@oracle.com \
--cc=bo.li.liu@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/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