io_uring: simplify io_remove_personalities()
PATCH 1/1 io_uring: simplify io_remove_personalities()
The function io_remove_personalities() is very similar to io_unregister_personality(),so implement io_remove_personalities() calling io_unregister_personality().
--- fs/io_uring.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
fs/io_uring.c +11 -17
@@ -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) {
Signature · 1 line
1.9.1
Quoted 3 lines · Yejune Deng
The function
io_remove_personalities()is very similar to io_unregister_personality(),so implementio_remove_personalities()callingio_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
Quoted 62 lines
Signed-off-by Yejune Deng <[email protected]>--- fs/io_uring.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)fs/io_uring.c +11
-17@@ -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) {
Signature · 1 line
Pavel Begunkov
Quoted 11 lines · Pavel Begunkov
Quoted 3 lines · Yejune Deng
The function
io_remove_personalities()is very similar to io_unregister_personality(),so implementio_remove_personalities()callingio_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
Quoted 64 lines
Quoted 63 lines
Signed-off-by Yejune Deng <[email protected]>--- fs/io_uring.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)fs/io_uring.c +11
-17@@ -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) {
Signature · 1 line
Pavel Begunkov
Jens Axboe
maintainerQuoted 3 lines · Yejune Deng
The function
io_remove_personalities()is very similar to io_unregister_personality(),so implementio_remove_personalities()callingio_unregister_personality().
Better late than never, applied for 5.12. Thanks.
Signature · 1 line
Jens Axboe