From ece4fa9152ea37c7ebd158af330e3b20e33cf385 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Wed, 11 Nov 2020 17:39:12 +0200 Subject: file-posix: allow -EBUSY errors during write zeros on raw block devices On Linux, fallocate(fd, FALLOC_FL_PUNCH_HOLE) when it is used on a block device, without O_DIRECT can return -EBUSY if it races with another write to the same page. Since this is rare and discard is not a critical operation, ignore this error Signed-off-by: Maxim Levitsky Message-Id: <20201111153913.41840-2-mlevitsk@redhat.com> Signed-off-by: Kevin Wolf --- block/file-posix.c | 1 + 1 file changed, 1 insertion(+) (limited to 'block') diff --git a/block/file-posix.c b/block/file-posix.c index c63926d592..d5fd1dbcd2 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1698,6 +1698,7 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque) switch (ret) { case -ENOTSUP: case -EINVAL: + case -EBUSY: break; default: return ret; -- cgit v1.2.3-55-g7522 From bd89f93603f4e588e80f2e622118bf4131f30865 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 13 Nov 2020 10:41:02 -0500 Subject: io_uring: do not use pointer after free Even though only the pointer value is only printed, it is untidy and Coverity complains. Cc: Stefan Hajnoczi Signed-off-by: Paolo Bonzini Message-Id: <20201113154102.1460459-1-pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Kevin Wolf --- block/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block') diff --git a/block/io_uring.c b/block/io_uring.c index 037af09471..00a3ee9fb8 100644 --- a/block/io_uring.c +++ b/block/io_uring.c @@ -425,6 +425,6 @@ LuringState *luring_init(Error **errp) void luring_cleanup(LuringState *s) { io_uring_queue_exit(&s->ring); - g_free(s); trace_luring_cleanup_state(s); + g_free(s); } -- cgit v1.2.3-55-g7522 From 9ca5b0e8427789438f5f8e8b6cc76bc8eb76c941 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Fri, 13 Nov 2020 22:17:16 +0100 Subject: quorum: Require WRITE perm with rewrite-corrupted Using rewrite-corrupted means quorum may issue writes to its children just from receiving read requests from its parents. Thus, it must take the WRITE permission when rewrite-corrupted is used. Signed-off-by: Max Reitz Message-Id: <20201113211718.261671-2-mreitz@redhat.com> Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/quorum.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'block') diff --git a/block/quorum.c b/block/quorum.c index e846a7e892..b10fc2089e 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -1163,7 +1163,12 @@ static void quorum_child_perm(BlockDriverState *bs, BdrvChild *c, uint64_t perm, uint64_t shared, uint64_t *nperm, uint64_t *nshared) { + BDRVQuorumState *s = bs->opaque; + *nperm = perm & DEFAULT_PERM_PASSTHROUGH; + if (s->rewrite_corrupted) { + *nperm |= BLK_PERM_WRITE; + } /* * We cannot share RESIZE or WRITE, as this would make the -- cgit v1.2.3-55-g7522