Email List: Xaustin-review-lX
[All Lists]

Re: Defect in XSH readdir

To: Larry Dwyer <yyyyyyyyyyy@xxxxxx>, yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Re: Defect in XSH readdir
From: yyyyyyyyy@xxxxxxxxxxx (Eric Blake)
Date: Tue, 06 Jun 2006 01:44:44 +0000
>     When returning a directory entry for the root of a mounted file
>     system, some historical implementations of readdir() return the
>     file serial number of the underlying mount point, rather than of
>     the root of the mounted file system.  This behavior is considered
>     to be a bug, since the underlying file serial number has no
>     significance to applications.
> 
> Actually, this is a bug because the serial number of the file underlying 
> the mount point might conflict with the serial number of another file on 
> the mounted volume.
> 
> If I was backing up a volume and I found a serial number that matched the 
> ID of the mount point, I could assume that this is a hard link back to the 
> mount point and save the file as a link, rather than as a file.

It is the combination of ino and devno that determine when it is safe
to treat two files as hard links; relying on d_ino alone (or conversely,
on st_ino alone, if this wording is accepted), would be a bug in your
application doing the backup.

Also note that this aardvark has bearing on whether an XSI implementation
of 'ls -i' is allowed to optimize by using only readdir, or whether it must
[l]stat every directory element.

-- 
Eric Blake

<Prev in Thread] Current Thread [Next in Thread>