[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZcKHCXtXWVCdi9Ae@kbusch-mbp.mynextlight.net>
Date: Tue, 6 Feb 2024 11:22:49 -0800
From: Keith Busch <kbusch@...nel.org>
To: Hannes Reinecke <hare@...e.de>
Cc: Daniel Wagner <dwagner@...e.de>, James Smart <james.smart@...adcom.com>,
Christoph Hellwig <hch@....de>, linux-nvme@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 12/12] nvmet-fc: use RCU list iterator for assoc_list
On Tue, Feb 06, 2024 at 02:51:24PM +0900, Hannes Reinecke wrote:
> On 1/31/24 16:51, Daniel Wagner wrote:
> > + rcu_read_lock();
> > + if (!nvmet_fc_assoc_exits(tgtport, ran)) {
> > assoc->association_id = ran;
> > list_add_tail_rcu(&assoc->a_list, &tgtport->assoc_list);
> > + done = true;
> > }
> > + rcu_read_unlock();
> > spin_unlock_irqrestore(&tgtport->lock, flags);
>
> Odd. You already take the tgtport lock, so there really is no point in using
> rcu_read_lock() here.
That's a interesting point, but I think it's harmless since there's no
rcu sync within the read section.
https://www.kernel.org/doc/Documentation/RCU/Design/Requirements/Requirements.html#Guaranteed%20Read-to-Write%20Upgrade
That said, the rcu_read_lock() seems like it should be moved to
nvmet_fc_assoc_exits() since that's the only part reading rcu protected
structures.
Powered by blists - more mailing lists