qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v2 0/7] block: Ignore loosening perm restrictions failures
Date: Wed,  8 May 2019 20:25:39 +0200	[thread overview]
Message-ID: <20190508182546.2239-1-mreitz@redhat.com> (raw)

Hi,

This series is mainly a fix for
https://bugzilla.redhat.com/show_bug.cgi?id=1703793.  The problem
described there is that mirroring to a gluster volume, then switching
off the volume makes qemu crash.  There are two problems here:

(1) file-posix reopens the FD all the time because it thinks the FD it
    has is RDONLY.  It actually isn’t after the first reopen, we just
    forgot to change the internal flags.  That’s what patch 1 is for.

(2) Even then, when mirror completes, it drops its write permission on
    the FD.  This requires a reopen, which will fail if the volume is
    down.  Mirror doesn’t expect that.  Nobody ever expects that
    dropping permissions can fail, and rightfully so because that’s what
    I think we have generally agreed on.
    Therefore, the block layer should hide this error.  This is what the
    last two patches are for.

The last patch adds two assertions: bdrv_replace_child() (for the old
BDS) and bdrv_inactivate_recurse() assume they only ever drop
assertions.  This is now substantiated by these new assertions.
It turns out that this assumption was just plain wrong.  Patches 3 to 5
make it right.


v2:
- Patch 1: Set s->perm_change_flags for reopen, too [Kevin]
- Patch 6:
  - Rename loosen_restrictions to tighten_restrictions and kind of
    invert its meaning [Kevin]
  - Assert and document that we cannot return useful information about
    whether restrictions are loosened or tightened if the caller wants
    to reopen the node [Kevin]
- Patch 7: Handle loosen_restrictions -> tighten_restrictions fallout


git backport-diff output against v1:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/7:[0001] [FC] 'file-posix: Update open_flags in raw_set_perm()'
002/7:[----] [--] 'block: Add bdrv_child_refresh_perms()'
003/7:[----] [--] 'block/mirror: Fix child permissions'
004/7:[----] [--] 'block/commit: Drop bdrv_child_try_set_perm()'
005/7:[0018] [FC] 'block: Fix order in bdrv_replace_child()'
       ^^^^ Confuses my v1 patch with 8aecf1d1bd250a, should be:
      [----] [--]
006/7:[down] 'block: Add *tighten_restrictions to *check*_perm()'
       ^^^^ Commit title has changed, but should be something like:
      [0061] [FC]
007/7:[0022] [FC] 'block: Ignore loosening perm restrictions failures'


Max Reitz (7):
  file-posix: Update open_flags in raw_set_perm()
  block: Add bdrv_child_refresh_perms()
  block/mirror: Fix child permissions
  block/commit: Drop bdrv_child_try_set_perm()
  block: Fix order in bdrv_replace_child()
  block: Add *tighten_restrictions to *check*_perm()
  block: Ignore loosening perm restrictions failures

 include/block/block_int.h |  15 ++++
 block.c                   | 151 ++++++++++++++++++++++++++++++++------
 block/commit.c            |   2 -
 block/file-posix.c        |   4 +
 block/mirror.c            |  32 +++++---
 5 files changed, 169 insertions(+), 35 deletions(-)

-- 
2.20.1



             reply	other threads:[~2019-05-08 18:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 18:25 Max Reitz [this message]
2019-05-08 18:25 ` [Qemu-devel] [PATCH v2 1/7] file-posix: Update open_flags in raw_set_perm() Max Reitz
2019-05-08 18:25 ` [Qemu-devel] [PATCH v2 2/7] block: Add bdrv_child_refresh_perms() Max Reitz
2019-05-08 18:25 ` [Qemu-devel] [PATCH v2 3/7] block/mirror: Fix child permissions Max Reitz
2019-05-08 18:25 ` [Qemu-devel] [PATCH v2 4/7] block/commit: Drop bdrv_child_try_set_perm() Max Reitz
2019-05-08 18:25 ` [Qemu-devel] [PATCH v2 5/7] block: Fix order in bdrv_replace_child() Max Reitz
2019-05-08 18:25 ` [Qemu-devel] [PATCH v2 6/7] block: Add *tighten_restrictions to *check*_perm() Max Reitz
2019-05-08 18:25 ` [Qemu-devel] [PATCH v2 7/7] block: Ignore loosening perm restrictions failures Max Reitz
2019-05-08 21:50   ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190508182546.2239-1-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).