]> git.baikalelectronics.ru Git - kernel.git/commit
fuse: allow interrupt queuing without fc->lock
authorMiklos Szeredi <mszeredi@suse.cz>
Wed, 1 Jul 2015 14:26:03 +0000 (16:26 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Wed, 1 Jul 2015 14:26:03 +0000 (16:26 +0200)
commit0239b3921ffcf9f5c5472bc34cd971b1ce88c0fc
treeaea509906f365c33f54070780905f0c45b18a084
parent6ee3b8911c869c3c4ca0249529fe3887a5fe1e6d
fuse: allow interrupt queuing without fc->lock

Interrupt is only queued after the request has been sent to userspace.
This is either done in request_wait_answer() or fuse_dev_do_read()
depending on which state the request is in at the time of the interrupt.
If it's not yet sent, then queuing the interrupt is postponed until the
request is read.  Otherwise (the request has already been read and is
waiting for an answer) the interrupt is queued immedidately.

We want to call queue_interrupt() without fc->lock protection, in which
case there can be a race between the two functions:

 - neither of them queue the interrupt (thinking the other one has already
   done it).

 - both of them queue the interrupt

The first one is prevented by adding memory barriers, the second is
prevented by checking (under fiq->waitq.lock) if the interrupt has already
been queued.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
fs/fuse/dev.c