* [PATCH] io_uring: simplify io_remove_personalities()
@ 2020-12-24 3:02 Yejune Deng
2021-01-02 19:25 ` Pavel Begunkov
2021-01-20 3:10 ` Jens Axboe
0 siblings, 2 replies; 4+ messages in thread
From: Yejune Deng @ 2020-12-24 3:02 UTC (permalink / raw)
To: viro, axboe; +Cc: linux-fsdevel, io-uring, linux-kernel, yejune.deng
The function io_remove_personalities() is very similar to
io_unregister_personality(),so implement io_remove_personalities()
calling io_unregister_personality().
Signed-off-by: Yejune Deng <[email protected]>
---
fs/io_uring.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index b749578..dc913fa 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8608,9 +8608,8 @@ static int io_uring_fasync(int fd, struct file *file, int on)
return fasync_helper(fd, file, on, &ctx->cq_fasync);
}
-static int io_remove_personalities(int id, void *p, void *data)
+static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id)
{
- struct io_ring_ctx *ctx = data;
struct io_identity *iod;
iod = idr_remove(&ctx->personality_idr, id);
@@ -8618,7 +8617,17 @@ static int io_remove_personalities(int id, void *p, void *data)
put_cred(iod->creds);
if (refcount_dec_and_test(&iod->count))
kfree(iod);
+ return 0;
}
+
+ return -EINVAL;
+}
+
+static int io_remove_personalities(int id, void *p, void *data)
+{
+ struct io_ring_ctx *ctx = data;
+
+ io_unregister_personality(ctx, id);
return 0;
}
@@ -9679,21 +9688,6 @@ static int io_register_personality(struct io_ring_ctx *ctx)
return ret;
}
-static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id)
-{
- struct io_identity *iod;
-
- iod = idr_remove(&ctx->personality_idr, id);
- if (iod) {
- put_cred(iod->creds);
- if (refcount_dec_and_test(&iod->count))
- kfree(iod);
- return 0;
- }
-
- return -EINVAL;
-}
-
static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg,
unsigned int nr_args)
{
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: simplify io_remove_personalities()
2020-12-24 3:02 [PATCH] io_uring: simplify io_remove_personalities() Yejune Deng
@ 2021-01-02 19:25 ` Pavel Begunkov
2021-01-20 2:26 ` Pavel Begunkov
2021-01-20 3:10 ` Jens Axboe
1 sibling, 1 reply; 4+ messages in thread
From: Pavel Begunkov @ 2021-01-02 19:25 UTC (permalink / raw)
To: Yejune Deng, viro, axboe; +Cc: linux-fsdevel, io-uring, linux-kernel
On 24/12/2020 03:02, Yejune Deng wrote:
> The function io_remove_personalities() is very similar to
> io_unregister_personality(),so implement io_remove_personalities()
> calling io_unregister_personality().
Please, don't forget to specify a version in the subject, e.g.
[PATCH v2], add a changelog after "---" and add tags from previous
threads if any.
Looks good
Reviewed-by: Pavel Begunkov <[email protected]>
>
> Signed-off-by: Yejune Deng <[email protected]>
> ---
> fs/io_uring.c | 28 +++++++++++-----------------
> 1 file changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index b749578..dc913fa 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -8608,9 +8608,8 @@ static int io_uring_fasync(int fd, struct file *file, int on)
> return fasync_helper(fd, file, on, &ctx->cq_fasync);
> }
>
> -static int io_remove_personalities(int id, void *p, void *data)
> +static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id)
> {
> - struct io_ring_ctx *ctx = data;
> struct io_identity *iod;
>
> iod = idr_remove(&ctx->personality_idr, id);
> @@ -8618,7 +8617,17 @@ static int io_remove_personalities(int id, void *p, void *data)
> put_cred(iod->creds);
> if (refcount_dec_and_test(&iod->count))
> kfree(iod);
> + return 0;
> }
> +
> + return -EINVAL;
> +}
> +
> +static int io_remove_personalities(int id, void *p, void *data)
> +{
> + struct io_ring_ctx *ctx = data;
> +
> + io_unregister_personality(ctx, id);
> return 0;
> }
>
> @@ -9679,21 +9688,6 @@ static int io_register_personality(struct io_ring_ctx *ctx)
> return ret;
> }
>
> -static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id)
> -{
> - struct io_identity *iod;
> -
> - iod = idr_remove(&ctx->personality_idr, id);
> - if (iod) {
> - put_cred(iod->creds);
> - if (refcount_dec_and_test(&iod->count))
> - kfree(iod);
> - return 0;
> - }
> -
> - return -EINVAL;
> -}
> -
> static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg,
> unsigned int nr_args)
> {
>
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: simplify io_remove_personalities()
2021-01-02 19:25 ` Pavel Begunkov
@ 2021-01-20 2:26 ` Pavel Begunkov
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-01-20 2:26 UTC (permalink / raw)
To: Yejune Deng, viro, axboe; +Cc: linux-fsdevel, io-uring, linux-kernel
On 02/01/2021 19:25, Pavel Begunkov wrote:
> On 24/12/2020 03:02, Yejune Deng wrote:
>> The function io_remove_personalities() is very similar to
>> io_unregister_personality(),so implement io_remove_personalities()
>> calling io_unregister_personality().
>
> Please, don't forget to specify a version in the subject, e.g.
> [PATCH v2], add a changelog after "---" and add tags from previous
> threads if any.
>
> Looks good
> Reviewed-by: Pavel Begunkov <[email protected]>
up
>
>>
>> Signed-off-by: Yejune Deng <[email protected]>
>> ---
>> fs/io_uring.c | 28 +++++++++++-----------------
>> 1 file changed, 11 insertions(+), 17 deletions(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index b749578..dc913fa 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -8608,9 +8608,8 @@ static int io_uring_fasync(int fd, struct file *file, int on)
>> return fasync_helper(fd, file, on, &ctx->cq_fasync);
>> }
>>
>> -static int io_remove_personalities(int id, void *p, void *data)
>> +static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id)
>> {
>> - struct io_ring_ctx *ctx = data;
>> struct io_identity *iod;
>>
>> iod = idr_remove(&ctx->personality_idr, id);
>> @@ -8618,7 +8617,17 @@ static int io_remove_personalities(int id, void *p, void *data)
>> put_cred(iod->creds);
>> if (refcount_dec_and_test(&iod->count))
>> kfree(iod);
>> + return 0;
>> }
>> +
>> + return -EINVAL;
>> +}
>> +
>> +static int io_remove_personalities(int id, void *p, void *data)
>> +{
>> + struct io_ring_ctx *ctx = data;
>> +
>> + io_unregister_personality(ctx, id);
>> return 0;
>> }
>>
>> @@ -9679,21 +9688,6 @@ static int io_register_personality(struct io_ring_ctx *ctx)
>> return ret;
>> }
>>
>> -static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id)
>> -{
>> - struct io_identity *iod;
>> -
>> - iod = idr_remove(&ctx->personality_idr, id);
>> - if (iod) {
>> - put_cred(iod->creds);
>> - if (refcount_dec_and_test(&iod->count))
>> - kfree(iod);
>> - return 0;
>> - }
>> -
>> - return -EINVAL;
>> -}
>> -
>> static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg,
>> unsigned int nr_args)
>> {
>>
>
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: simplify io_remove_personalities()
2020-12-24 3:02 [PATCH] io_uring: simplify io_remove_personalities() Yejune Deng
2021-01-02 19:25 ` Pavel Begunkov
@ 2021-01-20 3:10 ` Jens Axboe
1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-01-20 3:10 UTC (permalink / raw)
To: Yejune Deng, viro; +Cc: linux-fsdevel, io-uring, linux-kernel
On 12/23/20 8:02 PM, Yejune Deng wrote:
> The function io_remove_personalities() is very similar to
> io_unregister_personality(),so implement io_remove_personalities()
> calling io_unregister_personality().
Better late than never, applied for 5.12. Thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-20 3:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-24 3:02 [PATCH] io_uring: simplify io_remove_personalities() Yejune Deng
2021-01-02 19:25 ` Pavel Begunkov
2021-01-20 2:26 ` Pavel Begunkov
2021-01-20 3:10 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox