From 3bc94be9b071bc4c075ceb87f42e9d1412b87272 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Mon, 10 Apr 2006 22:54:52 -0700 Subject: [PATCH] --- yaml --- r: 25551 b: refs/heads/master c: 385a17bfc3cb035333c8a91eddc78a6e04c4625e h: refs/heads/master i: 25549: cfdcfd9c49f0f963d9f6f4347be6edf8da46a1ea 25547: b903df07408c397f36075075268f1714a7dd62d2 25543: 0264a52736be3eccb5b2de3bd917f7074af455c4 25535: 44a0e26f6a5022801967ccc3532069e94ebfc99e v: v3 --- [refs] | 2 +- trunk/fs/fuse/dev.c | 17 ++++++++++++++++- trunk/fs/fuse/fuse_i.h | 3 +++ trunk/fs/fuse/inode.c | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 91e87e7c1bfc..fb9e50d337b9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7025d9ad10a38dadef8b286e0092731c2d3cdc53 +refs/heads/master: 385a17bfc3cb035333c8a91eddc78a6e04c4625e diff --git a/trunk/fs/fuse/dev.c b/trunk/fs/fuse/dev.c index b2e8613a26d8..438770f8867f 100644 --- a/trunk/fs/fuse/dev.c +++ b/trunk/fs/fuse/dev.c @@ -317,6 +317,7 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req) list_add_tail(&req->list, &fc->pending); req->state = FUSE_REQ_PENDING; wake_up(&fc->waitq); + kill_fasync(&fc->fasync, SIGIO, POLL_IN); } /* @@ -901,6 +902,7 @@ void fuse_abort_conn(struct fuse_conn *fc) end_requests(fc, &fc->pending); end_requests(fc, &fc->processing); wake_up_all(&fc->waitq); + kill_fasync(&fc->fasync, SIGIO, POLL_IN); } spin_unlock(&fuse_lock); } @@ -917,12 +919,24 @@ static int fuse_dev_release(struct inode *inode, struct file *file) end_requests(fc, &fc->processing); } spin_unlock(&fuse_lock); - if (fc) + if (fc) { + fasync_helper(-1, file, 0, &fc->fasync); kobject_put(&fc->kobj); + } return 0; } +static int fuse_dev_fasync(int fd, struct file *file, int on) +{ + struct fuse_conn *fc = fuse_get_conn(file); + if (!fc) + return -ENODEV; + + /* No locking - fasync_helper does its own locking */ + return fasync_helper(fd, file, on, &fc->fasync); +} + const struct file_operations fuse_dev_operations = { .owner = THIS_MODULE, .llseek = no_llseek, @@ -932,6 +946,7 @@ const struct file_operations fuse_dev_operations = { .writev = fuse_dev_writev, .poll = fuse_dev_poll, .release = fuse_dev_release, + .fasync = fuse_dev_fasync, }; static struct miscdevice fuse_miscdevice = { diff --git a/trunk/fs/fuse/fuse_i.h b/trunk/fs/fuse/fuse_i.h index a16a04fcf41e..e5cb46b78437 100644 --- a/trunk/fs/fuse/fuse_i.h +++ b/trunk/fs/fuse/fuse_i.h @@ -318,6 +318,9 @@ struct fuse_conn { /** kobject */ struct kobject kobj; + + /** O_ASYNC requests */ + struct fasync_struct *fasync; }; static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) diff --git a/trunk/fs/fuse/inode.c b/trunk/fs/fuse/inode.c index 879e6fba9480..78700cbb9cdf 100644 --- a/trunk/fs/fuse/inode.c +++ b/trunk/fs/fuse/inode.c @@ -216,6 +216,7 @@ static void fuse_put_super(struct super_block *sb) spin_unlock(&fuse_lock); up_write(&fc->sbput_sem); /* Flush all readers on this fs */ + kill_fasync(&fc->fasync, SIGIO, POLL_IN); wake_up_all(&fc->waitq); kobject_del(&fc->kobj); kobject_put(&fc->kobj);