All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block: Don't lock /dev/null and /dev/zero automatically
@ 2018-07-19  3:41 Fam Zheng
  2018-07-19 17:57 ` [Qemu-devel] [Qemu-block] " John Snow
  2018-07-21 21:08 ` [Qemu-devel] " Max Reitz
  0 siblings, 2 replies; 13+ messages in thread
From: Fam Zheng @ 2018-07-19  3:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Max Reitz, qemu-block

On my Fedora 28, /dev/null is locked by some other process (couldn't
inspect it due to the current lslocks limitation), so iotests 226 fails
with some unexpected image locking errors because it uses qemu-io to
open it.

Actually it's safe to not use any lock on /dev/null or /dev/zero.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 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 60af4b3d51..8bf034108a 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -503,7 +503,12 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
         s->use_lock = false;
         break;
     case ON_OFF_AUTO_AUTO:
-        s->use_lock = qemu_has_ofd_lock();
+        if (!strcmp(filename, "/dev/null") ||
+                   !strcmp(filename, "/dev/zero")) {
+            s->use_lock = false;
+        } else {
+            s->use_lock = qemu_has_ofd_lock();
+        }
         break;
     default:
         abort();
-- 
2.17.1

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

end of thread, other threads:[~2018-07-24  1:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19  3:41 [Qemu-devel] [PATCH] block: Don't lock /dev/null and /dev/zero automatically Fam Zheng
2018-07-19 17:57 ` [Qemu-devel] [Qemu-block] " John Snow
2018-07-20  8:24   ` Fam Zheng
2018-07-20 16:35     ` Eric Blake
2018-07-21  6:26       ` Fam Zheng
2018-07-20 18:56     ` John Snow
2018-07-20 16:34   ` Eric Blake
2018-07-21 21:08 ` [Qemu-devel] " Max Reitz
2018-07-22  2:37   ` Fam Zheng
2018-07-22 14:06     ` Max Reitz
2018-07-23  1:56       ` Fam Zheng
2018-07-23 14:37         ` Max Reitz
2018-07-24  1:17           ` Fam Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.