All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: linux-xfs@vger.kernel.org
Subject: Re: [RFC PATCH] db: Stop core dumping on attr3 if block header is not recognized
Date: Mon, 23 Apr 2018 08:54:37 -0600	[thread overview]
Message-ID: <aba7b7cd-e6ec-62c1-dfac-b7c3e87ed2f9@sandeen.net> (raw)
In-Reply-To: <20180423082646.wmz4vkhhuysdbepd@odin.usersys.redhat.com>



On 4/23/18 2:26 AM, Carlos Maiolino wrote:
>> So it seems like casting it into something the user might expect would
>> be better?
>>
> Not sure, in this case, the 'user' is expaecting an attr3 type, while xfs_db is
> reading some other random, non attr3 type block. So, I wonder, what you meant by
> 'something the user might expect'? The way I view it is: "The user is expecting
> attr3 type", but there is no attr3 data in the block being read, so, the way I
> understand what you meant, was trying to print the current block using attr3
> format, which, IMHO, might fool the xfs_db user. I think saying the block
> doesn't match attr3 format, and printing a possible magic number found in the
> block works better. After all, xfs_db is a developer tool, not an user tool. If
> I use myself and my xfs_db usage as an example:
> If I try to print some block as attr3, and I see a message saying no attr3
> format has been found, and I got a dump of a possible magic number, I can check
> if that magic number matches some metadata format, or if it doesn't look as a
> magic at all, I can simply consider the block corrupted. But well, this is just
> my way to view it.
> 

So, don't get too hung up on your "it's not actually an attr3 block" testcase;
imagine the scenario where it /is/ an attr3 block, but the magic is
corrupted.  Now imagine that you want to examine the block (to see what the magic
was, and what the other fields were, and if it even looks like an attr3 block,
or something else), and possibly even fix a field manually.

If all you get is "unknown" that's not very helpful.  You /could/ hexdump it
and count bytes, but that sucks.

If you tried the same thing on i.e. an agf header (with bitflipped magic) you
would still be able to print the whole structure, and see what was wrong.

Because attr3 only prints semi-validated blocks today, and refuses to show you
anything that doesn't match, it's a far more difficult situation.  The root
cause is that "attr3" is a multiplexer that will really decide between 3 different
formats, but will /only/ show you one of the 3 if the magic is undamaged.

That's why I was wondering about explicit types for the leaf/block etc so you
can force xfs_db to show it to you in that format (like you could with i.e. agf).

Meh, for now maybe I will just merge the "don't segfault" patch, it's at least an
improvement.  A nicer outcome isn't our most pressing problem I guess.

-Eric

  reply	other threads:[~2018-04-23 14:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18  9:49 [RFC PATCH] db: Stop core dumping on attr3 if block header is not recognized Carlos Maiolino
2018-04-18 15:44 ` Darrick J. Wong
2018-04-19  8:47   ` Carlos Maiolino
2018-04-19  9:13   ` Carlos Maiolino
2018-04-19 20:01     ` Darrick J. Wong
2018-04-19 20:18       ` Eric Sandeen
2018-04-19 20:21         ` Eric Sandeen
2018-04-23  9:11         ` Carlos Maiolino
2018-04-19 20:12 ` Eric Sandeen
2018-04-23  8:26   ` Carlos Maiolino
2018-04-23 14:54     ` Eric Sandeen [this message]
2018-04-30 10:30       ` 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=aba7b7cd-e6ec-62c1-dfac-b7c3e87ed2f9@sandeen.net \
    --to=sandeen@sandeen.net \
    --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 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.