[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171130002259.GY729@wotan.suse.de>
Date: Thu, 30 Nov 2017 01:22:59 +0100
From: "Luis R. Rodriguez" <mcgrof@...nel.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: "Luis R. Rodriguez" <mcgrof@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>, bart.vanassche@....com,
ming.lei@...hat.com, Ted Ts'o <tytso@....edu>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Jiri Kosina <jikos@...nel.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
linux-fsdevel@...r.kernel.org,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
Todd Brandt <todd.e.brandt@...ux.intel.com>, nborisov@...e.com,
Jan Kara <jack@...e.cz>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Oliver Neukum <ONeukum@...e.com>, oleksandr@...alenko.name,
Oleg Antonyan <oleg.b.antonyan@...il.com>,
Yu Chen <yu.chen.surf@...il.com>,
Dan Williams <dan.j.williams@...el.com>,
Linux PM <linux-pm@...r.kernel.org>,
linux-block@...r.kernel.org, linux-xfs@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 05/11] fs: add iterate_supers_excl() and
iterate_supers_reverse_excl()
On Thu, Nov 30, 2017 at 12:48:15AM +0100, Rafael J. Wysocki wrote:
> On Thu, Nov 30, 2017 at 12:23 AM, Luis R. Rodriguez <mcgrof@...nel.org> wrote:
> > +int iterate_supers_excl(int (*f)(struct super_block *, void *), void *arg)
> > +{
> > + struct super_block *sb, *p = NULL;
> > + int error = 0;
> > +
> > + spin_lock(&sb_lock);
> > + list_for_each_entry(sb, &super_blocks, s_list) {
> > + if (hlist_unhashed(&sb->s_instances))
> > + continue;
> > + sb->s_count++;
> > + spin_unlock(&sb_lock);
>
> Can anything bad happen if the list is modified at this point by a
> concurrent thread?
The race is theoretical and applies to all users of iterate_supers() as well.
Its certainly worth considering, however given other code is implicated its
not a *new* issue or race. Its the best we can do with the current design.
That said, as I looked at all this code I considered that perhaps super_blocks
deserves its own RCU lock to enable us to do full swap operations on the list,
without having to do these nasty releases in between.
If that's possible / desirable I'd consider it a welcomed future optimization,
and I could give it a shot, however its unclear if this is a requirement for
this feature at this time.
Luis
Powered by blists - more mailing lists