[dm-devel] [PATCH 1/3] dm: a basic support for using the select or poll function

Martin Wilck mwilck at suse.com
Thu May 11 19:49:14 UTC 2017


On Thu, 2017-05-11 at 11:10 -0700, Andy Grover wrote:
> 
> I think getting one readiness notification for multiple events should
> be ok.
> 
> But, the semantics of poll(2) are level-triggered, meaning if a fd
> is 
> ready then it will stay ready through multiple invocations of poll() 
> until something is done to satisfy it (e.g. for a TCP socket,
> read()ing 
> all the available data). Therefore we can't make it "edge-triggered"
> by 
> auto-clearing - it has to be a separate action.

Hm, perhaps.

Here is an idea: the best way to avoid the race mentioned by Mike might
be to set priv->global_event_nr to the highest event nr reported by the
DM_LIST_DEVICES ioctl when this ioctl returns. DM_LIST_DEVICES would
then represent your "separate action", which would fit quite well, and
the DM_DEV_ARM_POLL ioctl wouldn't be needed. It would be guaranteed
that if any event had occured after the previous DM_LIST_DEVICES,
whether or not that had been before or after the poll() call, userspace
would notice.

Cheers,
Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)




More information about the dm-devel mailing list