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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 7 Apr 2019 10:49:59 +0300 From: Leon Romanovsky <leon@...nel.org> To: Doug Ledford <dledford@...hat.com>, Jason Gunthorpe <jgg@...lanox.com> Cc: Leon Romanovsky <leonro@...lanox.com>, RDMA mailing list <linux-rdma@...r.kernel.org>, Majd Dibbiny <majd@...lanox.com>, Mark Zhang <markz@...lanox.com>, Saeed Mahameed <saeedm@...lanox.com>, linux-netdev <netdev@...r.kernel.org> Subject: [PATCH rdma-next v1 03/17] RDMA/restrack: Add an API to attach a task to a resource From: Mark Zhang <markz@...lanox.com> Add rdma_restrack_attach_task() which is able to attach a task other then "current" to a resource. Signed-off-by: Mark Zhang <markz@...lanox.com> Reviewed-by: Majd Dibbiny <majd@...lanox.com> Signed-off-by: Leon Romanovsky <leonro@...lanox.com> --- drivers/infiniband/core/restrack.c | 14 ++++++++++++++ drivers/infiniband/core/restrack.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c index 95573f292aae..3714634ae296 100644 --- a/drivers/infiniband/core/restrack.c +++ b/drivers/infiniband/core/restrack.c @@ -194,6 +194,20 @@ void rdma_restrack_set_task(struct rdma_restrack_entry *res, } EXPORT_SYMBOL(rdma_restrack_set_task); +/** + * rdma_restrack_attach_task() - attach the task onto this resource + * @res: resource entry + * @task: the task to attach, the current task will be used if it is NULL. + */ +void rdma_restrack_attach_task(struct rdma_restrack_entry *res, + struct task_struct *task) +{ + if (res->task) + put_task_struct(res->task); + get_task_struct(task); + res->task = task; +} + static void rdma_restrack_add(struct rdma_restrack_entry *res) { struct ib_device *dev = res_to_dev(res); diff --git a/drivers/infiniband/core/restrack.h b/drivers/infiniband/core/restrack.h index 09a1fbdf578e..d084e5f89849 100644 --- a/drivers/infiniband/core/restrack.h +++ b/drivers/infiniband/core/restrack.h @@ -25,4 +25,6 @@ struct rdma_restrack_root { int rdma_restrack_init(struct ib_device *dev); void rdma_restrack_clean(struct ib_device *dev); +void rdma_restrack_attach_task(struct rdma_restrack_entry *res, + struct task_struct *task); #endif /* _RDMA_CORE_RESTRACK_H_ */ -- 2.20.1
Powered by blists - more mailing lists