[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUjfeGuSVVq84iHc@mtj.duckdns.org>
Date: Mon, 20 Sep 2021 09:22:32 -1000
From: Tejun Heo <tj@...nel.org>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: gregkh@...uxfoundation.org, akpm@...ux-foundation.org,
minchan@...nel.org, jeyu@...nel.org, shuah@...nel.org,
rdunlap@...radead.org, rafael@...nel.org, masahiroy@...nel.org,
ndesaulniers@...gle.com, yzaikin@...gle.com, nathan@...nel.org,
ojeda@...nel.org, penguin-kernel@...ove.sakura.ne.jp,
vitor@...saru.org, elver@...gle.com, jarkko@...nel.org,
glider@...gle.com, rf@...nsource.cirrus.com,
stephen@...workplumber.org, David.Laight@...lab.com,
bvanassche@....org, jolsa@...nel.org,
andriy.shevchenko@...ux.intel.com, trishalfonso@...gle.com,
andreyknvl@...il.com, jikos@...nel.org, mbenes@...e.com,
ngupta@...are.org, sergey.senozhatsky.work@...il.com,
reinette.chatre@...el.com, fenghua.yu@...el.com, bp@...en8.de,
x86@...nel.org, hpa@...or.com, lizefan.x@...edance.com,
hannes@...xchg.org, daniel.vetter@...ll.ch, bhelgaas@...gle.com,
kw@...ux.com, dan.j.williams@...el.com, senozhatsky@...omium.org,
hch@....de, joe@...ches.com, hkallweit1@...il.com, axboe@...nel.dk,
jpoimboe@...hat.com, tglx@...utronix.de, keescook@...omium.org,
rostedt@...dmis.org, peterz@...radead.org,
linux-spdx@...r.kernel.org, linux-doc@...r.kernel.org,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kselftest@...r.kernel.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, copyleft-next@...ts.fedorahosted.org
Subject: Re: [PATCH v7 09/12] sysfs: fix deadlock race with module removal
Hello,
On Mon, Sep 20, 2021 at 12:15:22PM -0700, Luis Chamberlain wrote:
> > I find this explanation odd because there's no real equivalent to locking
> > the module (as opposed to try locking)
>
> Actually there is, __module_get() but I suspect some of these users are
> probably incorrect and should be be moved to try. The documentation
__module_get() is just getting an extra ref when the caller already
has one (or more). It can't be used to freshly acquire a new
reference. There is no equivalence between the relationship between
try_module_get() and __module_get() and the one between spin_trylock()
and spin_lock().
> Right, the reason I mention the alternative is that we technically don't
> need to use try in this case since during a kernfs op it is implied the
> module will be pinned, but we have further motivations to use a try
I'm confused. If the module is already pinned, why are we getting an
extra reference? Also, I don't understand how this has that much to do
with preventing ddoses. I mean, it does cut down the duration of one
operation but the eventual gating is through whoever acquiring the
initial reference through try_module_get(), which again is the *only*
way to acquire a fresh reference.
Thanks.
--
tejun
Powered by blists - more mailing lists