From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Tejun Heo <tj@kernel.org>, Vivek Goyal <vgoyal@redhat.com>,
Jens Axboe <axboe@kernel.dk>
Subject: [PATCH] blkcg: stop iteration early if root_rl is the only request list
Date: Mon, 22 Oct 2012 10:15:37 +0900 [thread overview]
Message-ID: <50849E39.2040609@ce.jp.nec.com> (raw)
In-Reply-To: <20121018212053.GK13370@google.com>
__blk_queue_next_rl() finds next request list based on blkg_list
while skipping root_blkg in the list.
OTOH, root_rl is special as it may exist even without root_blkg.
Though the later part of the function handles such a case correctly,
exiting early is good for readability of the code.
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
---
block/blk-cgroup.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 54f35d1..a31e678 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -333,6 +333,9 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl,
*/
if (rl == &q->root_rl) {
ent = &q->blkg_list;
+ /* There are no more block groups, hence no request lists */
+ if (list_empty(ent))
+ return NULL;
} else {
blkg = container_of(rl, struct blkcg_gq, rl);
ent = &blkg->q_node;
next prev parent reply other threads:[~2012-10-22 1:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 5:11 [PATCH] Fix use-after-free of q->root_blkg and q->root_rl.blkg Jun'ichi Nomura
2012-10-10 15:59 ` Vivek Goyal
2012-10-11 1:31 ` Jun'ichi Nomura
2012-10-11 18:55 ` Vivek Goyal
2012-10-16 23:20 ` Tejun Heo
2012-10-17 0:02 ` Jun'ichi Nomura
2012-10-17 8:45 ` [PATCH] blkcg: " Jun'ichi Nomura
2012-10-18 21:21 ` Tejun Heo
2012-10-22 18:43 ` Jens Axboe
2012-10-17 13:47 ` [PATCH] " Vivek Goyal
2012-10-18 2:56 ` Jun'ichi Nomura
2012-10-18 13:31 ` Vivek Goyal
2012-10-18 21:20 ` Tejun Heo
2012-10-19 14:53 ` Vivek Goyal
2012-10-22 0:55 ` Jun'ichi Nomura
2012-10-22 1:15 ` Jun'ichi Nomura [this message]
2012-10-22 15:31 ` [PATCH] blkcg: stop iteration early if root_rl is the only request list Vivek Goyal
2012-10-22 18:43 ` Jens Axboe
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=50849E39.2040609@ce.jp.nec.com \
--to=j-nomura@ce.jp.nec.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=vgoyal@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.