From: Shaohua Li <shli@fb.com>
To: <linux-kernel@vger.kernel.org>
Cc: <axboe@kernel.dk>, <Kernel-team@fb.com>
Subject: [PATCH] blkcg: put module reference
Date: Mon, 11 Jan 2016 14:43:52 -0800 [thread overview]
Message-ID: <c47cf22b3f041213c765ea5fd65901e4eb397f0a.1452552094.git.shli@fb.com> (raw)
get_gendisk(and get_disk) increases module reference, but put_disk
doesn't decrease the reference. The module reference really should be
decreased in put_disk(), but there are a lot of cases drivers do
alloc_disk/put_disk. Before the put_disk usages are cleaned up, this is
easiest fix.
Signed-off-by: Shaohua Li <shli@fb.com>
---
block/blk-cgroup.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 5a37188..58744ad 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -804,6 +804,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
if (!disk)
return -ENODEV;
if (part) {
+ module_put(disk->fops->owner);
put_disk(disk);
return -ENODEV;
}
@@ -820,6 +821,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
ret = PTR_ERR(blkg);
rcu_read_unlock();
spin_unlock_irq(disk->queue->queue_lock);
+ module_put(disk->fops->owner);
put_disk(disk);
/*
* If queue was bypassing, we should retry. Do so after a
@@ -853,6 +855,7 @@ void blkg_conf_finish(struct blkg_conf_ctx *ctx)
{
spin_unlock_irq(ctx->disk->queue->queue_lock);
rcu_read_unlock();
+ module_put(ctx->disk->fops->owner);
put_disk(ctx->disk);
}
EXPORT_SYMBOL_GPL(blkg_conf_finish);
--
2.4.6
reply other threads:[~2016-01-11 22:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c47cf22b3f041213c765ea5fd65901e4eb397f0a.1452552094.git.shli@fb.com \
--to=shli@fb.com \
--cc=Kernel-team@fb.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.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®