[systemd-devel] how to handle filesystems that do not support d_type in readdirs dirent?

Lennart Poettering lennart at poettering.net
Thu Mar 3 07:30:38 PST 2011


On Thu, 03.03.11 13:05, Marius Tolzmann (tolzmann at molgen.mpg.de) wrote:

> 
> hello..
> 
> we are currently using reiserfs on our root-partition..

Urks, people still use that cruft?
> 
> since reiserfs always sets d_type to DT_UNKNOWN in dirent entries
> some tools like systemd-tmpfiles do not work as expected.
> 
> in src/util.c:3905 DT_UNKNOWN is already included when checking file
> for type DT_REG or DT_LNK.
> 
> since there seems to be no special handling for symlinks (e.g.
> checking the type of the symlinks destionation) i just fixed
> scandir_filter to also accept DT_UNKNOWN.

Fixed this now the same way.

> (other) places where DT_REG checks may fail on reiserfs or other fs
> that don't support setting the correct type of file in d_type:
> 
> src/tty-ask-password-agent.c:510: if (de->d_type != DT_REG)

Shouldn't be a problem since this directory is in /dev, which we require
to be tmpfs or devtmpfs, which supports d_type. I have now added a comment to
clarify this.

> src/modules-load.c:45: if (d->d_type != DT_REG &&

Fixed this now, too.

> src/tmpfiles.c:781: if (d->d_type != DT_REG &&

This is the spot you already mentioned above, right?

> .. how is this supposed to be handled? if the type of a symlinks
> destination isn't checked the whole check could be skipped at all?

The check is a good if we can do it cheaply, but if we cannot it should
be acceptable in all these case if we don't do it.

Please check current git (in particular 1a6f4df) if it covers all issues
you raised.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list