From: Benjamin Marzinski <bmarzins@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
Martin Wilck <mwilck@suse.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
afaria@redhat.com, qemu-devel@nongnu.org,
Mikulas Patocka <mpatocka@redhat.com>
Subject: Re: Moving from qemu-pr-helper and libmpathpersist to <linux/pr.h>
Date: Wed, 4 Feb 2026 20:03:49 -0500 [thread overview]
Message-ID: <aYPsdWW6ntBq2RFm@redhat.com> (raw)
In-Reply-To: <ff71f35e-06b5-4a82-98ec-8e0419f5ec62@suse.de>
On Thu, Feb 05, 2026 at 12:57:38AM +0100, Hannes Reinecke wrote:
> On 2/4/26 19:32, Stefan Hajnoczi wrote:
> > On Wed, Feb 04, 2026 at 02:19:48PM +0100, Martin Wilck wrote:
> > > Hi Stefan,
> > >
> > > On Tue, 2026-02-03 at 13:04 -0500, Stefan Hajnoczi wrote:
> [ .. ]>>>
> > > > It can be generic. The messages will contain the block device
> > > > major:minor as well as information to describe <linux/pr.h> requests.
> > >
> > > So the ioctls will pass through qemu into the kernel, to be intercepted
> > > by the dm-mpath driver, which will use an upcall to have them handled
> > > by mpathpersistd (for the actual command) and multipathd (for the path
> > > registrations).
> > >
> > > I don't fully understand the advantage, security and complexity-wise,
> > > of this concept, compared to intercepting them qemu and using a socket
> > > to talk to mpathpersistd directly. If we did this, we could even
> > > support both generic and SCSI PR commands.
> >
> > Hi Martin,
> > The simplification and security benefits are on the application side,
> > not on the DM-Multipath side, so I can see what you're getting at. From
> > the DM-Multipath perspective things get a little more complex.
> >
> > From an application perspective, a single API that works across block
> > device types (SCSI, NVMe, DM-Multipath) and requires no privileges or
> > sockets (they are a pain in container environments) is the most
> > convenient. The <linux/pr.h> ioctl API offers exactly this.
> >
> > Unfortunately, DM-Multipath currently does not fully support
> > <linux/pr.h>. It sends PR operations down each path, but that is only a
> > subset of libmpathpersist's logic and multipathd is not kept in sync.
> >
> > My impression is that libmpathpersist and multipathd logic cannot be
> > easily moved into the kernel. This is where the upcall idea comes from.
> > Let's notify multipath-tools from DM-Multipath so it can do its work in
> > userspace.
> >
> It _might_ be possible by extending the current path-switching
> code in the kernel to keep track of PRs. The we could move the
> registration upon path switching, and (ideally) could do away
> with upcalls.
> Not sure, though, how targets react when having to deal with a
> flood of PR commands ...
> But maybe worth a try.
Making a multipath device pretend to be single Persistently Reservable
device involves a lot of ugly workarounds that I'm not really excited to
see in the kernel.
For instance, every time a new path appears or a path that was down when
the device was registered comes up, multipath needs to register that
path. But a preempt could come it while it is doing this (or indeed any
time after multipath registered the other paths). So it has to check
the that the registrations are still there on the other paths before
registering the new path, and then check again afterwards to make sure
that there wasn't a preempt during the registration.
Worse, you can't release a reservation from a path that is down. If
multipath needs to release its reservation, and the path that is holding
it is down, the only solution I could come up with is to suspend the
device so no IO happens. Preempt the reservation to move it to an active
path, which wipes the registrations off all the other paths. Then
reregister the all the active paths again, and unsuspend the device.
The failed paths will get reregistred as they come back up.
And there's more cases like these. They are, of course, just as doable
in the kernel as in userspace, but it's a lot of persistent reservation
code to put into the multipath target.
-Ben
> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke Kernel Storage Architect
> hare@suse.de +49 911 74053 688
> SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
> HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
next prev parent reply other threads:[~2026-02-05 1:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 18:47 Moving from qemu-pr-helper and libmpathpersist to <linux/pr.h> Stefan Hajnoczi
2026-01-27 19:45 ` Paolo Bonzini
2026-01-28 14:18 ` Stefan Hajnoczi
2026-01-28 15:30 ` Hannes Reinecke
2026-01-28 16:13 ` Stefan Hajnoczi
2026-01-27 21:06 ` Benjamin Marzinski
2026-02-03 15:09 ` Stefan Hajnoczi
2026-02-03 17:53 ` Benjamin Marzinski
2026-02-03 18:04 ` Stefan Hajnoczi
2026-02-04 13:19 ` Martin Wilck
2026-02-04 18:32 ` Stefan Hajnoczi
2026-02-04 23:57 ` Hannes Reinecke
2026-02-05 1:03 ` Benjamin Marzinski [this message]
2026-02-05 10:20 ` Martin Wilck
2026-02-05 11:52 ` Martin Wilck
2026-02-05 12:01 ` Daniel P. Berrangé
2026-02-05 13:39 ` Stefan Hajnoczi
2026-02-06 0:03 ` Hannes Reinecke
2026-02-06 14:08 ` Stefan Hajnoczi
2026-02-09 12:50 ` Hannes Reinecke
2026-02-09 14:23 ` Stefan Hajnoczi
2026-02-10 10:23 ` Martin Wilck
2026-02-10 13:59 ` Stefan Hajnoczi
2026-02-10 14:29 ` Martin Wilck
2026-02-05 14:28 ` Stefan Hajnoczi
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=aYPsdWW6ntBq2RFm@redhat.com \
--to=bmarzins@redhat.com \
--cc=afaria@redhat.com \
--cc=hare@suse.de \
--cc=kwolf@redhat.com \
--cc=mpatocka@redhat.com \
--cc=mwilck@suse.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 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.