Bug 123456 - fstat(1): /usr/bin/fstat shows error messages and hang.
Summary: fstat(1): /usr/bin/fstat shows error messages and hang.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: amd64 (show other bugs)
Version: 8.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-amd64 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-06 12:00 UTC by KOIE Hidetaka
Modified: 2010-12-05 13:54 UTC (History)
0 users

See Also:


Attachments
file.diff (3.76 KB, patch)
2008-05-06 12:00 UTC, KOIE Hidetaka
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description KOIE Hidetaka 2008-05-06 12:00:04 UTC
        fstat -v shows error message like this:
                can't read vnode at 0x0 for pid ***
                can't read znode_phys at 0x**** for pid ***
                unknown file type 5 for file 5 of pid ***

        fstat / hangs.

Fix: Patch for "can't read vnode at 0x0 for pid ***":
        vtrans() is invoked iff vp is not null.

        Patch for "can't read znode_phys at 0x**** for pid ***":
        znode_phys is void *, not int.

        Patch for "unknown file type 5 for file 5 of pid ***":
        consider other DTYPEs.

        Patch for hanging:
        sysctl "debug.sizeof.znode" returns int, not size_t.


Patch attached with submission follows:
Comment 1 dfilter service freebsd_committer 2008-05-07 18:49:39 UTC
jhb         2008-05-07 17:49:31 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/fstat        fstat.c 
  Log:
  Only output details about the current working directory of a process if
  the vnode pointer is not NULL.  This avoids spurious warnings in fstat -v
  output for kernel processes.
  
  MFC after:      1 week
  PR:             amd64/123456
  Submitted by:   KOIE Hidetaka | hide koie.org
  
  Revision  Changes    Path
  1.66      +2 -1      src/usr.bin/fstat/fstat.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 2 dfilter service freebsd_committer 2008-05-07 18:55:36 UTC
jhb         2008-05-07 17:55:28 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/fstat        zfs.c 
  Log:
  The debug.sizeof.znode sysctl returns an int, not a size_t.  This can cause
  a hang on 64-bit platforms.
  
  MFC after:      1 week
  PR:             amd64/123456
  Submitted by:   KOIE Hidetaka | hide koie.org
  
  Revision  Changes    Path
  1.3       +3 -2      src/usr.bin/fstat/zfs.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 dfilter service freebsd_committer 2008-05-07 19:27:45 UTC
jhb         2008-05-07 18:27:38 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/fstat        zfs.c 
  Log:
  Fix reading the address of a znode_phys from a znode on 64-bit platforms
  where sizeof(pointer) != sizeof(int).
  
  MFC after:      1 week
  PR:             amd64/123456
  Submitted by:   KOIE Hidetaka | hide koie.org
  
  Revision  Changes    Path
  1.4       +3 -3      src/usr.bin/fstat/zfs.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 4 John Baldwin freebsd_committer freebsd_triage 2008-05-07 19:29:27 UTC
On Tuesday 06 May 2008 06:53:42 am KOIE Hidetaka wrote:
> >Description:
>         fstat -v shows error message like this:
>                 can't read vnode at 0x0 for pid ***
>                 can't read znode_phys at 0x**** for pid ***
>                 unknown file type 5 for file 5 of pid ***
> 
>         fstat / hangs.
> 
> >How-To-Repeat:
> 
> >Fix:
>         Patch for "can't read vnode at 0x0 for pid ***":
>         vtrans() is invoked iff vp is not null.
> 
>         Patch for "can't read znode_phys at 0x**** for pid ***":
>         znode_phys is void *, not int.
> 
>         Patch for "unknown file type 5 for file 5 of pid ***":
>         consider other DTYPEs.
> 
>         Patch for hanging:
>         sysctl "debug.sizeof.znode" returns int, not size_t.

I've applied all of the fixes except for the 3rd one.  I think that each file 
type should show up as unknown until support for it is added to fstat.

-- 
John Baldwin
Comment 5 KOIE Hidetaka 2008-05-08 07:41:11 UTC
  Message-Id: <200805071429.27293.jhb@freebsd.org>
  Date:       Wed, 7 May 2008 14:29:27 -0400
  From:       John Baldwin <jhb@freebsd.org>
  Subject:    Re: amd64/123456: /usr/bin/fstat shows error messages an..

  | On Tuesday 06 May 2008 06:53:42 am KOIE Hidetaka wrote:
  | > >Description:
  | >         fstat -v shows error message like this:
  | >                 can't read vnode at 0x0 for pid ***
  | >                 can't read znode_phys at 0x**** for pid ***
  | >                 unknown file type 5 for file 5 of pid ***
  | > 
  | >         fstat / hangs.
  | > 
  | > >How-To-Repeat:
  | > 
  | > >Fix:
  | >         Patch for "can't read vnode at 0x0 for pid ***":
  | >         vtrans() is invoked iff vp is not null.
  | > 
  | >         Patch for "can't read znode_phys at 0x**** for pid ***":
  | >         znode_phys is void *, not int.
  | > 
  | >         Patch for "unknown file type 5 for file 5 of pid ***":
  | >         consider other DTYPEs.
  | > 
  | >         Patch for hanging:
  | >         sysctl "debug.sizeof.znode" returns int, not size_t.
  | 
  | I've applied all of the fixes except for the 3rd one.  I think that each file 
  | type should show up as unknown until support for it is added to fstat.

Yes, any message should be showed.  But,
"unknown file type" impresses user-kernel version mismatch to me...

--
KOIE Hidetaka <hide@koie.org>
Comment 6 Jaakko Heinonen freebsd_committer 2010-01-17 16:37:09 UTC
State Changed
From-To: open->patched

Patched in head and stable/8 (r178831, r178832 and r178833).
Comment 7 Andriy Gapon freebsd_committer 2010-12-05 13:53:37 UTC
State Changed
From-To: patched->closed

I think that the problem can be considered resolved and 
there is no reason to keep this PR open.