Re: [PATCH v2] inotify: Extend ioctl to allow to request id of new watch descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2018-02-09 23:45 GMT+01:00 Kirill Tkhai <ktkhai@xxxxxxxxxxxxx>:
> On 09.02.2018 23:56, Andrew Morton wrote:
>> On Fri, 9 Feb 2018 18:04:54 +0300 Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> wrote:
>>
>>> Watch descriptor is id of the watch created by inotify_add_watch().
>>> It is allocated in inotify_add_to_idr(), and takes the numbers
>>> starting from 1. Every new inotify watch obtains next available
>>> number (usually, old + 1), as served by idr_alloc_cyclic().
>>>
>>> CRIU (Checkpoint/Restore In Userspace) project supports inotify
>>> files, and restores watched descriptors with the same numbers,
>>> they had before dump. Since there was no kernel support, we
>>> had to use cycle to add a watch with specific descriptor id:
>>>
>>>      while (1) {
>>>              int wd;
>>>
>>>              wd = inotify_add_watch(inotify_fd, path, mask);
>>>              if (wd < 0) {
>>>                      break;
>>>              } else if (wd == desired_wd_id) {
>>>                      ret = 0;
>>>                      break;
>>>              }
>>>
>>>              inotify_rm_watch(inotify_fd, wd);
>>>      }
>>>
>>> (You may find the actual code at the below link:
>>>  https://github.com/checkpoint-restore/criu/blob/v3.7/criu/fsnotify.c#L577)

Well using a ioctl command to force a specific wd is possible, but
isn't it also possible
to do a "freeze" of all (inotify) watches which are involved, and
"unfreeze" when restoring?

Stef



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux