lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080415072400.GA12774@kernel.dk>
Date:	Tue, 15 Apr 2008 09:24:01 +0200
From:	Jens Axboe <jens.axboe@...cle.com>
To:	Nikanth Karthikesan <knikanth@...e.de>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] increment nr_tasks in io_context when CLONE_IO is set

On Tue, Apr 15 2008, Nikanth Karthikesan wrote:
> Increment the nr_tasks associated with the io_context when CLONE_IO flag
> is set.
> 
> Signed-off-by: Nikanth Karthikesan <knikanth@...e.de>
> 
> --
> diff --git a/kernel/fork.c b/kernel/fork.c
> index dd249c3..01e843b 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -812,6 +812,7 @@ static int copy_io(unsigned long clone_f
>  		tsk->io_context = ioc_task_link(ioc);
>  		if (unlikely(!tsk->io_context))
>  			return -ENOMEM;
> +		atomic_inc(&tsk->io_context->nr_tasks);
>  	} else if (ioprio_valid(ioc->ioprio)) {
>  		tsk->io_context = alloc_io_context(GFP_KERNEL, -1);
>  		if (unlikely(!tsk->io_context))

Fix is correct, however it would be more appropriate in ioc_task_link()
instead.

diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index cac4b36..2b7a118 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -91,8 +91,10 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
 	 * if ref count is zero, don't allow sharing (ioc is going away, it's
 	 * a race).
 	 */
-	if (ioc && atomic_inc_not_zero(&ioc->refcount))
+	if (ioc && atomic_inc_not_zero(&ioc->refcount)) {
+		atomic_inc(&ioc->nr_tasks);
 		return ioc;
+	}
 
 	return NULL;
 }

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ