From: Pavel Begunkov Date: Mon, 31 Mar 2025 07:54:00 +0000 (+0100) Subject: io_uring: add req flag invariant build assertion X-Git-Tag: v6.15-rc1~29^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=697b2876ac037545ba2761e2ffe9a5c2af6424e6;p=thirdparty%2Fkernel%2Flinux.git io_uring: add req flag invariant build assertion We're caching some of file related request flags in a tricky way, put a build check to make sure flags don't get reshuffled. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/9877577b83c25dd78224a8274f799187e7ec7639.1743407551.git.asml.silence@gmail.com Signed-off-by: Jens Axboe --- diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index e4484a03e033e..a4065e3d13d06 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1643,6 +1643,8 @@ io_req_flags_t io_file_get_flags(struct file *file) { io_req_flags_t res = 0; + BUILD_BUG_ON(REQ_F_ISREG_BIT != REQ_F_SUPPORT_NOWAIT_BIT + 1); + if (S_ISREG(file_inode(file)->i_mode)) res |= REQ_F_ISREG; if ((file->f_flags & O_NONBLOCK) || (file->f_mode & FMODE_NOWAIT))