Commit 75f3ee4c authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: simplify fuse_abort_conn()

Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 109728cc
...@@ -2101,8 +2101,7 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) ...@@ -2101,8 +2101,7 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort)
if (fc->connected) { if (fc->connected) {
struct fuse_dev *fud; struct fuse_dev *fud;
struct fuse_req *req, *next; struct fuse_req *req, *next;
LIST_HEAD(to_end1); LIST_HEAD(to_end);
LIST_HEAD(to_end2);
fc->connected = 0; fc->connected = 0;
fc->blocked = 0; fc->blocked = 0;
...@@ -2120,11 +2119,11 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) ...@@ -2120,11 +2119,11 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort)
if (!test_bit(FR_LOCKED, &req->flags)) { if (!test_bit(FR_LOCKED, &req->flags)) {
set_bit(FR_PRIVATE, &req->flags); set_bit(FR_PRIVATE, &req->flags);
__fuse_get_request(req); __fuse_get_request(req);
list_move(&req->list, &to_end1); list_move(&req->list, &to_end);
} }
spin_unlock(&req->waitq.lock); spin_unlock(&req->waitq.lock);
} }
list_splice_init(&fpq->processing, &to_end2); list_splice_tail_init(&fpq->processing, &to_end);
spin_unlock(&fpq->lock); spin_unlock(&fpq->lock);
} }
fc->max_background = UINT_MAX; fc->max_background = UINT_MAX;
...@@ -2132,9 +2131,9 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) ...@@ -2132,9 +2131,9 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort)
spin_lock(&fiq->waitq.lock); spin_lock(&fiq->waitq.lock);
fiq->connected = 0; fiq->connected = 0;
list_splice_init(&fiq->pending, &to_end2); list_for_each_entry(req, &fiq->pending, list)
list_for_each_entry(req, &to_end2, list)
clear_bit(FR_PENDING, &req->flags); clear_bit(FR_PENDING, &req->flags);
list_splice_tail_init(&fiq->pending, &to_end);
while (forget_pending(fiq)) while (forget_pending(fiq))
kfree(dequeue_forget(fiq, 1, NULL)); kfree(dequeue_forget(fiq, 1, NULL));
wake_up_all_locked(&fiq->waitq); wake_up_all_locked(&fiq->waitq);
...@@ -2144,12 +2143,7 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) ...@@ -2144,12 +2143,7 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort)
wake_up_all(&fc->blocked_waitq); wake_up_all(&fc->blocked_waitq);
spin_unlock(&fc->lock); spin_unlock(&fc->lock);
while (!list_empty(&to_end1)) { end_requests(fc, &to_end);
req = list_first_entry(&to_end1, struct fuse_req, list);
list_del_init(&req->list);
request_end(fc, req);
}
end_requests(fc, &to_end2);
} else { } else {
spin_unlock(&fc->lock); spin_unlock(&fc->lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment