public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* xfs_db problem
@ 2009-01-07 14:34 aluno
  2009-01-07 14:43 ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: aluno @ 2009-01-07 14:34 UTC (permalink / raw)
  To: xfs


Hello,

Recently we've noticed that xfs_admin (xfs_db ver. 2.10.2) causes
segfault or FP traps while trying
to use following command on FAT partition:

# xfs_admin -u /dev/sda1
xfs_admin: unexpected XFS SB magic number 0xeb58906d
Floating point exception

and then makes error in dmesg:

xfs_db[10385] trap divide error ip:80b32b0 sp:fffbd900 error:0 in
xfs_db[8048000+7f000]

We know that xfs_admin is dedicated tool for XFS only not for FAT or
other filesystems,
but we would like to have xfs_db which will be able to cope with non-xfs
filesystems also.

After some investigations we've found some place and put there exit(1) -
in xfsprogs-2.10.2/db/init.c

in init() procedure:

    (...)
        sbp = &xmount.m_sb;
        if (sbp->sb_magicnum != XFS_SB_MAGIC) {
                fprintf(stderr, _("%s: unexpected XFS SB magic number
0x%08x\n"),
                        progname, sbp->sb_magicnum);
                exit(1);
        }
    (...)



Is it the right way to fix this problem?

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

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

* xfs_db problem
@ 2009-01-07 14:37 aluno3
  0 siblings, 0 replies; 4+ messages in thread
From: aluno3 @ 2009-01-07 14:37 UTC (permalink / raw)
  To: xfs

Hello,

Recently we've noticed that xfs_admin (xfs_db ver. 2.10.2) causes
segfault or FP traps while trying
to use following command on FAT partition:

# xfs_admin -u /dev/sda1
xfs_admin: unexpected XFS SB magic number 0xeb58906d
Floating point exception

and then makes error in dmesg:

xfs_db[10385] trap divide error ip:80b32b0 sp:fffbd900 error:0 in
xfs_db[8048000+7f000]

We know that xfs_admin is dedicated tool for XFS only not for FAT or
other filesystems,
but we would like to have xfs_db which will be able to cope with non-xfs
filesystems also.

After some investigations we've found some place and put there exit(1) -
in xfsprogs-2.10.2/db/init.c

in init() procedure:

    (...)
        sbp = &xmount.m_sb;
        if (sbp->sb_magicnum != XFS_SB_MAGIC) {
                fprintf(stderr, _("%s: unexpected XFS SB magic number
0x%08x\n"),
                        progname, sbp->sb_magicnum);
                exit(1);
        }
    (...)



Is it the right way to fix this problem?


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

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

* Re: xfs_db problem
  2009-01-07 14:34 xfs_db problem aluno
@ 2009-01-07 14:43 ` Eric Sandeen
  2009-01-07 17:46   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2009-01-07 14:43 UTC (permalink / raw)
  To: aluno; +Cc: xfs

aluno wrote:
> Hello,
> 
> Recently we've noticed that xfs_admin (xfs_db ver. 2.10.2) causes
> segfault or FP traps while trying
> to use following command on FAT partition:
> 
> # xfs_admin -u /dev/sda1
> xfs_admin: unexpected XFS SB magic number 0xeb58906d
> Floating point exception
> 
> and then makes error in dmesg:
> 
> xfs_db[10385] trap divide error ip:80b32b0 sp:fffbd900 error:0 in
> xfs_db[8048000+7f000]
> 
> We know that xfs_admin is dedicated tool for XFS only not for FAT or
> other filesystems,
> but we would like to have xfs_db which will be able to cope with non-xfs
> filesystems also.
> 
> After some investigations we've found some place and put there exit(1) -
> in xfsprogs-2.10.2/db/init.c
> 
> in init() procedure:
> 
>     (...)
>         sbp = &xmount.m_sb;
>         if (sbp->sb_magicnum != XFS_SB_MAGIC) {
>                 fprintf(stderr, _("%s: unexpected XFS SB magic number
> 0x%08x\n"),
>                         progname, sbp->sb_magicnum);
>                 exit(1);
>         }
>     (...)
> 
> 
> 
> Is it the right way to fix this problem?

The thing is, xfs_db could in theory be used to *fix* the bad magic
number, so refusing to continue might be a problem.  But perhaps when
invoked as xfs_admin, it should just bail out.  It would be interesting
to find where the actual failure is, though...

FWIW, I see a slightly different failure on a 128M vfat fs:

[root@host tmp]# file fsfile
fsfile: x86 boot sector, mkdosfs boot message display
[root@host tmp]# xfs_admin -u fsfile
xfs_admin: unexpected XFS SB magic number 0xeb3c906d
xfs_admin: size check failed
xfs_admin: failed to alloc 20875030464 bytes: Cannot allocate memory

It probably depends on the details of the (non-xfs) filesystem it's
pointed at.

-Eric

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

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

* Re: xfs_db problem
  2009-01-07 14:43 ` Eric Sandeen
@ 2009-01-07 17:46   ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2009-01-07 17:46 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: aluno, xfs

On Wed, Jan 07, 2009 at 08:43:10AM -0600, Eric Sandeen wrote:
> The thing is, xfs_db could in theory be used to *fix* the bad magic
> number, so refusing to continue might be a problem.  But perhaps when
> invoked as xfs_admin, it should just bail out.  It would be interesting
> to find where the actual failure is, though...

We have bugzilla open for this, too.  I think it's reasonable to
get a warning, but not the additional problems when calling xfs_db
directly because that's a low-level tool for people that know what
they do.

But when called through wrappers like xfs_admin we should first do
the magic number check.  I think the proper way to implement this
is to add an option to xfs_db to perform the magic number check,
and make sure all the wrapper scripts set it, similar to how they
already use -p <progname>.

Any volunteer to implement this?  It should be fairly simple.

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

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

end of thread, other threads:[~2009-01-07 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 14:34 xfs_db problem aluno
2009-01-07 14:43 ` Eric Sandeen
2009-01-07 17:46   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2009-01-07 14:37 aluno3

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