aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fuse/dev.c17
-rw-r--r--fs/fuse/fuse_i.h3
-rw-r--r--fs/fuse/inode.c1
3 files changed, 20 insertions, 1 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index b2e8613a26d8..438770f8867f 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -317,6 +317,7 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
317 list_add_tail(&req->list, &fc->pending); 317 list_add_tail(&req->list, &fc->pending);
318 req->state = FUSE_REQ_PENDING; 318 req->state = FUSE_REQ_PENDING;
319 wake_up(&fc->waitq); 319 wake_up(&fc->waitq);
320 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
320} 321}
321 322
322/* 323/*
@@ -901,6 +902,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
901 end_requests(fc, &fc->pending); 902 end_requests(fc, &fc->pending);
902 end_requests(fc, &fc->processing); 903 end_requests(fc, &fc->processing);
903 wake_up_all(&fc->waitq); 904 wake_up_all(&fc->waitq);
905 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
904 } 906 }
905 spin_unlock(&fuse_lock); 907 spin_unlock(&fuse_lock);
906} 908}
@@ -917,12 +919,24 @@ static int fuse_dev_release(struct inode *inode, struct file *file)
917 end_requests(fc, &fc->processing); 919 end_requests(fc, &fc->processing);
918 } 920 }
919 spin_unlock(&fuse_lock); 921 spin_unlock(&fuse_lock);
920 if (fc) 922 if (fc) {
923 fasync_helper(-1, file, 0, &fc->fasync);
921 kobject_put(&fc->kobj); 924 kobject_put(&fc->kobj);
925 }
922 926
923 return 0; 927 return 0;
924} 928}
925 929
930static int fuse_dev_fasync(int fd, struct file *file, int on)
931{
932 struct fuse_conn *fc = fuse_get_conn(file);
933 if (!fc)
934 return -ENODEV;
935
936 /* No locking - fasync_helper does its own locking */
937 return fasync_helper(fd, file, on, &fc->fasync);
938}
939
926const struct file_operations fuse_dev_operations = { 940const struct file_operations fuse_dev_operations = {
927 .owner = THIS_MODULE, 941 .owner = THIS_MODULE,
928 .llseek = no_llseek, 942 .llseek = no_llseek,
@@ -932,6 +946,7 @@ const struct file_operations fuse_dev_operations = {
932 .writev = fuse_dev_writev, 946 .writev = fuse_dev_writev,
933 .poll = fuse_dev_poll, 947 .poll = fuse_dev_poll,
934 .release = fuse_dev_release, 948 .release = fuse_dev_release,
949 .fasync = fuse_dev_fasync,
935}; 950};
936 951
937static struct miscdevice fuse_miscdevice = { 952static struct miscdevice fuse_miscdevice = {
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index a16a04fcf41e..e5cb46b78437 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -318,6 +318,9 @@ struct fuse_conn {
318 318
319 /** kobject */ 319 /** kobject */
320 struct kobject kobj; 320 struct kobject kobj;
321
322 /** O_ASYNC requests */
323 struct fasync_struct *fasync;
321}; 324};
322 325
323static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) 326static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 879e6fba9480..78700cbb9cdf 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -216,6 +216,7 @@ static void fuse_put_super(struct super_block *sb)
216 spin_unlock(&fuse_lock); 216 spin_unlock(&fuse_lock);
217 up_write(&fc->sbput_sem); 217 up_write(&fc->sbput_sem);
218 /* Flush all readers on this fs */ 218 /* Flush all readers on this fs */
219 kill_fasync(&fc->fasync, SIGIO, POLL_IN);
219 wake_up_all(&fc->waitq); 220 wake_up_all(&fc->waitq);
220 kobject_del(&fc->kobj); 221 kobject_del(&fc->kobj);
221 kobject_put(&fc->kobj); 222 kobject_put(&fc->kobj);