/* If the request is asynchronous, then the end function needs to be called after waiting for the request to be unlocked (if it was locked).  */
static void end_io_requests(struct fuse_conn *fc) __releases(&fc -> lock) __acquires(&fc->lock)
/* If the request is asynchronous, then the end function needs to be called after waiting for the request to be unlocked (if it was locked).  */
static void end_io_requests(struct fuse_conn *fc) __releases(&fc -> lock) __acquires(&fc->lock)
{
	while (!list_empty(&fc->io)) {
		struct fuse_req *req =
			list_entry(fc->io.next, struct fuse_req, list);
		void (*end) (struct fuse_conn *, struct fuse_req *) = req->end;
		req->aborted = 1;
		req->out.h.error = -ECONNABORTED;
		req->state = FUSE_REQ_FINISHED;
		list_del_init(&req->list);
		wake_up(&req->waitq);
		if (end) {
			req->end = NULL;
			__fuse_get_request(req);
			spin_unlock(&fc->lock);
			wait_event(req->waitq, !req->locked);
			end(fc, req);
			fuse_put_request(fc, req);
			spin_lock(&fc->lock);
		}
	}
}