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

Marius Tolzmann tolzmann at molgen.mpg.de
Thu Mar 3 06:48:00 PST 2011


hi..

On 03/03/11 13:52, Andrey Borzenkov wrote:
>> since reiserfs always sets d_type to DT_UNKNOWN in dirent entries some tools
>> like systemd-tmpfiles do not work as expected.
>
> Hmm .. this could be the reason for my problem with utmp:

it started with a missing utmp and i tracked it down to 
systemd-tempfiles not working at all on reiserfs..


>> in src/util.c:3905 DT_UNKNOWN is already included when checking file for
>> type DT_REG or DT_LNK.
>>
>
> Do not assume that everyone is having exactly the same sources as you
> :) Either include exact commit number for reference, or better just
> name function; they are mostly small enough.

oops.. sorry for that.. i thought i mentioned that i am using the 
systemd v19 sources from the official release..


>> 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.
>>
>> (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)
>> src/modules-load.c:45: if (d->d_type != DT_REG&&
>> src/tmpfiles.c:781: if (d->d_type != DT_REG&&
>>
>> .. how is this supposed to be handled?
>
> Care to provide a patch to include missing DT_UNKNOWN in all places? :)

the question is: how to fix?

why check for regular file/symlink at all when the destination of the 
symlink is not checked again..

so there are (at least) to options to (quick) fix this:
   - remove the whole check..
   - add DT_UNKNOWN and may be in addition check for regular file using
     some stat() before reading the config in systemd-tmpfiles..

marius

-- 
Dipl.-Inf. Marius Tolzmann <marius.tolzmann at molgen.mpg.de>
----------------------------------.------------------------------
MPI f. molekulare Genetik         |
Ihnestrasse 63-73, D-14195 Berlin |   ==> MarIuX GNU/Linux <==
Phone: +49 (0)30 8413 1709        |
----------------------------------^------------------------------
God put me on earth to accomplish a certain number of things.
Right now I am so far behind..
    ..I will never die.         <by calvin from calvin&hobbes ;)>


More information about the systemd-devel mailing list