From: Ming Lei <ming.lei@redhat.com>
To: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH V2 4/6] ublk_drv: add device parameter UBLK_PARAM_TYPE_DEVT
Date: Wed, 7 Dec 2022 10:31:57 +0800 [thread overview]
Message-ID: <Y4/7HRzoDW0VeNid@T590> (raw)
In-Reply-To: <2ec739a3-f7ba-0e97-0df6-0d198c6689b5@linux.alibaba.com>
On Fri, Nov 25, 2022 at 03:13:58PM +0800, Ziyang Zhang wrote:
> On 2022/11/24 11:04, Ming Lei wrote:
> > Userspace side only knows device ID, but the associated path of ublkc* and
> > ublkb* could be changed by udev, and that depends on userspace's policy, so
> > add parameter of UBLK_PARAM_TYPE_DEVT for retrieving major/minor of the
> > ublkc* and ublkb*, then user may figure out major/minor of the ublk disks
> > he/she owns. With major/minor, it is easy to find the device node path.
> >
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> > drivers/block/ublk_drv.c | 24 +++++++++++++++++++++++-
> > include/uapi/linux/ublk_cmd.h | 13 +++++++++++++
> > 2 files changed, 36 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> > index 9d1578384cba..04a28a2f2e1f 100644
> > --- a/drivers/block/ublk_drv.c
> > +++ b/drivers/block/ublk_drv.c
> > @@ -54,7 +54,8 @@
> > | UBLK_F_USER_RECOVERY_REISSUE)
> >
> > /* All UBLK_PARAM_TYPE_* should be included here */
> > -#define UBLK_PARAM_TYPE_ALL (UBLK_PARAM_TYPE_BASIC | UBLK_PARAM_TYPE_DISCARD)
> > +#define UBLK_PARAM_TYPE_ALL (UBLK_PARAM_TYPE_BASIC | \
> > + UBLK_PARAM_TYPE_DISCARD | UBLK_PARAM_TYPE_DEVT)
> >
> > struct ublk_rq_data {
> > struct llist_node node;
> > @@ -255,6 +256,10 @@ static int ublk_validate_params(const struct ublk_device *ub)
> > return -EINVAL;
> > }
> >
> > + /* dev_t is read-only */
> > + if (ub->params.types & UBLK_PARAM_TYPE_DEVT)
> > + WARN_ON_ONCE(1);
> Hi, Ming
>
> ublk_validate_params() is only called by ublk_ctrl_set_params().
> Why not return -EINVAL here since UBLK_PARAM_TYPE_DEVT is not
> allowed in ublk_ctrl_set_params(). Then the user may know he has
> made a mistake.
Yeah, it is better to return -EINVAL here.
Thanks,
Ming
next prev parent reply other threads:[~2022-12-07 2:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 3:04 [PATCH V2 0/6] ublk_drv: add mechanism for supporting unprivileged ublk device Ming Lei
2022-11-24 3:04 ` [PATCH V2 1/6] ublk_drv: remove nr_aborted_queues from ublk_device Ming Lei
2022-11-24 3:04 ` [PATCH V2 2/6] ublk_drv: don't probe partitions if the ubq daemon isn't trusted Ming Lei
2022-11-24 6:48 ` Ziyang Zhang
2022-11-24 3:04 ` [PATCH V2 3/6] ublk_drv: move ublk_get_device_from_id into ublk_ctrl_uring_cmd Ming Lei
2022-11-24 7:46 ` Ziyang Zhang
2022-11-24 3:04 ` [PATCH V2 4/6] ublk_drv: add device parameter UBLK_PARAM_TYPE_DEVT Ming Lei
2022-11-25 7:13 ` Ziyang Zhang
2022-12-07 2:31 ` Ming Lei [this message]
2022-11-24 3:04 ` [PATCH V2 5/6] ublk_drv: add module parameter of ublks_max for limiting max allowed ublk dev Ming Lei
2022-11-25 7:27 ` Ziyang Zhang
2022-11-24 3:04 ` [PATCH V2 6/6] ublk_drv: add mechanism for supporting unprivileged ublk device Ming Lei
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=Y4/7HRzoDW0VeNid@T590 \
--to=ming.lei@redhat.com \
--cc=ZiyangZhang@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=error27@gmail.com \
--cc=linux-block@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