[CRIU] [PATCH 10/17] fsnotify: Add fanotify restore

Cyrill Gorcunov gorcunov at openvz.org
Mon Dec 24 09:02:59 EST 2012


On Mon, Dec 24, 2012 at 05:56:11PM +0400, Pavel Emelyanov wrote:
> On 12/24/2012 05:50 PM, Cyrill Gorcunov wrote:
> > On Mon, Dec 24, 2012 at 05:32:12PM +0400, Pavel Emelyanov wrote:
> >> On 12/11/2012 01:34 AM, Cyrill Gorcunov wrote:
> >>>
> >>> The idea is the same as for inotify -- just open
> >>> notification descriptor and hook paths on.
> >>>
> >>> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> >>> ---
> >>>  fsnotify.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> >>>  1 file changed, 89 insertions(+), 2 deletions(-)
> >>>
> >>> +	/*
> >>> +	 * Note we use OR'ed iwe->wd here, since for fanotify it
> >>> +	 * provides additional flags for the mark.
> >>> +	 */
> >>> +	flags |= iwe->wd;
> >>
> >> I don't understand this. Kernel denies putting any flags but known into
> >> sys_fanotify_mark.
> > 
> > wd consist of additional flags associated with mark, ie "mflags" field
> 
> WHAT?! How did this happen, I have missed this from the set.

This comes from parsing procfs

					entry.fsy.type = FSNOTIFY_TYPE__FANOTIFY;
					ret = sscanf(&str[13],
						     "%lx sdev:%x "
						     "mflags:%x mask:%x ignored_mask:%x "
						     "fhandle-bytes:%x fhandle-type:%x "
						     "f_handle: %n",
						     &entry.fsy.i_ino, &entry.fsy.s_dev,
-->						     &entry.fsy.wd, &entry.fsy.mask, &entry.fsy.ignored_mask,
						     &entry.fsy.f_handle->bytes, &entry.fsy.f_handle->type,
						     &hoff);

which is because

commit e6dbcafb744ab94a94142a6e721e16330397fad8
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date:   Mon Dec 17 16:05:16 2012 -0800

    fs, fanotify: add @mflags field to fanotify output
    
    The kernel keeps FAN_MARK_IGNORED_SURV_MODIFY bit separately from
    fsnotify_mark::mask|ignored_mask thus put it in @mflags (mark flags)
    field so the user-space reader will be able to detect if such bit were
    used on mark creation procedure.
    
     | pos:     0
     | flags:   04002
     | fanotify flags:10 event-flags:0
     | fanotify mnt_id:12 mflags:40 mask:38 ignored_mask:40000003
     | fanotify ino:4f969 sdev:800013 mflags:0 mask:3b ignored_mask:40000000 fhandle-bytes:8 fhandle-type:1 f_handle:69f90400c275b5b4

	Cyrill


More information about the CRIU mailing list