|
From: | James Youngman |
Subject: | Re: [bug #17877] Invalid "No such file or directory" error on filesystem without stable inode numbers |
Date: | Sun, 8 Oct 2006 23:55:24 +0100 |
On 10/7/06, Miklos Szeredi <address@hidden> wrote:
> Yes, for systems with O_NOFOLLOW, that is a perfect (efficient, race > free) solution. For systems without O_NOFOLLOW, just moving the > lstat() and the open() close to each other Actually moving the lstat() _after_ the open() totally removes the race for inode-less filesystems. The following should be equivalent to open(O_NOFOLLOW): fd = open(path); lstat(path, &st1); fstat(fd, &st2); if (st1.st_ino != st2.st_ino) /* ELOOP */;
For find, the stat result (in the absence of type information in struct dient) determines if we need to consider descending into a directory. I'm very reluctant to try opening every file in the filesystem just in case it turns out to be a directory we need to descend into. But then, the underlying principle of your technique will doubtless be useful even if it needs to be adapted to work efficiently for find. James
[Prev in Thread] | Current Thread | [Next in Thread] |