From: Theodore Ts'o <tytso@mit.edu>
To: Chris Hunter <chris.hunter@yale.edu>
Cc: linux-ext4@vger.kernel.org
Subject: Re: e2fsck discrepancy with debugfs stat ?
Date: Fri, 11 Sep 2015 13:55:51 -0400 [thread overview]
Message-ID: <20150911175551.GD31723@thunk.org> (raw)
In-Reply-To: <55F2449D.9090000@yale.edu>
On Thu, Sep 10, 2015 at 11:03:57PM -0400, Chris Hunter wrote:
> Are there scenarios where e2fsck will report a deleted/unused inode but
> debugfs is able to read the inode structure ?
When e2fsck reports that an inode is deleted/unused, it means that the
i_links_count field in the inode is zero. If that happens, it's
possible that the blocks previously associated with inode have been
reassigned, and so may contain someone else's love letters, medical
records, etc., and so the ext4 file system will report a corruption,
and allow you to read the inode, and e2fsck assumes that the
appropriate resolution to the problem is to clear the directory entry.
(After all, you wouldn't want to accidentally commit a HIPPA
violation, when fines for violations range $100 to $50,000 per record,
would you? Not to mention potentially getting lots of terrible Yelp
reviews. :-)
> However when I run command debugfs -c -R "stat /O/0/d19/131249395" <DEV>, I
> can retrieve inode contents. Further debugfs "dump" will successfully pull
> the contents (980 bytes) of the file entry.
You can do anything with with debugfs. Debugfs doesn't care if the
i_links_count field is zero, so it will happily return whatever might
be pointed to by that inode.
In terms of what might cause this, unless someone has been
manipulating file system structures using debugfs (for example,
"set_inode_field /O/0/d19/131249395 i_links_count 0"), it shouldn't
happen modulo hardware or software malfunctions / bugs. For example,
if you are using a SSD which isn't power failure protected (most
consumer-grade SSD's aren't) after a power failure, even if the file
system is properly using cache flush commands, if the SSD isn't set up
to make sure the SSD's metadata is properly saved to stable storage
after a power failure, the underlying file system can get corrupted.
- Ted
next prev parent reply other threads:[~2015-09-11 17:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 3:03 e2fsck discrepancy with debugfs stat ? Chris Hunter
2015-09-11 12:39 ` Chris Hunter
2015-09-11 17:55 ` Theodore Ts'o [this message]
2015-09-11 19:59 ` Chris Hunter
2015-09-12 2:09 ` Theodore Ts'o
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=20150911175551.GD31723@thunk.org \
--to=tytso@mit.edu \
--cc=chris.hunter@yale.edu \
--cc=linux-ext4@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).