Re: [PATCHSET] FUSE: extend FUSE to support more operations

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tejun Heo
Date: Monday, November 17, 2008 - 2:17 am

Hello, Miklos.

I tried to implement poll as you suggested but it doesn't work because
poll actually is synchronous.  Please consider the following scenario.
A file system implements a file which supports poll and other file
operations and there's a single threaded client which does the
following.

1. open the file
2. do polling (timeout == 0) poll on the fd
3-1. if POLLIN, consume data and goto #2
3-2. if ! POLLIN, do a ioctl (or whatever) on the fd and goto #2

For a client with single stream of syscalls (single threaded), it's
generally guaranteed that the attempt to consume data is successful
after POLLIN unless the fd dies inbetween.  I don't think this is
something guaranteed in POSIX but for most in-kernel poll
implementations, this holds and I've seen good amount of code
depending on it.

To satisfy the above assumption, if ->poll is always asynchronous,
FUSE has to cache revents from previous ->poll attempts and clear it
when something which could have consumed data has occurred.
Unfortunately, in the above case, FUSE has no idea what constitutes
"consume data" but, double unfortunately, it can't take big hammer
approach (clearing on any access) either, because intervening non-data
consuming call like 3-2 above would mean that poll() will never
succeed.

Because data availability should be determined atomically && only the
filesystem knows when or how data availability changes, revents return
from ->poll() must be synchronous.

We can still use req -> reply approach where there's a flag telling
the FUSE server whether the request is synchronous or not but at that
point it seems just obfuscating to me.

So, ->poll() needs to be the combination of synchronous data
availability check + asynchronous notification which can be spurious
to implement the required semantics and I think the original interface
was much more natural for such functionality.

What do you think?

Thanks.

-- 
tejun
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/7] FUSE: add include protectors, Tejun Heo, (Thu Aug 28, 10:40 am)
[PATCH 2/7] FUSE: pass nonblock flag to client, Tejun Heo, (Thu Aug 28, 10:40 am)
[PATCH 3/7] FUSE: implement nonseekable open, Tejun Heo, (Thu Aug 28, 10:40 am)
[PATCH 4/7] FUSE: implement direct lseek support, Tejun Heo, (Thu Aug 28, 10:41 am)
[PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 10:41 am)
[PATCH 6/7] FUSE: implement unsolicited notification, Tejun Heo, (Thu Aug 28, 10:41 am)
[PATCH 7/7] FUSE: implement poll support, Tejun Heo, (Thu Aug 28, 10:41 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Greg KH, (Thu Aug 28, 10:51 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 10:59 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 11:01 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 11:02 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Thu Aug 28, 11:13 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Greg KH, (Thu Aug 28, 11:14 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 11:17 am)
Re: [PATCHSET] FUSE: extend FUSE to support more operations, Miklos Szeredi, (Thu Aug 28, 11:20 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, H. Peter Anvin, (Thu Aug 28, 11:20 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Thu Aug 28, 11:23 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 11:25 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 11:28 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 11:34 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, H. Peter Anvin, (Thu Aug 28, 12:08 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Thu Aug 28, 12:18 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Thu Aug 28, 12:25 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 12:42 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Thu Aug 28, 1:02 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, H. Peter Anvin, (Thu Aug 28, 1:21 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Alan Cox, (Thu Aug 28, 1:48 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Thu Aug 28, 1:55 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, H. Peter Anvin, (Thu Aug 28, 2:27 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Thu Aug 28, 7:19 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Fri Aug 29, 12:32 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Fri Aug 29, 12:59 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Fri Aug 29, 1:12 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Fri Aug 29, 1:29 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Fri Aug 29, 2:03 am)
Re: [fuse-devel] [PATCH 5/7] FUSE: implement ioctl support, Roger Willcocks, (Fri Aug 29, 4:31 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Eric W. Biederman, (Fri Aug 29, 12:17 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Arnd Bergmann, (Fri Aug 29, 12:47 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Sat Aug 30, 4:40 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Miklos Szeredi, (Mon Sep 1, 4:57 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Mon Sep 1, 5:03 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Eric W. Biederman, (Wed Sep 3, 7:32 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Wed Sep 3, 7:40 am)
Re: [PATCH 5/7] FUSE: implement ioctl support, Eric W. Biederman, (Wed Sep 3, 2:51 pm)
Re: [PATCH 5/7] FUSE: implement ioctl support, Tejun Heo, (Wed Sep 3, 5:09 pm)
Re: [fuse-devel] [PATCHSET] FUSE: extend FUSE to support m ..., Szabolcs Szakacsits, (Tue Oct 14, 5:16 am)
Re: [PATCHSET] FUSE: extend FUSE to support more operations, Christoph Hellwig, (Wed Nov 12, 2:14 am)
Re: [PATCHSET] FUSE: extend FUSE to support more operations, Tejun Heo, (Mon Nov 17, 2:17 am)