
On Tue, Apr 02, 2019 at 02:17:35PM +0200, Michal Privoznik wrote:
Some of our code iterates over a directory and does some decisions based on entry type (e.g. if it's not a regular file continue with next iteration). This is done by looking at ent->d_type struct member. However, in some cases (e.g. for some filesystems) the d_type can be set to DT_UNKNOWN which effectively defeats the aforementioned checks. For instance, some XFS' (depending on how they were created) might not bother filling the member.
Fix this by running stat() and filling in the member ourselves. If needed.
We really don't want to do this. It adds an extra syscall for every single file in the directory. I've got an alternative patch that simply puts a stat call into the firmware code & also adds a syntax check rule to blacklist use of d_type. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|