From: Jan Beulich <jbeulich@suse.com>
To: Paul Durrant <pdurrant@amazon.com>
Cc: xen-devel@lists.xenproject.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Jens Axboe" <axboe@kernel.dk>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>
Subject: Re: [PATCH] xen-blkback: allow module to be cleanly unloaded
Date: Fri, 29 Nov 2019 12:56:15 +0100 [thread overview]
Message-ID: <6d0a90f6-3def-a970-6dca-8d1f3eb66c1c@suse.com> (raw)
In-Reply-To: <20191129113131.1954-1-pdurrant@amazon.com>
On 29.11.2019 12:31, Paul Durrant wrote:
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -173,6 +173,8 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
> init_completion(&blkif->drain_complete);
> INIT_WORK(&blkif->free_work, xen_blkif_deferred_free);
>
> + __module_get(THIS_MODULE);
> +
> return blkif;
> }
>
> @@ -320,6 +322,8 @@ static void xen_blkif_free(struct xen_blkif *blkif)
>
> /* Make sure everything is drained before shutting down */
> kmem_cache_free(xen_blkif_cachep, blkif);
> +
> + module_put(THIS_MODULE);
> }
I realize there are various example of this in the tree, but
isn't this a flawed approach? __module_get() (nor even
try_module_get()) will prevent an unload attempt ahead of it
getting invoked, while execution is already in this module's
.text section. I think the xenbus driver should do this
before calling ->probe(), in case of its failure, and after
a successful call to ->remove().
Jan
next prev parent reply other threads:[~2019-11-29 11:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-29 11:31 Paul Durrant
2019-11-29 11:56 ` Jan Beulich [this message]
2019-11-29 12:16 ` Durrant, Paul
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=6d0a90f6-3def-a970-6dca-8d1f3eb66c1c@suse.com \
--to=jbeulich@suse.com \
--cc=axboe@kernel.dk \
--cc=konrad.wilk@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pdurrant@amazon.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®