Skip to content

Commit 357ccf2

Browse files
Bryan GreenMiklos Szeredi
authored andcommitted
fuse: wakeup pollers on connection release/abort
If a fuse dev connection is broken, wake up any processes that are blocking, in a poll system call, on one of the files in the now defunct filesystem. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
1 parent 07d5f69 commit 357ccf2

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎fs/fuse/dev.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,21 @@ __acquires(fc->lock)
19101910
kfree(dequeue_forget(fc, 1, NULL));
19111911
}
19121912

1913+
static void end_polls(struct fuse_conn *fc)
1914+
{
1915+
struct rb_node *p;
1916+
1917+
p = rb_first(&fc->polled_files);
1918+
1919+
while (p) {
1920+
struct fuse_file *ff;
1921+
ff = rb_entry(p, struct fuse_file, polled_node);
1922+
wake_up_interruptible_all(&ff->poll_wait);
1923+
1924+
p = rb_next(p);
1925+
}
1926+
}
1927+
19131928
/*
19141929
* Abort all requests.
19151930
*
@@ -1937,6 +1952,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
19371952
fc->blocked = 0;
19381953
end_io_requests(fc);
19391954
end_queued_requests(fc);
1955+
end_polls(fc);
19401956
wake_up_all(&fc->waitq);
19411957
wake_up_all(&fc->blocked_waitq);
19421958
kill_fasync(&fc->fasync, SIGIO, POLL_IN);
@@ -1953,6 +1969,7 @@ int fuse_dev_release(struct inode *inode, struct file *file)
19531969
fc->connected = 0;
19541970
fc->blocked = 0;
19551971
end_queued_requests(fc);
1972+
end_polls(fc);
19561973
wake_up_all(&fc->blocked_waitq);
19571974
spin_unlock(&fc->lock);
19581975
fuse_conn_put(fc);

‎fs/fuse/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static void fuse_prepare_release(struct fuse_file *ff, int flags, int opcode)
222222
rb_erase(&ff->polled_node, &fc->polled_files);
223223
spin_unlock(&fc->lock);
224224

225-
wake_up_interruptible_sync(&ff->poll_wait);
225+
wake_up_interruptible_all(&ff->poll_wait);
226226

227227
inarg->fh = ff->fh;
228228
inarg->flags = flags;

0 commit comments

Comments
 (0)