From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Allison Collins <allison.henderson@oracle.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/4] libxfs: return flush failures
Date: Tue, 18 Feb 2020 20:38:02 -0800 [thread overview]
Message-ID: <20200219043802.GI9506@magnolia> (raw)
In-Reply-To: <d98bdc0b-e3f1-2c00-90df-8a38388a2651@oracle.com>
On Thu, Feb 06, 2020 at 12:38:06PM -0700, Allison Collins wrote:
>
> On 2/4/20 5:47 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Modify platform_flush_device so that we can return error status when
> > device flushes fail.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> I think there's one other place in init.c where platform_flush_device is
> called, but I suppose it didn't need the return code before?
I think the lack of error checking is/was just plain broken, seeing as
the current libxfs_close() code path just eats errors.
However, now that everyone calls libxfs_flush() to find out which
devices (if any) succeeded in flushing, I think there's less need to go
reworking that whole code path.
--D
> Other than that it looks ok.
> Reviewed-by: Allison Collins <allison.henderson@oracle.com>
>
> > ---
> > libfrog/linux.c | 25 +++++++++++++++++--------
> > libfrog/platform.h | 2 +-
> > 2 files changed, 18 insertions(+), 9 deletions(-)
> >
> >
> > diff --git a/libfrog/linux.c b/libfrog/linux.c
> > index 41a168b4..60bc1dc4 100644
> > --- a/libfrog/linux.c
> > +++ b/libfrog/linux.c
> > @@ -140,20 +140,29 @@ platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fata
> > return error;
> > }
> > -void
> > -platform_flush_device(int fd, dev_t device)
> > +/*
> > + * Flush dirty pagecache and disk write cache to stable media. Returns 0 for
> > + * success or -1 (with errno set) for failure.
> > + */
> > +int
> > +platform_flush_device(
> > + int fd,
> > + dev_t device)
> > {
> > struct stat st;
> > + int ret;
> > +
> > if (major(device) == RAMDISK_MAJOR)
> > - return;
> > + return 0;
> > - if (fstat(fd, &st) < 0)
> > - return;
> > + ret = fstat(fd, &st);
> > + if (ret)
> > + return ret;
> > if (S_ISREG(st.st_mode))
> > - fsync(fd);
> > - else
> > - ioctl(fd, BLKFLSBUF, 0);
> > + return fsync(fd);
> > +
> > + return ioctl(fd, BLKFLSBUF, 0);
> > }
> > void
> > diff --git a/libfrog/platform.h b/libfrog/platform.h
> > index 76887e5e..0aef318a 100644
> > --- a/libfrog/platform.h
> > +++ b/libfrog/platform.h
> > @@ -12,7 +12,7 @@ int platform_check_ismounted(char *path, char *block, struct stat *sptr,
> > int platform_check_iswritable(char *path, char *block, struct stat *sptr);
> > int platform_set_blocksize(int fd, char *path, dev_t device, int bsz,
> > int fatal);
> > -void platform_flush_device(int fd, dev_t device);
> > +int platform_flush_device(int fd, dev_t device);
> > char *platform_findrawpath(char *path);
> > char *platform_findblockpath(char *path);
> > int platform_direct_blockdev(void);
> >
next prev parent reply other threads:[~2020-02-19 4:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-05 0:47 [PATCH 0/4] libxfs: actually check that writes succeeded Darrick J. Wong
2020-02-05 0:47 ` [PATCH 1/4] libxfs: libxfs_buf_delwri_submit should write buffers immediately Darrick J. Wong
2020-02-06 19:37 ` Allison Collins
2020-02-17 13:57 ` Christoph Hellwig
2020-02-19 5:42 ` Darrick J. Wong
2020-02-05 0:47 ` [PATCH 2/4] libxfs: complain when write IOs fail Darrick J. Wong
2020-02-06 19:38 ` Allison Collins
2020-02-17 13:57 ` Christoph Hellwig
2020-02-05 0:47 ` [PATCH 3/4] libxfs: return flush failures Darrick J. Wong
2020-02-06 19:38 ` Allison Collins
2020-02-19 4:38 ` Darrick J. Wong [this message]
2020-02-17 14:00 ` Christoph Hellwig
2020-02-19 4:39 ` Darrick J. Wong
2020-02-05 0:47 ` [PATCH 4/4] misc: make all tools check that metadata updates have been committed Darrick J. Wong
2020-02-06 19:38 ` Allison Collins
2020-02-19 5:42 ` Darrick J. Wong
2020-02-17 14:01 ` Christoph Hellwig
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=20200219043802.GI9506@magnolia \
--to=darrick.wong@oracle.com \
--cc=allison.henderson@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 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).