From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org,
Lennart Poettering <lennart@poettering.net>
Subject: Re: [PATCH 1/2] nvmet: make 'readonly' setting configurable
Date: Tue, 8 Apr 2025 15:24:39 +0100 [thread overview]
Message-ID: <Z_Uxp-IMSjHFgGDY@kbusch-mbp> (raw)
In-Reply-To: <20250404062126.GB31468@lst.de>
On Fri, Apr 04, 2025 at 08:21:26AM +0200, Christoph Hellwig wrote:
> On Thu, Apr 03, 2025 at 09:44:55AM -0600, Keith Busch wrote:
> > > + mutex_lock(&ns->subsys->lock);
> > > + if (ns->enabled) {
> > > + pr_err("the ns:%d is already enabled.\n", ns->nsid);
> > > + mutex_unlock(&ns->subsys->lock);
> > > + return -EINVAL;
> > > + }
> > > + ns->readonly = val;
> > > + mutex_unlock(&ns->subsys->lock);
> >
> > Not sure how people feel about the "cleanup" constructs. If we're okay
> > using them in this driver, this is a simple use case for the guard to
> > manage the mutex:
> >
> > guard(mutex)(&ns->subsys->lock);
> >
> > And then you don't need to worry about unlocking.
>
> I really hate it with passion as the syntax is so butt ugly and has
> no explicit unlock point.
Okay, that's why I asked. Some subsystems have embraced it, but not
others. Since we haven't considered it for nvme yet, this looked like an
opportunity to feel that out, and it's totally fine with me if we avoid
the guard model.
next prev parent reply other threads:[~2025-04-08 14:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 14:47 [PATCH 0/2] nvmet: improve 'read-only' handling Hannes Reinecke
2025-04-03 14:47 ` [PATCH 1/2] nvmet: make 'readonly' setting configurable Hannes Reinecke
2025-04-03 15:44 ` Keith Busch
2025-04-03 15:51 ` Hannes Reinecke
2025-04-04 6:21 ` Christoph Hellwig
2025-04-08 14:24 ` Keith Busch [this message]
2025-04-04 6:25 ` Christoph Hellwig
2025-04-03 14:47 ` [PATCH 2/2] nvmet: implement persistent read-only namespace feature Hannes Reinecke
2025-04-04 6:26 ` Christoph Hellwig
2025-04-04 9:36 ` Hannes Reinecke
2025-04-04 6:19 ` [PATCH 0/2] nvmet: improve 'read-only' handling Christoph Hellwig
2025-04-04 6:25 ` Hannes Reinecke
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=Z_Uxp-IMSjHFgGDY@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=hare@kernel.org \
--cc=hch@lst.de \
--cc=lennart@poettering.net \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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.