[PATCH] Re: FAT bug in 2.2.10-ac8(was slocate never finishes in ..)

Alexander Viro (viro@math.psu.edu)
Tue, 6 Jul 1999 02:27:26 -0400 (EDT)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-21307229-931242446=:23200
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Tue, 6 Jul 1999, Arthur wrote:

> On Mon, 5 Jul 1999 23:53:29 +0100 (BST), Alan Cox
> <alan@lxorguk.ukuu.org.uk> wrote:
>
> >> I switch to 2.2.10-ac8 (RH 6.0) last night and saw that the slocate
> >> cron run every night was still active, consuming 100% CPU.
>
> >Interesting. 2.2.10ac8 has Al Viro's updates for FAT/VFAT including the
> >directory pointer caching, so that it should break here is very believable
>
> With 2.2.9mdk (Mandrake) I have the same problem with slocate.

Right. You do. It's a combination of my idiocy and idiocy of slocate
authors. Sigh... In case of root directory the second entry (fake "..")
got an d_off (offset of the next entry) equal to 0 *if* there were
additional entries successfully filled by getdents(). My idiocy.
Now, authors of slocate, in their infinite wisdom, decided to do
seekdir after each readdir. Which means that they call getdents (on a
decently-sized buffer) for each bloody offset. It is idiocy. Number of
getdents() calls is 2 orders of magintude higher than it should be.
Combination of those bogosities gave an infinite loop.
Fix for FAT attached (it's against -ac8, with 2.2.9 it will get a
line numbers offset but will apply fine).

As for slocate... Look for seekdir(recdir, telldir()); and shoot
it. Dunno if the author reads l-k (he didn't leave an address in the
source), but just in case: seekdir() is *NOT* needed if you read
sequentially. Just as fseek(); is not needed for files in the similar
case.

Down, not across...
Al

---559023410-21307229-931242446=:23200
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=foo
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.4.10.9907060227260.23200@weyl.math.psu.edu>
Content-Description:
Content-Disposition: attachment; filename=foo

LS0tIGZzL2ZhdC9kaXIuYwlUdWUgSnVsICA2IDAxOjQ0OjQ1IDE5OTkNCisr
KyBmcy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JCQltZW1jcHkoJmxvbmduYW1lW2xvbmdf
bGVuKzFdLCBidWZuYW1lLCBpKTsNCiAJCQlsb25nX2xlbiArPSBpOw0KIAkJ
fQ0KLQkJaWYgKGZpbGxkaXIoZGlyZW50LCBsb25nbmFtZSwgbG9uZ19sZW4s
IGxwb3MsIGludW0pIDwgMCkNCisJCWlmIChmaWxsZGlyKGRpcmVudCwgbG9u
Z25hbWUsIGxvbmdfbGVuLCAqZnVycmZ1LCBpbnVtKSA8IDApDQogCQkJZ290
byBGaWxsRmFpbGVkOw0KIAl9DQogDQogUmVjRW5kOg0KKwlmdXJyZnUgPSAm
bHBvczsNCiAJZmlscC0+Zl9wb3MgPSBjcG9zOw0KIAlnb3RvIEdldE5ldzsN
CiBFT0RpcjoNCg==
---559023410-21307229-931242446=:23200--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/