qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] file-posix: allow -EBUSY errors during write zeros on block
@ 2021-03-02  1:56 ChangLimin
  2021-03-02 14:10 ` Kevin Wolf
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ChangLimin @ 2021-03-02  1:56 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel, mreitz

After Linux 5.10, write zeros to a multipath device using
ioctl(fd, BLKZEROOUT, range) with cache none or directsync will return EBUSY.

Similar to handle_aiocb_write_zeroes_unmap, handle_aiocb_write_zeroes_block
allow -EBUSY errors during ioctl(fd, BLKZEROOUT, range).

Reference commit in Linux 5.10:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=384d87ef2c954fc58e6c5fd8253e4a1984f5fe02

Signed-off-by: ChangLimin <changlm@chinatelecom.cn>
---
 block/file-posix.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 05079b40ca..3e60c96214 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1629,8 +1629,13 @@ static ssize_t handle_aiocb_write_zeroes_block(RawPosixAIOData *aiocb)
         } while (errno == EINTR);

         ret = translate_err(-errno);
-        if (ret == -ENOTSUP) {
+        switch (ret) {
+        case -ENOTSUP:
+        case -EINVAL:
+        case -EBUSY:
             s->has_write_zeroes = false;
+            return -ENOTSUP;
+            break;
         }
     }
 #endif
--
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-04  0:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-02  1:56 [PATCH] file-posix: allow -EBUSY errors during write zeros on block ChangLimin
2021-03-02 14:10 ` Kevin Wolf
2021-03-02 16:40 ` Nir Soffer
2021-03-04  0:14   ` ChangLimin
2021-03-03  3:24 ` [PATCH V2] file-posix: allow -EBUSY -EINVAL " ChangLimin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).