Re: [PATCH] ioprio: grab rcu_read_lock in sys_ioprio_{set,get}()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/11, Greg Thelen wrote:
>
> The fix is to:
> a) grab rcu lock in sys_ioprio_{set,get}() and
> b) avoid grabbing tasklist_lock.
> Discussion in: http://marc.info/?l=linux-kernel&m=128951324702889
>
> Signed-off-by: Greg Thelen <gthelen@xxxxxxxxxx>

Reviewed-by: Oleg Nesterov <oleg@xxxxxxxxxx>

> ---
>  fs/ioprio.c |   13 ++++---------
>  1 files changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/ioprio.c b/fs/ioprio.c
> index 748cfb9..7da2a06 100644
> --- a/fs/ioprio.c
> +++ b/fs/ioprio.c
> @@ -103,12 +103,7 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
>  	}
>  
>  	ret = -ESRCH;
> -	/*
> -	 * We want IOPRIO_WHO_PGRP/IOPRIO_WHO_USER to be "atomic",
> -	 * so we can't use rcu_read_lock(). See re-copy of ->ioprio
> -	 * in copy_process().
> -	 */
> -	read_lock(&tasklist_lock);
> +	rcu_read_lock();
>  	switch (which) {
>  		case IOPRIO_WHO_PROCESS:
>  			if (!who)
> @@ -153,7 +148,7 @@ free_uid:
>  			ret = -EINVAL;
>  	}
>  
> -	read_unlock(&tasklist_lock);
> +	rcu_read_unlock();
>  	return ret;
>  }
>  
> @@ -197,7 +192,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
>  	int ret = -ESRCH;
>  	int tmpio;
>  
> -	read_lock(&tasklist_lock);
> +	rcu_read_lock();
>  	switch (which) {
>  		case IOPRIO_WHO_PROCESS:
>  			if (!who)
> @@ -250,6 +245,6 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
>  			ret = -EINVAL;
>  	}
>  
> -	read_unlock(&tasklist_lock);
> +	rcu_read_unlock();
>  	return ret;
>  }
> -- 
> 1.7.3.1
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]