All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bandan Das <bsd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] usb-mtp: Add support for inotify based file monitoring
Date: Mon, 09 Nov 2015 18:28:29 -0500	[thread overview]
Message-ID: <jpg7flqn46a.fsf@linux.bootlegged.copy> (raw)
In-Reply-To: <jpgtwoupy1e.fsf@linux.bootlegged.copy> (Bandan Das's message of "Mon, 09 Nov 2015 18:12:45 -0500")

Bandan Das <bsd@redhat.com> writes:

> Gerd Hoffmann <kraxel@redhat.com> writes:
>
>> On Di, 2015-11-03 at 19:00 -0500, Bandan Das wrote:
>>> +                    /* Add a new watch asap so as to not lose events
>>> */
>>
>> This comment sounds like there is a race ("asap").  There isn't one,
>> correct ordering (adding the watch before reading the directory) is
>
> Hmm, seems like there's still a small window. We may not have even
> started processing the event because we are still processing the earlier
> ones.
>
>> enough to make sure you don't miss anything.  You might see create
>> events for objects already in the tree though, are you prepared to
>> handle that?
>
> Oh, interesting.  Current version will happily add duplicate entries.
> I will add a check.

By the way, did you mean this as a duplicate create event ?
I took a quick look at fs/notify/inotify_fsnotify.c:

int inotify_handle_event(...
    ret = fsnotify_add_event(group, fsn_event, inotify_merge);                                                                                                              
        if (ret) {
                /* Our event wasn't used in the end. Free it. */
                fsnotify_destroy_event(group, fsn_event);
        }

So, atleast for consecutive duplicate events, the kernel seems to be doing
some filtering of its own.

>> cheers,
>>   Gerd

  reply	other threads:[~2015-11-09 23:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  0:00 [Qemu-devel] [PATCH 0/3] usb-mtp events support Bandan Das
2015-11-04  0:00 ` [Qemu-devel] [PATCH 1/3] usb-mtp: use a list for keeping track of children Bandan Das
2015-11-05  8:24   ` Gerd Hoffmann
2015-11-05 21:23     ` Bandan Das
2015-11-04  0:00 ` [Qemu-devel] [PATCH 2/3] usb-mtp: Add support for inotify based file monitoring Bandan Das
2015-11-05  8:37   ` Gerd Hoffmann
2015-11-05 21:28     ` Bandan Das
2015-11-05  8:49   ` Gerd Hoffmann
2015-11-09 23:12     ` Bandan Das
2015-11-09 23:28       ` Bandan Das [this message]
2015-11-12  8:16       ` Gerd Hoffmann
2015-11-12 22:40         ` Bandan Das
2015-11-13  8:08           ` Gerd Hoffmann
2015-11-05  8:49   ` Gerd Hoffmann
2015-11-09 23:13     ` Bandan Das
2015-11-04  0:00 ` [Qemu-devel] [PATCH 3/3] usb-mtp: add support for basic mtp events Bandan Das
2015-11-05  8:41   ` Gerd Hoffmann
2015-11-05 21:30     ` Bandan Das

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=jpg7flqn46a.fsf@linux.bootlegged.copy \
    --to=bsd@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.