From: Eryu Guan <guaneryu@gmail.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Carlos Maiolino <cmaiolino@redhat.com>,
fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] t_stripealign: Fix fibmap error handling
Date: Sun, 25 Aug 2019 21:41:54 +0800 [thread overview]
Message-ID: <20190825134154.GB2622@desktop> (raw)
In-Reply-To: <20190823143650.GI1037350@magnolia>
On Fri, Aug 23, 2019 at 07:36:50AM -0700, Darrick J. Wong wrote:
> On Fri, Aug 23, 2019 at 11:25:30AM +0200, Carlos Maiolino wrote:
> > FIBMAP only returns a negative value when the underlying filesystem does
> > not support FIBMAP or on permission error. For the remaining errors,
> > i.e. those usually returned from the filesystem itself, zero will be
> > returned.
> >
> > We can not trust a zero return from the FIBMAP, and such behavior made
> > generic/223 succeed when it should not.
> >
> > Also, we can't use perror() only to print errors when FIBMAP failed, or
> > it will simply print 'success' when a zero is returned.
> >
> > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> > ---
> > src/t_stripealign.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/t_stripealign.c b/src/t_stripealign.c
> > index 5cdadaae..164831f8 100644
> > --- a/src/t_stripealign.c
> > +++ b/src/t_stripealign.c
> > @@ -76,8 +76,11 @@ int main(int argc, char ** argv)
> > unsigned int bmap = 0;
> >
> > ret = ioctl(fd, FIBMAP, &bmap);
> > - if (ret < 0) {
> > - perror("fibmap");
> > + if (ret <= 0) {
> > + if (ret < 0)
> > + perror("fibmap");
> > + else
> > + fprintf(stderr, "fibmap error\n");
>
> "fibmap returned no result"?
Fixed on commit. Thanks!
Eryu
next prev parent reply other threads:[~2019-08-25 13:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 9:25 [PATCH] t_stripealign: Fix fibmap error handling Carlos Maiolino
2019-08-23 14:36 ` Darrick J. Wong
2019-08-25 13:41 ` Eryu Guan [this message]
2019-08-26 6:48 ` Carlos Maiolino
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=20190825134154.GB2622@desktop \
--to=guaneryu@gmail.com \
--cc=cmaiolino@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=fstests@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).