[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200508153634.249933-6-hch@lst.de>
Date: Fri, 8 May 2020 17:36:27 +0200
From: Christoph Hellwig <hch@....de>
To: Alexander Viro <viro@...iv.linux.org.uk>
Cc: linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-rdma@...r.kernel.org, kvm@...r.kernel.org,
linux-fsdevel@...r.kernel.org, io-uring@...r.kernel.org,
netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: [PATCH 05/12] io_uring: use __anon_inode_getfd
Use __anon_inode_getfd instead of opencoding the logic using
get_unused_fd_flags + anon_inode_getfile.
Signed-off-by: Christoph Hellwig <hch@....de>
---
fs/io_uring.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 5190bfb6a6657..4104f8a45d11e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7709,18 +7709,11 @@ static int io_uring_get_fd(struct io_ring_ctx *ctx)
return ret;
#endif
- ret = get_unused_fd_flags(O_RDWR | O_CLOEXEC);
+ ret = __anon_inode_getfd("[io_uring]", &io_uring_fops, ctx,
+ O_RDWR | O_CLOEXEC, &file);
if (ret < 0)
goto err;
- file = anon_inode_getfile("[io_uring]", &io_uring_fops, ctx,
- O_RDWR | O_CLOEXEC);
- if (IS_ERR(file)) {
- put_unused_fd(ret);
- ret = PTR_ERR(file);
- goto err;
- }
-
#if defined(CONFIG_UNIX)
ctx->ring_sock->file = file;
#endif
--
2.26.2
Powered by blists - more mailing lists