public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] switch io_msg_ring() to CLASS(fd)
@ 2024-11-15  3:49 Al Viro
  2024-11-15 15:43 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2024-11-15  3:49 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, linux-fsdevel

	Trivial conversion, on top of for-6.13/io_uring.
No point backmerging and doing that in #work.fd, seeing that
it's independent from anything in there...

Signed-off-by: Al Viro <[email protected]>
---
diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c
index e63af34004b7..333c220d322a 100644
--- a/io_uring/msg_ring.c
+++ b/io_uring/msg_ring.c
@@ -333,7 +333,6 @@ int io_msg_ring(struct io_kiocb *req, unsigned int issue_flags)
 int io_uring_sync_msg_ring(struct io_uring_sqe *sqe)
 {
 	struct io_msg io_msg = { };
-	struct fd f;
 	int ret;
 
 	ret = __io_msg_ring_prep(&io_msg, sqe);
@@ -347,16 +346,13 @@ int io_uring_sync_msg_ring(struct io_uring_sqe *sqe)
 	if (io_msg.cmd != IORING_MSG_DATA)
 		return -EINVAL;
 
-	ret = -EBADF;
-	f = fdget(sqe->fd);
-	if (fd_file(f)) {
-		ret = -EBADFD;
-		if (io_is_uring_fops(fd_file(f)))
-			ret = __io_msg_ring_data(fd_file(f)->private_data,
-						 &io_msg, IO_URING_F_UNLOCKED);
-		fdput(f);
-	}
-	return ret;
+	CLASS(fd, f)(sqe->fd);
+	if (fd_empty(f))
+		return -EBADF;
+	if (!io_is_uring_fops(fd_file(f)))
+		return -EBADFD;
+	return  __io_msg_ring_data(fd_file(f)->private_data,
+				   &io_msg, IO_URING_F_UNLOCKED);
 }
 
 void io_msg_cache_free(const void *entry)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] switch io_msg_ring() to CLASS(fd)
  2024-11-15  3:49 [PATCH] switch io_msg_ring() to CLASS(fd) Al Viro
@ 2024-11-15 15:43 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2024-11-15 15:43 UTC (permalink / raw)
  To: io-uring, Al Viro; +Cc: linux-fsdevel


On Fri, 15 Nov 2024 03:49:02 +0000, Al Viro wrote:
> 	Trivial conversion, on top of for-6.13/io_uring.
> No point backmerging and doing that in #work.fd, seeing that
> it's independent from anything in there...
> 
> 

Applied, thanks!

[1/1] switch io_msg_ring() to CLASS(fd)
      commit: ffd58b00769a9cfee6a110231eb7d1fa70fe64b9

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-15 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15  3:49 [PATCH] switch io_msg_ring() to CLASS(fd) Al Viro
2024-11-15 15:43 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox