[systemd-devel] [PATCH 2/2] path: do not watch IN_ATTRIB for parent directories

Kay Sievers kay.sievers at vrfy.org
Wed Dec 1 07:31:20 PST 2010


On Wed, Dec 1, 2010 at 16:05, Michal Schmidt <mschmidt at redhat.com> wrote:
> On Wed, 1 Dec 2010 15:53:54 +0100 Kay Sievers wrote:
>> On Wed, Dec 1, 2010 at 15:39, Michal Schmidt <mschmidt at redhat.com>
>> wrote:
>>
>> >  inotify_add_watch(17, "/dev/.systemd/ask-password",
>> > IN_ATTRIB|IN_MOVED_TO|IN_CREATE|IN_DELETE_SELF|IN_MOVE_SELF) = 1
>> > inotify_add_watch(17, "/dev/.systemd",
>> > IN_ATTRIB|IN_DELETE_SELF|IN_MOVE_SELF) = 2 inotify_add_watch(17,
>> > "/dev", IN_ATTRIB|IN_DELETE_SELF|IN_MOVE_SELF) = 3
>> > inotify_add_watch(17, "/", IN_ATTRIB|IN_DELETE_SELF|IN_MOVE_SELF) =
>> > 4
>>
>> Any idea why the heck we want to watch all parent dirs?
>
> I think it's this way in order to simulate a strict path-based watch,
> as opposed to an inode-based one.
> For cases when someone recreates the directory hierarchy in a weird
> way, like:
>  # a watch is set on /foo/bar/baz
>  mv /foo/bar /foo/qux
>  mkdir -p /foo/bar/baz  # a completely NEW /foo/bar/baz inode

That should probably be avoided for DirectoryNotEmpty=. Nothing should
watch /dev just for that reason.

Kay


More information about the systemd-devel mailing list