All of lore.kernel.org
 help / color / mirror / Atom feed
From: Walker, Benjamin <benjamin.walker at intel.com>
To: spdk@lists.01.org
Subject: Re: [SPDK] Bdev claim and single writer semantics
Date: Thu, 26 Apr 2018 23:26:33 +0000	[thread overview]
Message-ID: <1524785192.2609.14.camel@intel.com> (raw)
In-Reply-To: CANvN+e=8pD0y1m=WoJwHPCp0K0Anh2+-X79t0U1xpXTDTV2BKA@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 3199 bytes --]

On Thu, 2018-04-26 at 15:25 +0300, Andrey Kuzmin wrote:
> Hi all,
> 
> while looking at the block device subsystem code, I noticed bdev
> claims being used for two purposes at the same time. First (and a
> primary one, as far as I understood it) is a perfectly reasonable idea
> to provide the bdev subsystem with dependency information so that
> block devices could be brought up and shut down in the proper order
> (which doesn't seem to be in place yet, though).
> 
> On the second hand, claims are somewhat counter-intuitively also used
> to ensure single writer semantics where only a module that has claimed
> the block device has write access. While it may be considered a safety
> measure of sorts, it doesn't go well with the case where a
> higher-level application is interested in shared access to the
> underlying block device(s), in particular when there are
> application-level means to ensure access consistency under multiple
> writers scenario.
> 
> While adding support for the shared access semantics seems to be
> pretty straightforward, I thought it reasonable to bring the issue up
> here first, looking for insights, comments, and objections. Please let
> me know if there are any or I can give a shot to a shared access
> patch.

Your analysis is all correct. There are two access control mechanisms in the
bdev layer for different purposes; claiming, which is for stacking bdevs
together to make I/O pipelines, and descriptors, which is standard read/write
access control for consumers of bdevs. We thought it made the most sense to
allow write access to a bdev from only a single module for safety reasons.
That's actually a fairly narrow limitation and I'm not sure it is precluding you
from doing what you are looking to do.

The rule, as it is written today, is that if a bdev isn't claimed by a bdev
module (i.e. it doesn't have a bdev stacked on top of it), then multiple write
descriptors can be used. If it is claimed by a bdev module (i.e. another bdev is
 stacked on top of it), then other consumers may only open it as read only.

Is your use case that you have some stack of bdevs, and then at some point your
application wants to write to one of the bdevs that's not at the top of the
stack? As a concrete example, this would be like having a RAID volume that you
normally write to, but at some point your application bypasses the RAID logic
and writes directly to one of the disks that back it. That sounds fishy to me,
but I'm open to legitimate use cases here.

If you application wants to use a bdev that is at the top of a stack from
multiple places, then you should be able to open multiple write descriptors
today. Just don't have your application claim the bdev.

We've tried to make this as clear as possible, but it could really use some
better documentation at a minimum. And discussion about how best to present
these concepts to users and make it easier to use is always very welcome. Let me
know what your thoughts are.

> 
> Best regards,
> Andrey
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://lists.01.org/mailman/listinfo/spdk

             reply	other threads:[~2018-04-26 23:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 23:26 Walker, Benjamin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-09 21:57 [SPDK] Bdev claim and single writer semantics Walker, Benjamin
2018-05-09 17:58 Andrey Kuzmin
2018-05-09 17:32 Walker, Benjamin
2018-05-09  8:12 Andrey Kuzmin
2018-05-02 22:07 Andrey Kuzmin
2018-05-02 16:45 Walker, Benjamin
2018-05-02 13:58 Luse, Paul E
2018-05-02 13:40 Andrey Kuzmin
2018-04-30 17:26 Andrey Kuzmin
2018-04-30 17:24 Walker, Benjamin
2018-04-28 21:35 Andrey Kuzmin
2018-04-28 21:30 Andrey Kuzmin
2018-04-28 21:13 Luse, Paul E
2018-04-27 23:06 Harris, James R
2018-04-27 15:04 Andrey Kuzmin
2018-04-26 12:25 Andrey Kuzmin

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=1524785192.2609.14.camel@intel.com \
    --to=spdk@lists.01.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 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.