Skip to content

Commit

Permalink
fuse: allocate for_background dio requests based on io->async state
Browse files Browse the repository at this point in the history
Commit 8b41e67 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 bcba24c 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: Brian Foster <bfoster@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
  • Loading branch information
Brian Foster authored and Miklos Szeredi committed May 14, 2013
1 parent f722406 commit de82b92
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,10 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, const struct iovec *iov,

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

req = fuse_get_req(fc, fuse_iter_npages(&ii));
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);

Expand Down Expand Up @@ -1314,7 +1317,11 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, const struct iovec *iov,
break;
if (count) {
fuse_put_request(fc, req);
req = fuse_get_req(fc, fuse_iter_npages(&ii));
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;
}
Expand Down

0 comments on commit de82b92

Please sign in to comment.