fuse: duplicate ->connected in pqueue

This will allow checking ->connected just with the processing queue lock.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 0fae2a7..6321d76 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1303,7 +1303,7 @@
 	fuse_copy_finish(cs);
 	spin_lock(&fc->lock);
 	clear_bit(FR_LOCKED, &req->flags);
-	if (!fc->connected) {
+	if (!fpq->connected) {
 		request_end(fc, req);
 		return -ENODEV;
 	}
@@ -1891,7 +1891,7 @@
 
 	spin_lock(&fc->lock);
 	err = -ENOENT;
-	if (!fc->connected)
+	if (!fpq->connected)
 		goto err_unlock;
 
 	req = request_find(fpq, oh.unique);
@@ -1928,7 +1928,7 @@
 
 	spin_lock(&fc->lock);
 	clear_bit(FR_LOCKED, &req->flags);
-	if (!fc->connected)
+	if (!fpq->connected)
 		err = -ENOENT;
 	else if (err)
 		req->out.h.error = -EIO;
@@ -2125,6 +2125,7 @@
 		fc->connected = 0;
 		fc->blocked = 0;
 		fuse_set_initialized(fc);
+		fpq->connected = 0;
 		list_for_each_entry_safe(req, next, &fpq->io, list) {
 			req->out.h.error = -ECONNABORTED;
 			spin_lock(&req->waitq.lock);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 3620eec..5897d89 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -402,6 +402,9 @@
 };
 
 struct fuse_pqueue {
+	/** Connection established */
+	unsigned connected;
+
 	/** The list of requests being processed */
 	struct list_head processing;
 
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 7b146bb..88b9ca4 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -582,6 +582,7 @@
 	memset(fpq, 0, sizeof(struct fuse_pqueue));
 	INIT_LIST_HEAD(&fpq->processing);
 	INIT_LIST_HEAD(&fpq->io);
+	fpq->connected = 1;
 }
 
 void fuse_conn_init(struct fuse_conn *fc)