From: Bela Lubkin <b...@sco.com> Subject: Re: Hangs doing ls -l but not ls Date: 18 Dec 2004 07:55:19 -0500 Message-ID: <20041218125517.GD13175@sco.com> References: <82d1ec2f.0412011401.c589966@posting.google.com>
<1102520742.151827.170810@c13g2000cwb.googlegroups.com>
<I8EwF4.9FI@wjv.com>
<1102545484.002302.274710@c13g2000cwb.googlegroups.com>
<I8FIuA.HA@wjv.com>
<1102629053.134731.4800@c13g2000cwb.googlegroups.com>
<20041209215438.GB9430@jpradley.jpr.com>
<1102700172.028793.44330@f14g2000cwb.googlegroups.com>
<41C11337.E7507EE4@tkg.ca>
<1103216627.810123.285550@c13g2000cwb.googlegroups.com> Kevin Coulter wrote: > The find ... ls -l {} ... hangs immediately. The find without the -l > does not hang. > > The first thing that shows when I do the find without the -l is the > directory name X. > > I'm heading there tonight to do a reload from scratch, that is I think > the only safe way to fix it at this point. > > When I'm there, I am going to try to boot off the boot floppy and mount > the filesystem to see if I can see anything different that way...
Reinstalling the system is an overreaction to this! For most of the discussion, it sounded like you were not rebooting the system. All the `find`, `ls` etc. commands that were run, were run during a single system uptime. You did say in the first message that the machine seemed to reboot OK. But that doesn't seem to agree with the problem. The problem seems to be this: your system has /dev/cd0 mounted on /mnt, but there is something wrong with the in-core inode structure for /dev/cd0. The "something wrong" is most likely that the structure's lock flag is set. As a result, any attempt to stat() /dev/cd0 hangs, waiting for the lock to be cleared. Any attempt to stat() the mount point directory, /mnt, also hangs, because the kernel has to follow from the mount point to the real device, /dev/cd0, whose structure is locked. Unless you can clear that lock flag, you'll have to reboot. I've used kernel debuggers to forcibly clear such a flag. What usually happens is that the process that was holding the lock immediately cycles back and reacquires it, and nothing improves. This is because the process is running in the hardware device driver (in this case, "Srom" for the CD-ROM drive or "wd" or some SCSI device driver for the hardware). When you clear the lock, it wakes up, sees that whatever operation it was waiting on didn't complete, and re-issues that operation.
The operation is probably hung because the drive hung.
So the chain of causality is:
- CD-ROM drive or controller hardware hung
- device driver tried to access it, never got the expected response
- the device driver (or its caller) had locked /dev/cd0's in-core inode
- accesses of /dev/cd0 in-core inode hang waiting for unlock
- accesses of /mnt in-core inode hang because they refer to /dev/cd0
- `ls -l /` hangs because it tries to stat("/mnt")
- `ls -l /dev` hangs because it tries to stat("/dev/cd0")
- `find` eventually hangs trying to stat() one of those
- and so on
Rebooting ought to clear this up completely, unless the system is
configured to automatically mount the CD at boot time, and the CD-ROM
drive or controller is so hung it needs to be power-cycled, or is
actually broken.
If the machine hasn't yet been rebooted, you can try a couple of things
to demonstrate the truth of what I say. Start with:
# cd /dev
# for name in *; do
case "$name" in cd0|rcd0) echo "=== SKIPPED $name ==="; continue;; esac
printf %-20s "$name"
ls -gold "$name"
done
This will produce a lot of output; and if I'm right, it won't hang. If
it does hang, the problem file's name should be on the last line. Add
it to the "SKIPPED" case statement, e.g.:
case $name in cd0|rcd0|tty666) echo ...
and do it again.
You can do likewise for /mnt:
# cd /
# for name in *; do
case "$name" in mnt) echo "=== SKIPPED $name ==="; continue;; esac
printf %-20s "$name"
ls -gold "$name"
done
Don't add "-L" to the `ls` flags; you aren't trying to test symlink
integrity, only the accessibility of in-core inodes of files in those
directories.
>Bela<
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar