Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de82b923 authored by Brian Foster's avatar Brian Foster Committed by Miklos Szeredi
Browse files

fuse: allocate for_background dio requests based on io->async state



Commit 8b41e671 introduced explicit background checking for fuse_req
structures with BUG_ON() checks for the appropriate type of request in
in the associated send functions. Commit bcba24cc introduced the ability
to send dio requests as background requests but does not update the
request allocation based on the type of I/O request. As a result, a
BUG_ON() triggers in the fuse_request_send_background() background path if
an async I/O is sent.

Allocate a request based on the async state of the fuse_io_priv to avoid
the BUG.

Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent f722406f
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1278,6 +1278,9 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, const struct iovec *iov,

	iov_iter_init(&ii, iov, nr_segs, count, 0);

	if (io->async)
		req = fuse_get_req_for_background(fc, fuse_iter_npages(&ii));
	else
		req = fuse_get_req(fc, fuse_iter_npages(&ii));
	if (IS_ERR(req))
		return PTR_ERR(req);
@@ -1314,6 +1317,10 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, const struct iovec *iov,
			break;
		if (count) {
			fuse_put_request(fc, req);
			if (io->async)
				req = fuse_get_req_for_background(fc,
					fuse_iter_npages(&ii));
			else
				req = fuse_get_req(fc, fuse_iter_npages(&ii));
			if (IS_ERR(req))
				break;