linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: adam.manzanares@wdc.com
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	axboe@kernel.dk, bcrl@kvack.org, tglx@linutronix.de,
	mingo@kernel.org, pombredanne@nexb.com,
	kstewart@linuxfoundation.org, gregkh@linuxfoundation.org,
	bigeasy@linutronix.de, jack@suse.cz, darrick.wong@oracle.com,
	rgoldwyn@suse.com, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-aio@kvack.org,
	linux-api@vger.kernel.org, hch@infradead.org
Subject: Re: [PATCH v5 1/5] block: add ioprio_check_cap function
Date: Mon, 21 May 2018 16:58:14 -0400	[thread overview]
Message-ID: <x49a7ssvi8p.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20180521160147.2372-2-adam.manzanares@wdc.com> (adam manzanares's message of "Mon, 21 May 2018 09:01:43 -0700")

adam.manzanares@wdc.com writes:

> From: Adam Manzanares <adam.manzanares@wdc.com>
>
> Aio per command iopriority support introduces a second interface between
> userland and the kernel capable of passing iopriority. The aio interface also
> needs the ability to verify that the submitting context has sufficient
> priviledges to submit IOPRIO_RT commands. This patch creates the
> ioprio_check_cap function to be used by the ioprio_set system call and also by
> the aio interface.
>
> Signed-off-by: Adam Manzanares <adam.manzanares@wdc.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>


> ---
>  block/ioprio.c         | 22 ++++++++++++++++------
>  include/linux/ioprio.h |  2 ++
>  2 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/block/ioprio.c b/block/ioprio.c
> index 6f5d0b6625e3..f9821080c92c 100644
> --- a/block/ioprio.c
> +++ b/block/ioprio.c
> @@ -61,15 +61,10 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
>  }
>  EXPORT_SYMBOL_GPL(set_task_ioprio);
>  
> -SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
> +int ioprio_check_cap(int ioprio)
>  {
>  	int class = IOPRIO_PRIO_CLASS(ioprio);
>  	int data = IOPRIO_PRIO_DATA(ioprio);
> -	struct task_struct *p, *g;
> -	struct user_struct *user;
> -	struct pid *pgrp;
> -	kuid_t uid;
> -	int ret;
>  
>  	switch (class) {
>  		case IOPRIO_CLASS_RT:
> @@ -92,6 +87,21 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
>  			return -EINVAL;
>  	}
>  
> +	return 0;
> +}
> +
> +SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
> +{
> +	struct task_struct *p, *g;
> +	struct user_struct *user;
> +	struct pid *pgrp;
> +	kuid_t uid;
> +	int ret;
> +
> +	ret = ioprio_check_cap(ioprio);
> +	if (ret)
> +		return ret;
> +
>  	ret = -ESRCH;
>  	rcu_read_lock();
>  	switch (which) {
> diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
> index 627efac73e6d..4a28cec49ec3 100644
> --- a/include/linux/ioprio.h
> +++ b/include/linux/ioprio.h
> @@ -77,4 +77,6 @@ extern int ioprio_best(unsigned short aprio, unsigned short bprio);
>  
>  extern int set_task_ioprio(struct task_struct *task, int ioprio);
>  
> +extern int ioprio_check_cap(int ioprio);
> +
>  #endif

  reply	other threads:[~2018-05-21 20:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 16:01 [PATCH v5 0/5] AIO add per-command iopriority adam.manzanares
2018-05-21 16:01 ` [PATCH v5 1/5] block: add ioprio_check_cap function adam.manzanares
2018-05-21 20:58   ` Jeff Moyer [this message]
2018-05-21 16:01 ` [PATCH v5 2/5] fs: Convert kiocb rw_hint from enum to u16 adam.manzanares
2018-05-22 10:04   ` Christoph Hellwig
2018-05-21 16:01 ` [PATCH v5 3/5] fs: Add aio iopriority support adam.manzanares
2018-05-21 20:58   ` Jeff Moyer
2018-05-22 10:05   ` Christoph Hellwig
2018-05-22 17:43   ` kbuild test robot
2018-05-21 16:01 ` [PATCH v5 4/5] fs: blkdev set bio prio from kiocb prio adam.manzanares
2018-05-21 20:59   ` Jeff Moyer
2018-05-21 21:04   ` Jeff Moyer
2018-05-21 21:43     ` Adam Manzanares
2018-05-21 16:01 ` [PATCH v5 5/5] fs: iomap dio " adam.manzanares
2018-05-21 20:59   ` Jeff Moyer
2018-05-22 10:05   ` Christoph Hellwig
2018-05-21 20:57 ` [PATCH v5 0/5] AIO add per-command iopriority Jeff Moyer
2018-05-21 21:42   ` Adam Manzanares

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=x49a7ssvi8p.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=adam.manzanares@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bcrl@kvack.org \
    --cc=bigeasy@linutronix.de \
    --cc=darrick.wong@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-aio@kvack.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pombredanne@nexb.com \
    --cc=rgoldwyn@suse.com \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH v5 1/5] block: add ioprio_check_cap function' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).