From 96249989efe40367841a579c41ec5025c715afb5 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 21 Nov 2001 12:21:19 +0000 Subject: better exit handling --- kernel/dev.c | 9 ++++----- kernel/inode.c | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'kernel') diff --git a/kernel/dev.c b/kernel/dev.c index 1bff1eb..7036153 100644 --- a/kernel/dev.c +++ b/kernel/dev.c @@ -173,7 +173,7 @@ static void request_wait(struct fuse_conn *fc) DECLARE_WAITQUEUE(wait, current); add_wait_queue_exclusive(&fc->waitq, &wait); - while(list_empty(&fc->pending)) { + while(fc->sb != NULL && list_empty(&fc->pending)) { set_current_state(TASK_INTERRUPTIBLE); if(signal_pending(current)) break; @@ -230,17 +230,16 @@ static ssize_t fuse_dev_read(struct file *file, char *buf, size_t nbytes, struct fuse_conn *fc = DEV_FC(file); struct fuse_req *req = NULL; - if(fc->sb == NULL) - return -EPERM; - spin_lock(&fuse_lock); request_wait(fc); - if(!list_empty(&fc->pending)) { + if(fc->sb != NULL && !list_empty(&fc->pending)) { req = list_entry(fc->pending.next, struct fuse_req, list); list_del_init(&req->list); req->locked = 1; } spin_unlock(&fuse_lock); + if(fc->sb == NULL) + return -ENODEV; if(req == NULL) return -ERESTARTSYS; diff --git a/kernel/inode.c b/kernel/inode.c index df402ba..0f5fc8c 100644 --- a/kernel/inode.c +++ b/kernel/inode.c @@ -64,6 +64,8 @@ static void fuse_put_super(struct super_block *sb) fc->flags = 0; fuse_release_conn(fc); sb->u.generic_sbp = NULL; + /* Flush all readers on this fs */ + wake_up_all(&fc->waitq); spin_unlock(&fuse_lock); } -- cgit v1.2.3