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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 26 Oct 2011 12:01:01 -0400
From:	Vivek Goyal <vgoyal@...hat.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	axboe@...nel.dk, ctalbott@...gle.com, rni@...gle.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 04/13] block: make ioc get/put interface more
 conventional and fix race on alloction

On Tue, Oct 25, 2011 at 06:48:30PM -0700, Tejun Heo wrote:

[..]
> @@ -1645,11 +1645,12 @@ static void blkiocg_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
>  {
>  	struct io_context *ioc;
>  
> -	task_lock(tsk);
> -	ioc = tsk->io_context;
> -	if (ioc)
> +	/* we don't lose anything even if ioc allocation fails */
> +	ioc = get_task_io_context(tsk, GFP_ATOMIC, NUMA_NO_NODE);
> +	if (ioc) {
>  		ioc->cgroup_changed = 1;
> -	task_unlock(tsk);
> +		put_io_context(ioc);
> +	}

We really don't need to create a new io context here if it is not present.
cgroup_changed is set so that reference to old sync cfqq is dropped and
a new one is assigned when new IO comes in. Given the fact that io context
is not even present for the task being attached, there is no way there
is associated cic and associated cfqq. So no need to set changed_cgroup=1.

Will it make sense to pass in additional parameter to get_task_io_context()
so that it takes a reference if ioc exists otherwise returns NULL. Or may
be another variant of get_task_io_context() function.

This is a minor issue though. Will just avoid creating iocontext memory
for task if one is not using CFQ in the system.

[..]
>  
> +extern char __blk_test_mode[2];
> +#define blk_test_mode	(__blk_test_mode[0])
> +

Looks like leftover of your testing code.

Thanks
Vivek
--
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