Subject: Re: UFS2 problem?
To: Daniel Carosone <dan@geek.com.au>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: current-users
Date: 04/10/2003 15:01:36
--ELM744631910-1425-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII

Daniel Carosone wrote:
> In all this time, fsck says the filesystem is clean (even after
> -f). But there are a different set of files giving this error.
> 
> It looks like the problem is in the kernel reading the fs, more
> likely than in fsck, to me.

I encountered this problem today for one file, and did some digging.

This EBADF appears to be coming from vn_stat(), where file's vnode
v_type appears to not be one of 'valid' types. Both stat(2)
and fstat(2) consistently return EBADF and this is the only
place where I can see EBADF could end up returned.

According to directory contents, 'my' file used inode #196.  The
directory entry was apparently correct, including correct file type
(DT_REG).  I'm attaching the directory dump (cat /) to this mail,
it's file /.profile.

It was possible to open the file for reading. Attempt to read file
contents froze the machine (was in X, had to use power switch).

After reboot, there was a situation where fsck found an
UNALLOCATED inodes and dropped to singleuser, but  apparently
singleuser shell read /.profile, and hit the 'ffs_read: type 0' DIAGNOSTIC
check in ufs_readwrite.c. Very likely, this DIAGNOSTIC check
was the cause of the previous 'freeze' too.
After booting from rescue floppy (thanks Luke!), bunch of
inodes in range ~ #192-#250 ended up unallocated, otherwise
no problem. This was very likely caused by the hard reboot.

So, at this moment it appears that _some_ vnodes for _some_
files on FFS may end up with zero v_type. How this could happen,
I have no idea. I tried to create bunch of files in root to check
if inode #196 was somehow magic, but there was no problem
altogether with the newly created file with ino#196.

Weird.

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-

--ELM744631910-1425-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
Content-Disposition: attachment; filename=direbadf.txt

begin 644 direbadf
M`@````P`!`$N`````@````P`!`(N+@```!!*``P`!`-U<W(``)!'``P`!`-B
M:6X``.!'``P`!`-D978``#!(``P`!`-E=&,``(!(``P`!`-M;G0`M0```!``
M"`=O;F5T8G-D```@20`0``0$:V5R;@!%`N,`<$D`$``$!'-B:6X`10+C`,!)
M``P`!`-T;7```9!'`!``!`1P<F]C`$4"XP&`2``0``0$<F]O=`!%`N,`8"(`
M$``$!V%L=')O;W0``2!)``P`!`-V87(``<!)`!``!`5C9')O;0`"XR0````0
M``H$:&]M90`-N.4J````#``*`W-Y<P"H````%``("6YE=&)S9"YZ:P"AY`#@
M$``,``0#;&EB`+$````4``0*;&]S="MF;W5N9`!S`)`0`!0`!`5S=&%N9``8
MY@"=`N.G````$``*!&5M=6P`G0+C*0```!``"`9N971B<V0`P*D````,``H#
M9G1P`*H````,``H#=W=W`+0````0``@&+F-S:')C`,"L````$``*!W=W=V1A
M=&$`K0```#``"@IW=W=S8W)I<'1S`,`G`0``#``*`W-Y<P"O````$``(!&)O
M;W0`G0+C`]!(`!``!`9X<')O;W0`Y`3`20`0``0&>'!D871A`.3"````&``(
M""YP<F]F:6QE`*Q:Y@``````$"(`3``$!&UN=#(`(97D*0```#P`"`=N;F5T
M8G-D`+4````L``@';FYE=&)S9``J````'``*"VEN<W0N,#,U,C=A`'-D+G!R
M90#B`!`=`!``!`=L:6)E>&5C``!P.@"D`00&<F5S8W5E`.2[`@``&``(#%A&
M<F5E.#8N8V]R90#[&N0H````%``("&MD;2YC;W)E`+_)P*L```!H`0@);F5T
M8G-D+FUP`(GDOP```%0!"`=N;F5T8G-D````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
B````````````````````````````````````````````````
`
end

--ELM744631910-1425-0_--