From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 8/8] libfrog: always fsync when flushing a device
Date: Thu, 20 Feb 2020 09:06:30 -0500 [thread overview]
Message-ID: <20200220140630.GD48977@bfoster> (raw)
In-Reply-To: <158216295197.601264.12572804096602430873.stgit@magnolia>
On Wed, Feb 19, 2020 at 05:42:31PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Always call fsync() when we're flushing a device, even if it is a block
> device. It's probably redundant to call fsync /and/ BLKFLSBUF, but the
> latter has odd behavior so we want to make sure the standard flush
> methods have a chance to run first.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> libfrog/linux.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
>
> diff --git a/libfrog/linux.c b/libfrog/linux.c
> index 60bc1dc4..40a839d1 100644
> --- a/libfrog/linux.c
> +++ b/libfrog/linux.c
> @@ -155,14 +155,18 @@ platform_flush_device(
> if (major(device) == RAMDISK_MAJOR)
> return 0;
>
> + ret = fsync(fd);
> + if (ret)
> + return ret;
> +
> ret = fstat(fd, &st);
> if (ret)
> return ret;
>
> - if (S_ISREG(st.st_mode))
> - return fsync(fd);
> + if (S_ISBLK(st.st_mode))
> + return ioctl(fd, BLKFLSBUF, 0);
>
> - return ioctl(fd, BLKFLSBUF, 0);
> + return 0;
> }
>
> void
>
prev parent reply other threads:[~2020-02-20 14:06 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 1:41 [PATCH v2 0/8] xfsprogs: actually check that writes succeeded Darrick J. Wong
2020-02-20 1:41 ` [PATCH 1/8] libxfs: libxfs_buf_delwri_submit should write buffers immediately Darrick J. Wong
2020-02-20 1:41 ` [PATCH 2/8] libxfs: complain when write IOs fail Darrick J. Wong
2020-02-20 1:42 ` [PATCH 3/8] libxfs: return flush failures Darrick J. Wong
2020-02-20 1:42 ` [PATCH 4/8] libxfs: enable tools to check that metadata updates have been committed Darrick J. Wong
2020-02-20 14:06 ` Brian Foster
2020-02-20 16:46 ` Darrick J. Wong
2020-02-20 17:58 ` Brian Foster
2020-02-20 18:26 ` Darrick J. Wong
2020-02-20 18:50 ` Brian Foster
2020-02-20 23:40 ` Dave Chinner
2020-02-21 0:33 ` Darrick J. Wong
2020-02-20 1:42 ` [PATCH 5/8] xfs_db: " Darrick J. Wong
2020-02-20 14:06 ` Brian Foster
2020-02-20 16:58 ` Darrick J. Wong
2020-02-20 17:58 ` Brian Foster
2020-02-20 18:34 ` Darrick J. Wong
2020-02-21 0:01 ` Dave Chinner
2020-02-21 0:39 ` Darrick J. Wong
2020-02-21 1:17 ` Dave Chinner
2020-02-20 1:42 ` [PATCH 6/8] mkfs: " Darrick J. Wong
2020-02-20 1:42 ` [PATCH 7/8] xfs_repair: " Darrick J. Wong
2020-02-20 1:42 ` [PATCH 8/8] libfrog: always fsync when flushing a device Darrick J. Wong
2020-02-20 14:06 ` Brian Foster [this message]
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=20200220140630.GD48977@bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.