diff options
author | Frédéric Danis <frederic.danis@collabora.com> | 2022-01-25 18:14:05 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2022-03-11 10:46:34 +0100 |
commit | d2a0a616ab2246aab9527eeacf86a033679c8b22 (patch) | |
tree | f20757bf5efbfacc01c905f417b35fadc9eaf9fe /arch/um/drivers | |
parent | b35507a4cfb26b7fcc0c97de6367828d5902bbba (diff) |
um: Fix WRITE_ZEROES in the UBD Driver
Call to fallocate with FALLOC_FL_PUNCH_HOLE on a device backed by a sparse
file can end up by missing data, zeroes data range, if the underlying file
is used with a tool like bmaptool which will referenced only used spaces.
Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Acked-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 69d2d0049a61..b03269faef71 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1526,13 +1526,19 @@ static void do_io(struct io_thread_req *req, struct io_desc *desc) } break; case REQ_OP_DISCARD: - case REQ_OP_WRITE_ZEROES: n = os_falloc_punch(req->fds[bit], off, len); if (n) { req->error = map_error(-n); return; } break; + case REQ_OP_WRITE_ZEROES: + n = os_falloc_zeroes(req->fds[bit], off, len); + if (n) { + req->error = map_error(-n); + return; + } + break; default: WARN_ON_ONCE(1); req->error = BLK_STS_NOTSUPP; |