public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* any way to work backwards from xfs_inode_t to a filename?
@ 2013-05-15 21:58 Chris Friesen
  2013-05-15 22:10 ` Ben Myers
  2013-05-15 22:20 ` Dave Chinner
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Friesen @ 2013-05-15 21:58 UTC (permalink / raw)
  To: Ben Myers, Alex Elder, xfs


Hi all,

As I mentioned before I'm digging into some intermittent xfs corruption 
issues on an embedded system running a 2.6.27-based kernel.

In one case I've hit XFS_WANT_CORRUPTED_GOTO in xfs_free_ag_extent(). 
In this particular case the call chain was

xfs_free_ag_extent+0x55d/0x6e0
xfs_free_extent+0xac/0xd0
xfs_bmap_finish+0x156/0x1a0
xfs_itruncate_finish+0x137/0x340
xfs_inactive+0x386/0x4b0
xfs_fs_clear_inode+0xc6/0x120
clear_inode+0x58/0x110
generic_delete_inode+0xff/0x110
generic_drop_inode+0x16d/0x190
iput+0x5d/0x70
do_unlinkat+0x147/0x280
sys_unlinkat+0x1d/0x40

I have two questions:

1) do_unlinkat() has the filesystem path, but iput() returns void.  Is 
there any way for me to add instrumentation to xfs_inactive() to work 
backwards from the xfs_inode_t pointer to print out a path to the file 
being deleted?

2) If this sort of corruption happens again, what's my best bet for 
figuring out the source of the problem?  This is an embedded system, so 
I need to be able to automate any data gathering (after which we'll run 
xfs_repair so we can return to service--any manual analysis will need to 
happen later based on stored data).

Thanks,
Chris



-- 

Chris Friesen
Software Designer
www.genband.com
office:+1.343.883.2717

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: any way to work backwards from xfs_inode_t to a filename?
  2013-05-15 21:58 any way to work backwards from xfs_inode_t to a filename? Chris Friesen
@ 2013-05-15 22:10 ` Ben Myers
  2013-05-15 22:19   ` Eric Sandeen
  2013-05-15 22:20 ` Dave Chinner
  1 sibling, 1 reply; 6+ messages in thread
From: Ben Myers @ 2013-05-15 22:10 UTC (permalink / raw)
  To: Chris Friesen; +Cc: Alex Elder, xfs

Hey Chris,

On Wed, May 15, 2013 at 03:58:35PM -0600, Chris Friesen wrote:
> As I mentioned before I'm digging into some intermittent xfs
> corruption issues on an embedded system running a 2.6.27-based
> kernel.
> 
> In one case I've hit XFS_WANT_CORRUPTED_GOTO in
> xfs_free_ag_extent(). In this particular case the call chain was
> 
> xfs_free_ag_extent+0x55d/0x6e0
> xfs_free_extent+0xac/0xd0
> xfs_bmap_finish+0x156/0x1a0
> xfs_itruncate_finish+0x137/0x340
> xfs_inactive+0x386/0x4b0
> xfs_fs_clear_inode+0xc6/0x120
> clear_inode+0x58/0x110
> generic_delete_inode+0xff/0x110
> generic_drop_inode+0x16d/0x190
> iput+0x5d/0x70
> do_unlinkat+0x147/0x280
> sys_unlinkat+0x1d/0x40
> 
> I have two questions:
> 
> 1) do_unlinkat() has the filesystem path, but iput() returns void.
> Is there any way for me to add instrumentation to xfs_inactive() to
> work backwards from the xfs_inode_t pointer to print out a path to
> the file being deleted?

Use VFS_I to get to a 'struct inode' and from there you can look at the
dentries on i_dentry list and traverse back through the path by looking at
d_parent.  Might be easier to just print the path in do_unlinkat?

> 2) If this sort of corruption happens again, what's my best bet for
> figuring out the source of the problem?  This is an embedded system,
> so I need to be able to automate any data gathering (after which
> we'll run xfs_repair so we can return to service--any manual
> analysis will need to happen later based on stored data).

Can you grab a metadump before you repair the filesystem?

Thanks,
	Ben

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: any way to work backwards from xfs_inode_t to a filename?
  2013-05-15 22:10 ` Ben Myers
@ 2013-05-15 22:19   ` Eric Sandeen
  2013-05-15 23:04     ` Ben Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Sandeen @ 2013-05-15 22:19 UTC (permalink / raw)
  To: Ben Myers; +Cc: Chris Friesen, Alex Elder, xfs

On 5/15/13 5:10 PM, Ben Myers wrote:
> Hey Chris,
> 
> On Wed, May 15, 2013 at 03:58:35PM -0600, Chris Friesen wrote:
>> As I mentioned before I'm digging into some intermittent xfs
>> corruption issues on an embedded system running a 2.6.27-based
>> kernel.
>>
>> In one case I've hit XFS_WANT_CORRUPTED_GOTO in
>> xfs_free_ag_extent(). In this particular case the call chain was
>>
>> xfs_free_ag_extent+0x55d/0x6e0
>> xfs_free_extent+0xac/0xd0
>> xfs_bmap_finish+0x156/0x1a0
>> xfs_itruncate_finish+0x137/0x340
>> xfs_inactive+0x386/0x4b0
>> xfs_fs_clear_inode+0xc6/0x120
>> clear_inode+0x58/0x110
>> generic_delete_inode+0xff/0x110
>> generic_drop_inode+0x16d/0x190
>> iput+0x5d/0x70
>> do_unlinkat+0x147/0x280
>> sys_unlinkat+0x1d/0x40
>>
>> I have two questions:
>>
>> 1) do_unlinkat() has the filesystem path, but iput() returns void.
>> Is there any way for me to add instrumentation to xfs_inactive() to
>> work backwards from the xfs_inode_t pointer to print out a path to
>> the file being deleted?
> 
> Use VFS_I to get to a 'struct inode' and from there you can look at the
> dentries on i_dentry list and traverse back through the path by looking at
> d_parent.  Might be easier to just print the path in do_unlinkat?

or just print out the inode nr (i_ino) and do a find -inum after the fact.  :)

-Eric </lazy>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: any way to work backwards from xfs_inode_t to a filename?
  2013-05-15 21:58 any way to work backwards from xfs_inode_t to a filename? Chris Friesen
  2013-05-15 22:10 ` Ben Myers
@ 2013-05-15 22:20 ` Dave Chinner
  1 sibling, 0 replies; 6+ messages in thread
From: Dave Chinner @ 2013-05-15 22:20 UTC (permalink / raw)
  To: Chris Friesen; +Cc: Ben Myers, Alex Elder, xfs

On Wed, May 15, 2013 at 03:58:35PM -0600, Chris Friesen wrote:
> 
> Hi all,
> 
> As I mentioned before I'm digging into some intermittent xfs
> corruption issues on an embedded system running a 2.6.27-based
> kernel.
> 
> In one case I've hit XFS_WANT_CORRUPTED_GOTO in
> xfs_free_ag_extent(). In this particular case the call chain was
> 
> xfs_free_ag_extent+0x55d/0x6e0
> xfs_free_extent+0xac/0xd0
> xfs_bmap_finish+0x156/0x1a0
> xfs_itruncate_finish+0x137/0x340
> xfs_inactive+0x386/0x4b0
> xfs_fs_clear_inode+0xc6/0x120
> clear_inode+0x58/0x110
> generic_delete_inode+0xff/0x110
> generic_drop_inode+0x16d/0x190
> iput+0x5d/0x70
> do_unlinkat+0x147/0x280
> sys_unlinkat+0x1d/0x40
> 
> I have two questions:
> 
> 1) do_unlinkat() has the filesystem path, but iput() returns void.
> Is there any way for me to add instrumentation to xfs_inactive() to
> work backwards from the xfs_inode_t pointer to print out a path to
> the file being deleted?

You can't from there - the inode is being cycled out of cache, which
means it does not have a dentry attached anymore and so no path can
be found from there. The best you can do is print out the inode
number, and then use something like "find -inum <ino>" or the xfs_db
equivalent (man xfs_ncheck).

> 2) If this sort of corruption happens again, what's my best bet for
> figuring out the source of the problem?  This is an embedded system,
> so I need to be able to automate any data gathering (after which
> we'll run xfs_repair so we can return to service--any manual
> analysis will need to happen later based on stored data).

Forensic analsys of the filesystem and clear information about what
the state of the filesystem was in memory whenteh problem was
tripped over is generally the only way to get to the bottom of these
problems. i.e. kernel crash dumps triggered by setting the panic
mask appropriately, and then taking an xfs_metadump of the
filesystem before the filesystem is remounted, and then again after
the filesystem is mounted and log recovery has run....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: any way to work backwards from xfs_inode_t to a filename?
  2013-05-15 22:19   ` Eric Sandeen
@ 2013-05-15 23:04     ` Ben Myers
  2013-05-16 15:44       ` Chris Friesen
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Myers @ 2013-05-15 23:04 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Chris Friesen, Alex Elder, xfs

Chris,

On Wed, May 15, 2013 at 05:19:52PM -0500, Eric Sandeen wrote:
> On 5/15/13 5:10 PM, Ben Myers wrote:
> >> 1) do_unlinkat() has the filesystem path, but iput() returns void.
> >> Is there any way for me to add instrumentation to xfs_inactive() to
> >> work backwards from the xfs_inode_t pointer to print out a path to
> >> the file being deleted?
> > 
> > Use VFS_I to get to a 'struct inode' and from there you can look at the
> > dentries on i_dentry list and traverse back through the path by looking at
> > d_parent.  Might be easier to just print the path in do_unlinkat?
> 
> or just print out the inode nr (i_ino) and do a find -inum after the fact.  :)

+1

Dave pointed out that you might not be able to get to the inode at this point
in the lifecycle.  Apologies if I posted misinformation.  ;)

Regards,
	Ben

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: any way to work backwards from xfs_inode_t to a filename?
  2013-05-15 23:04     ` Ben Myers
@ 2013-05-16 15:44       ` Chris Friesen
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Friesen @ 2013-05-16 15:44 UTC (permalink / raw)
  To: Ben Myers; +Cc: Alex Elder, Eric Sandeen, xfs

On 05/15/2013 05:04 PM, Ben Myers wrote:
> Chris,
>
> On Wed, May 15, 2013 at 05:19:52PM -0500, Eric Sandeen wrote:
>> On 5/15/13 5:10 PM, Ben Myers wrote:
>>>> 1) do_unlinkat() has the filesystem path, but iput() returns void.
>>>> Is there any way for me to add instrumentation to xfs_inactive() to
>>>> work backwards from the xfs_inode_t pointer to print out a path to
>>>> the file being deleted?
>>>
>>> Use VFS_I to get to a 'struct inode' and from there you can look at the
>>> dentries on i_dentry list and traverse back through the path by looking at
>>> d_parent.  Might be easier to just print the path in do_unlinkat?
>>
>> or just print out the inode nr (i_ino) and do a find -inum after the fact.  :)
>
> +1
>
> Dave pointed out that you might not be able to get to the inode at this point
> in the lifecycle.  Apologies if I posted misinformation.  ;)

Thanks guys,

I'm headed away for a few days so it'll be a while before I can dig into 
this again, but this should give me a good start.

Chris

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-16 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 21:58 any way to work backwards from xfs_inode_t to a filename? Chris Friesen
2013-05-15 22:10 ` Ben Myers
2013-05-15 22:19   ` Eric Sandeen
2013-05-15 23:04     ` Ben Myers
2013-05-16 15:44       ` Chris Friesen
2013-05-15 22:20 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox