From: Martin Wilck <mwilck@suse.com>
To: Mike Snitzer <snitzer@redhat.com>
Cc: dm-devel@redhat.com, Andy Grover <agrover@redhat.com>,
mpatocka@redhat.com
Subject: Re: [PATCH 1/3] dm: a basic support for using the select or poll function
Date: Thu, 11 May 2017 21:30:43 +0200 [thread overview]
Message-ID: <1494531043.6093.27.camel@suse.com> (raw)
In-Reply-To: <20170511132134.GA10709@redhat.com>
On Thu, 2017-05-11 at 09:21 -0400, Mike Snitzer wrote:
> On Thu, May 11 2017 at 5:43am -0400,
> Martin Wilck <mwilck@suse.com> wrote:
>
> > On Thu, 2017-05-11 at 11:39 +0200, Martin Wilck wrote:
> > > On Tue, 2017-05-09 at 12:10 -0700, Andy Grover wrote:
> > > > From: Mikulas Patocka <mpatocka@redhat.com>
> > > >
> > > > This is the very simple patch for polling on the
> > > > /dev/mapper/control
> > > > device. The select or poll function waits until any event
> > > > happens
> > > > on
> > > > any
> > > > dm device since opening the /dev/mapper/control device. When
> > > > select
> > > > or
> > > > poll returns the device as readable, we must close and reopen
> > > > the
> > > > device
> > > > to wait for new dm events.
> > >
> > > Why have you done it that way? Couldn't you just save the
> > > dm_global_event_nr at the time poll() is called?
> >
> > I should have read your patch 2/3 before posting ... but I'm still
> > missing why the counter can't simply be set at poll() time.
>
> If you did that then you would have a race where:
>
> 1) userspace has recorded events prior to poll()
> 2) an event triggers an increment of dm_global_event_nr before
> userspace
> calls poll()
> 3) then userspace calls poll() -- only to find that after poll()
> returns
> multiple events have occurred.
>
> Which implies missed handling of events.
I see - but I don't see yet how the ioctl approach (or the
close()/open() based one, for that matter) would avoid this race.
1) application processes event N
2) event N+1 arrives in the kernel
3) user space issues ioctl or close()/open() sequence, N+1 is recorded
in priv->global_event_nr
4) user space runs poll()
5) event N+2 arrives 4 weeks later and poll returns
... meaning that event N+1 has been left unprocessed for 4 weeks.
Or what I am missing?
AFAICS, the only way for user space to make sure it misses no events
would be passing the number of the last processed event down the kernel
in the ioctl call (and the kernel would use that value, rather than its
internal counter, for initializing priv->global_event_nr).
Regards
Martin
> But if I'm wrong I'm sure Andy or Mikulas will correct me.
>
> Thanks,
> Mike
>
--
Dr. Martin Wilck <mwilck@suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2017-05-11 19:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 19:10 [PATCH 0/3] poll()able DM events Andy Grover
2017-05-09 19:10 ` [PATCH 1/3] dm: a basic support for using the select or poll function Andy Grover
2017-05-11 9:39 ` Martin Wilck
2017-05-11 9:43 ` Martin Wilck
2017-05-11 13:21 ` Mike Snitzer
2017-05-11 18:10 ` Andy Grover
2017-05-11 19:49 ` Martin Wilck
2017-05-11 20:21 ` Alasdair G Kergon
2017-05-11 20:45 ` Martin Wilck
2017-05-11 21:38 ` Alasdair G Kergon
2017-05-11 19:30 ` Martin Wilck [this message]
2017-05-11 21:46 ` Andy Grover
2017-05-12 6:48 ` Martin Wilck
2017-05-11 21:50 ` Alasdair G Kergon
2017-05-12 15:52 ` Mikulas Patocka
2017-05-09 19:10 ` [PATCH 2/3] dm-ioctl: add a new DM_DEV_ARM_POLL ioctl Andy Grover
2017-05-09 19:10 ` [PATCH 3/3] dm-ioctl: report event number in DM_LIST_DEVICES Andy Grover
2017-05-09 21:14 ` [PATCH 0/3] poll()able DM events Mike Snitzer
2017-09-17 2:41 ` [PATCH 3/3] dm-ioctl: report event number in DM_LIST_DEVICES Eugene Syromiatnikov
2017-09-19 16:47 ` Andy Grover
2017-09-20 11:29 ` [PATCH] dm-ioctl: fix alignment of event number in the device list Mikulas Patocka
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=1494531043.6093.27.camel@suse.com \
--to=mwilck@suse.com \
--cc=agrover@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mpatocka@redhat.com \
--cc=snitzer@redhat.com \
/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.