From: Tejun Heo <tj@kernel.org>
To: Jens Axboe <jaxboe@fusionio.com>
Cc: Dave Jones <davej@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH v3.4-rc5] block: iocontext->nr_tasks should be initialized to one
Date: Tue, 1 May 2012 09:17:29 -0700 [thread overview]
Message-ID: <20120501161729.GV26595@google.com> (raw)
In-Reply-To: <1335873936.16988.148.camel@lappy>
create_task_io_context() left ioc->nr_tasks at zero; however, a newly
created ioc should have its nr_tasks initialized to one as it begins
attached to the task creating it.
This affects only CLONE_IO which currently doesn't seem to have any
actual user. Sasha triggered WARN_ON_ONCE() in ioc_task_link() using
syscall fuzzer. Even when it happens, the failure mode isn't critical
(blk-cgroup may allow attaching a CLONE_IO'd task to a cgroup when it
shouldn't and blkcg limits may behave weirdly).
Fix it by initializing it to one in create_task_io_context().
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Sasha Levin <levinsasha928@gmail.com>
LKML-Reference: <1335873936.16988.148.camel@lappy>
Cc: stable@vger.kernel.org
---
block/blk-ioc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 1e2d53b..c942409 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -244,6 +244,7 @@ int create_task_io_context(struct task_struct *task, gfp_t gfp_flags, int node)
/* initialize */
atomic_long_set(&ioc->refcount, 1);
atomic_set(&ioc->active_ref, 1);
+ atomic_set(&ioc->nr_tasks, 1);
spin_lock_init(&ioc->lock);
INIT_RADIX_TREE(&ioc->icq_tree, GFP_ATOMIC | __GFP_HIGH);
INIT_HLIST_HEAD(&ioc->icq_list);
next prev parent reply other threads:[~2012-05-01 16:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-01 12:05 WARNING: at include/linux/iocontext.h:140 copy_io+0xb9/0x130() Sasha Levin
2012-05-01 16:17 ` Tejun Heo [this message]
2012-05-01 18:02 ` [PATCH v3.4-rc5] block: iocontext->nr_tasks should be initialized to one Jens Axboe
2012-05-01 18:09 ` Tejun Heo
2012-05-01 18:18 ` Jens Axboe
2012-05-01 18:31 ` Jeff Moyer
2012-05-01 18:36 ` Vivek Goyal
2012-05-01 18:48 ` Jeff Moyer
2012-05-01 18:59 ` Vivek Goyal
2012-05-01 19:04 ` Jeff Moyer
2012-05-01 19:08 ` Vivek Goyal
2012-05-01 18:37 ` Jens Axboe
2012-05-01 18:50 ` Jeff Moyer
2012-05-01 19:03 ` Jens Axboe
2012-05-01 18:04 ` Jens Axboe
2012-05-01 18:06 ` Tejun Heo
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=20120501161729.GV26595@google.com \
--to=tj@kernel.org \
--cc=davej@redhat.com \
--cc=jaxboe@fusionio.com \
--cc=levinsasha928@gmail.com \
--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