Commit de82b923012ff8790bcfff381eb3ca9069d00f49

Authored by Brian Foster
Committed by Miklos Szeredi
1 parent f722406faa

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: Brian Foster <bfoster@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>

Showing 1 changed file with 9 additions and 2 deletions Side-by-side Diff

... ... @@ -1278,7 +1278,10 @@
1278 1278  
1279 1279 iov_iter_init(&ii, iov, nr_segs, count, 0);
1280 1280  
1281   - req = fuse_get_req(fc, fuse_iter_npages(&ii));
  1281 + if (io->async)
  1282 + req = fuse_get_req_for_background(fc, fuse_iter_npages(&ii));
  1283 + else
  1284 + req = fuse_get_req(fc, fuse_iter_npages(&ii));
1282 1285 if (IS_ERR(req))
1283 1286 return PTR_ERR(req);
1284 1287  
... ... @@ -1314,7 +1317,11 @@
1314 1317 break;
1315 1318 if (count) {
1316 1319 fuse_put_request(fc, req);
1317   - req = fuse_get_req(fc, fuse_iter_npages(&ii));
  1320 + if (io->async)
  1321 + req = fuse_get_req_for_background(fc,
  1322 + fuse_iter_npages(&ii));
  1323 + else
  1324 + req = fuse_get_req(fc, fuse_iter_npages(&ii));
1318 1325 if (IS_ERR(req))
1319 1326 break;
1320 1327 }