diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2018-07-26 10:13:12 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-07-26 10:13:12 -0400 |
commit | 75f3ee4c288d92d022481b4d9d56599714ca0ce3 (patch) | |
tree | 792a42c27d7bc77fe4b862b5eb96ec874aefafeb | |
parent | 109728ccc5933151c68d1106e4065478a487a323 (diff) |
fuse: simplify fuse_abort_conn()
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r-- | fs/fuse/dev.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 4a9ace7280b9..de3d273c9366 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -2101,8 +2101,7 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) | |||
2101 | if (fc->connected) { | 2101 | if (fc->connected) { |
2102 | struct fuse_dev *fud; | 2102 | struct fuse_dev *fud; |
2103 | struct fuse_req *req, *next; | 2103 | struct fuse_req *req, *next; |
2104 | LIST_HEAD(to_end1); | 2104 | LIST_HEAD(to_end); |
2105 | LIST_HEAD(to_end2); | ||
2106 | 2105 | ||
2107 | fc->connected = 0; | 2106 | fc->connected = 0; |
2108 | fc->blocked = 0; | 2107 | fc->blocked = 0; |
@@ -2120,11 +2119,11 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) | |||
2120 | if (!test_bit(FR_LOCKED, &req->flags)) { | 2119 | if (!test_bit(FR_LOCKED, &req->flags)) { |
2121 | set_bit(FR_PRIVATE, &req->flags); | 2120 | set_bit(FR_PRIVATE, &req->flags); |
2122 | __fuse_get_request(req); | 2121 | __fuse_get_request(req); |
2123 | list_move(&req->list, &to_end1); | 2122 | list_move(&req->list, &to_end); |
2124 | } | 2123 | } |
2125 | spin_unlock(&req->waitq.lock); | 2124 | spin_unlock(&req->waitq.lock); |
2126 | } | 2125 | } |
2127 | list_splice_init(&fpq->processing, &to_end2); | 2126 | list_splice_tail_init(&fpq->processing, &to_end); |
2128 | spin_unlock(&fpq->lock); | 2127 | spin_unlock(&fpq->lock); |
2129 | } | 2128 | } |
2130 | fc->max_background = UINT_MAX; | 2129 | fc->max_background = UINT_MAX; |
@@ -2132,9 +2131,9 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) | |||
2132 | 2131 | ||
2133 | spin_lock(&fiq->waitq.lock); | 2132 | spin_lock(&fiq->waitq.lock); |
2134 | fiq->connected = 0; | 2133 | fiq->connected = 0; |
2135 | list_splice_init(&fiq->pending, &to_end2); | 2134 | list_for_each_entry(req, &fiq->pending, list) |
2136 | list_for_each_entry(req, &to_end2, list) | ||
2137 | clear_bit(FR_PENDING, &req->flags); | 2135 | clear_bit(FR_PENDING, &req->flags); |
2136 | list_splice_tail_init(&fiq->pending, &to_end); | ||
2138 | while (forget_pending(fiq)) | 2137 | while (forget_pending(fiq)) |
2139 | kfree(dequeue_forget(fiq, 1, NULL)); | 2138 | kfree(dequeue_forget(fiq, 1, NULL)); |
2140 | wake_up_all_locked(&fiq->waitq); | 2139 | wake_up_all_locked(&fiq->waitq); |
@@ -2144,12 +2143,7 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) | |||
2144 | wake_up_all(&fc->blocked_waitq); | 2143 | wake_up_all(&fc->blocked_waitq); |
2145 | spin_unlock(&fc->lock); | 2144 | spin_unlock(&fc->lock); |
2146 | 2145 | ||
2147 | while (!list_empty(&to_end1)) { | 2146 | end_requests(fc, &to_end); |
2148 | req = list_first_entry(&to_end1, struct fuse_req, list); | ||
2149 | list_del_init(&req->list); | ||
2150 | request_end(fc, req); | ||
2151 | } | ||
2152 | end_requests(fc, &to_end2); | ||
2153 | } else { | 2147 | } else { |
2154 | spin_unlock(&fc->lock); | 2148 | spin_unlock(&fc->lock); |
2155 | } | 2149 | } |