From: Stef Bon <stefbon@gmail.com>
To: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Amir Goldstein <amir73il@gmail.com>,
	willy@infradead.org, linux-api@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, gorcunov@virtuozzo.com
Subject: Re: [PATCH v2] inotify: Extend ioctl to allow to request id of new watch descriptor
Date: Sun, 11 Feb 2018 12:30:21 +0100	[thread overview]
Message-ID: <CANXojcxKH1zFHOPsJh7zbjshUkFGagah-vN6EvMU7Q-9kLFmpg@mail.gmail.com> (raw)
In-Reply-To: <bb9bafab-9a50-d19e-7293-65e74aca4720@virtuozzo.com>
2018-02-09 23:45 GMT+01:00 Kirill Tkhai <ktkhai@virtuozzo.com>:
> On 09.02.2018 23:56, Andrew Morton wrote:
>> On Fri, 9 Feb 2018 18:04:54 +0300 Kirill Tkhai <ktkhai@virtuozzo.com> 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
next prev parent reply	other threads:[~2018-02-11 11:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 15:07 [PATCH] inotify: Extend ioctl to allow to request id of new watch descriptor Kirill Tkhai
2018-02-08 16:02 ` Matthew Wilcox
2018-02-09  8:26   ` Kirill Tkhai
2018-02-09 13:28     ` Matthew Wilcox
2018-02-09 15:05       ` Kirill Tkhai
2018-02-08 16:14 ` Jan Kara
2018-02-08 17:58   ` Cyrill Gorcunov
2018-02-09 15:04 ` [PATCH v2] " Kirill Tkhai
2018-02-09 15:14   ` Matthew Wilcox
2018-02-09 20:56   ` Andrew Morton
2018-02-09 22:45     ` Kirill Tkhai
2018-02-11 11:30       ` Stef Bon [this message]
2018-02-12  8:42         ` Kirill Tkhai
2018-02-14 10:18       ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=CANXojcxKH1zFHOPsJh7zbjshUkFGagah-vN6EvMU7Q-9kLFmpg@mail.gmail.com \
    --to=stefbon@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=amir73il@gmail.com \
    --cc=gorcunov@virtuozzo.com \
    --cc=jack@suse.cz \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).