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 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'kernel/dev.c') 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; -- cgit v1.2.3