From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
Leon Romanovsky <leonro@mellanox.com>,
<linux-rdma@vger.kernel.org>
Subject: Re: [PATCH rdma-next v2 2/2] RDMA/core: Update write interface to use automatic object lifetime
Date: Fri, 24 Jul 2020 16:25:35 -0300 [thread overview]
Message-ID: <20200724192535.GA3655847@nvidia.com> (raw)
In-Reply-To: <20200719052223.75245-3-leon@kernel.org>
On Sun, Jul 19, 2020 at 08:22:23AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> The automatic object lifetime model allows us to change write() interface
> to have same logic as ioctl() path. Update the create/alloc functions to be
> in the following format, so code flow will be the same:
> * Allocate objects
> * Initialize them
> * Call to the drivers, this is last step that is allowed to fail
> * Finalize object
> * Return response and allow to core code to handle abort/commit
> respectively.
>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> drivers/infiniband/core/uverbs_cmd.c | 312 ++++++++-------------------
> 1 file changed, 93 insertions(+), 219 deletions(-)
>
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index 68c9a0210220..a66fc3e37a74 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -273,7 +273,7 @@ int ib_init_ucontext(struct uverbs_attr_bundle *attrs)
>
> static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs)
> {
> - struct ib_uverbs_get_context_resp resp;
> + struct ib_uverbs_get_context_resp resp = {};
> struct ib_uverbs_get_context cmd;
> struct ib_device *ib_dev;
> struct ib_uobject *uobj;
> @@ -293,25 +293,20 @@ static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs)
> goto err_ucontext;
> }
>
> - resp = (struct ib_uverbs_get_context_resp){
> - .num_comp_vectors = attrs->ufile->device->num_comp_vectors,
> - .async_fd = uobj->id,
> - };
> - ret = uverbs_response(attrs, &resp, sizeof(resp));
> - if (ret)
> - goto err_uobj;
> -
> ret = ib_init_ucontext(attrs);
> if (ret)
> goto err_uobj;
init_ucontext cannot be undone and cannot be called twice, so it must
be last in the function. I dropped the hunk changing ib_uverbs_get_context().
Applied to for-next, thanks
Jason
prev parent reply other threads:[~2020-07-24 19:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-19 5:22 [PATCH rdma-next v2 0/2] Align write() and ioctl() paths Leon Romanovsky
2020-07-19 5:22 ` [PATCH rdma-next v2 1/2] RDMA/core: Align abort/commit object scheme for " Leon Romanovsky
2020-07-19 5:22 ` [PATCH rdma-next v2 2/2] RDMA/core: Update write interface to use automatic object lifetime Leon Romanovsky
2020-07-24 19:25 ` Jason Gunthorpe [this message]
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=20200724192535.GA3655847@nvidia.com \
--to=jgg@nvidia.com \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-rdma@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;
as well as URLs for NNTP newsgroup(s).