[lkml]   [2019]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectd_type and bind mounts
It seems that readdir()/getdents() fill d_type from the underlying
filesystem, not respecting bind mounts of non-directories:

$ touch mount_point
$ sudo mount --bind /dev/null mount_point
$ find -name mount_point -type c
$ find -name mount_point -type f

(Requires a fairly recent GNU findutils to reproduce, older ones
always call stat().) I've seen similar discussions about d_ino being
for the underlying file, not the mount point, which people have said
is technically a POSIX violation but also unlikely to be fixed. Is
the same true of d_type? And is there some workaround a program could
use to get the actual type without the overhead of a whole stat()
call? For example, a way to tell whether a directory entry is a mount

For reference, the relevant findutils bug is

(Please keep me cc'd, I'm not subscribed to lkml or fsdevel. Thanks!)

Tavian Barnes

 \ /
  Last update: 2019-02-11 21:00    [W:0.021 / U:1.888 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site