static int io_close(struct io_kiocb *req, struct io_kiocb **nxt,
		    bool force_nonblock)
{
	int ret;

	req->close.put_file = NULL;
	ret = __close_fd_get_file(req->close.fd, &req->close.put_file);
	if (ret < 0)
		return ret;

	/* if the file has a flush method, be safe and punt to async */
	if (req->close.put_file->f_op->flush && !io_wq_current_is_worker())
		goto eagain;

	/*
	 * No ->flush(), safely close from here and just punt the
	 * fput() to async context.
	 */
	ret = filp_close(req->close.put_file, current->files);

	if (ret < 0)
		req_set_fail_links(req);
	io_cqring_add_event(req, ret);

	if (io_wq_current_is_worker()) {
		struct io_wq_work *old_work, *work;

		old_work = work = &req->work;
		io_close_finish(&work);
		if (work && work != old_work)
			*nxt = container_of(work, struct io_kiocb, work);
		return 0;
	}

eagain:
	req->work.func = io_close_finish;
	/*
	 * Do manual async queue here to avoid grabbing files - we don't
	 * need the files, and it'll cause io_close_finish() to close
	 * the file again and cause a double CQE entry for this request
	 */
	io_queue_async_work(req);
	return 0;
}
static int io_close(struct io_kiocb *req, struct io_kiocb **nxt,
		    bool force_nonblock)
{
	int ret;

	req->close.put_file = NULL;
	ret = __close_fd_get_file(req->close.fd, &req->close.put_file);
	if (ret < 0)
		return ret;

	 
	if (req->close.put_file->f_op->flush && !io_wq_current_is_worker())
		goto eagain;

	 
	ret = filp_close(req->close.put_file, current->files);

	if (ret < 0)
		req_set_fail_links(req);
	io_cqring_add_event(req, ret);

	if (io_wq_current_is_worker()) {
		struct io_wq_work *old_work, *work;

		old_work = work = &req->work;
		io_close_finish(&work);
		if (work && work != old_work)
			*nxt = container_of(work, struct io_kiocb, work);
		return 0;
	}

eagain:
	req->work.func = io_close_finish;
	 
	io_queue_async_work(req);
	return 0;
}