qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 3d5d31: blockjob: Make block_job_pause_all()


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 3d5d31: blockjob: Make block_job_pause_all() keep a refere...
Date: Mon, 04 Dec 2017 10:03:43 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 3d5d319e1221082974711af1d09d82f0755c1698
      
https://github.com/qemu/qemu/commit/3d5d319e1221082974711af1d09d82f0755c1698
  Author: Alberto Garcia <address@hidden>
  Date:   2017-12-04 (Mon, 04 Dec 2017)

  Changed paths:
    M blockjob.c

  Log Message:
  -----------
  blockjob: Make block_job_pause_all() keep a reference to the jobs

Starting from commit 40840e419be31e6a32e6ea24511c74b389d5e0e4 we are
pausing all block jobs during bdrv_reopen_multiple() to prevent any of
them from finishing and removing nodes from the graph while they are
being reopened.

It turns out that pausing a block job doesn't necessarily prevent it
from finishing: a paused block job can still run its exit function
from the main loop and call block_job_completed(). The mirror block
job in particular always goes to the main loop while it is paused (by
virtue of the bdrv_drained_begin() call in mirror_run()).

Destroying a paused block job during bdrv_reopen_multiple() has two
consequences:

   1) The references to the nodes involved in the job are released,
      possibly destroying some of them. If those nodes were in the
      reopen queue this would trigger the problem originally described
      in commit 40840e419be, crashing QEMU.

   2) At the end of bdrv_reopen_multiple(), bdrv_drain_all_end() would
      not be doing all necessary bdrv_parent_drained_end() calls.

I can reproduce problem 1) easily with iotest 030 by increasing
STREAM_BUFFER_SIZE from 512KB to 8MB in block/stream.c, or by tweaking
the iotest like in this example:

   https://lists.gnu.org/archive/html/qemu-block/2017-11/msg00934.html

This patch keeps an additional reference to all block jobs between
block_job_pause_all() and block_job_resume_all(), guaranteeing that
they are kept alive.

Signed-off-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 2a4c7e839101a52f7bf9ba4dd64e466518565352
      
https://github.com/qemu/qemu/commit/2a4c7e839101a52f7bf9ba4dd64e466518565352
  Author: Peter Maydell <address@hidden>
  Date:   2017-12-04 (Mon, 04 Dec 2017)

  Changed paths:
    M blockjob.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches for 2.11.0-rc4

# gpg: Signature made Mon 04 Dec 2017 16:46:07 GMT
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <address@hidden>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  blockjob: Make block_job_pause_all() keep a reference to the jobs

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/e80a25611c67...2a4c7e839101

reply via email to

[Prev in Thread] Current Thread [Next in Thread]