From: David Sterba <dsterba@suse.cz>
To: Zach Brown <zab@redhat.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs: return errno instead of -1 from compression
Date: Mon, 12 May 2014 16:20:52 +0200 [thread overview]
Message-ID: <20140512142052.GC6917@suse.cz> (raw)
In-Reply-To: <20140509204015.GB23244@lenny.home.zabbo.net>
On Fri, May 09, 2014 at 01:40:15PM -0700, Zach Brown wrote:
> > > @@ -335,7 +335,7 @@ cont:
> > > break;
> > >
> > > if (page_in_index + 1 >= total_pages_in) {
> > > - ret = -1;
> > > + ret = -EIO;
> >
> > That looks like an internal error, we should never ask for more pages
> > than is in the input, so the buffer offset calculations are wrong.
>
> Yeah, but EIO is still arguably the right thing. There's nothing
> userspace can do about broken kernel code. We don't want to give them
> an error that could be misinterpreted as them having used an interface
> incorrectly. We could wrap WARN_ON_ONCE() around it, I suppose. I'm
> inclined to leave it as is.
Ok. An EIO is better than an ASSERT or BUG_ON, the error paths will
handle it. I think adding the WARN_ON_ONCE is a good compromise, I'm not
expecting to see this error but the stack trace will help.
prev parent reply other threads:[~2014-05-12 14:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 23:16 [PATCH 1/3] btrfs: return errno instead of -1 from compression Zach Brown
2014-05-08 23:16 ` [PATCH 2/3] btrfs: return ptr error from compression workspace Zach Brown
2014-05-09 13:40 ` David Sterba
2014-05-08 23:16 ` [PATCH 3/3] btrfs: fix inline compressed read err corruption Zach Brown
2014-05-09 13:58 ` David Sterba
2014-05-09 20:32 ` Zach Brown
2014-05-12 15:00 ` Liu Bo
2014-05-12 17:18 ` David Sterba
2014-05-14 13:12 ` Chris Mason
2014-05-09 13:39 ` [PATCH 1/3] btrfs: return errno instead of -1 from compression David Sterba
2014-05-09 20:40 ` Zach Brown
2014-05-12 14:20 ` David Sterba [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=20140512142052.GC6917@suse.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=zab@redhat.com \
/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.