2018-06-04 18:01:38

by Adam Manzanares

[permalink] [raw]
Subject: [PATCH 1/2] fs: aio ioprio add explicit block layer dependence

From: Adam Manzanares <[email protected]>

Previously, the ioprio_check_cap function was only defined when CONFIG_BLOCK
was set. Make this relationship explicit and add a stub for !CONFIG_BLOCK.

Signed-off-by: Adam Manzanares <[email protected]>
---
include/linux/ioprio.h | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 4a28cec49ec3..9e30ed6443db 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -77,6 +77,13 @@ extern int ioprio_best(unsigned short aprio, unsigned short bprio);

extern int set_task_ioprio(struct task_struct *task, int ioprio);

+#ifdef CONFIG_BLOCK
extern int ioprio_check_cap(int ioprio);
+#else
+static inline int ioprio_check_cap(int ioprio)
+{
+ return -ENOTBLK;
+}
+#endif /* CONFIG_BLOCK */

#endif
--
2.17.0



2018-06-04 18:02:57

by Adam Manzanares

[permalink] [raw]
Subject: [PATCH 2/2] fs: aio ioprio use ioprio_check_cap ret val

From: Adam Manzanares <[email protected]>

Previously the value was ignored.

Signed-off-by: Adam Manzanares <[email protected]>
---
fs/aio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 9527ededa669..134e5b635d64 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1443,8 +1443,8 @@ static int aio_prep_rw(struct kiocb *req, struct iocb *iocb)
*/
ret = ioprio_check_cap(iocb->aio_reqprio);
if (ret) {
- pr_debug("aio ioprio check cap error\n");
- return -EINVAL;
+ pr_debug("aio ioprio check cap error: %d\n", ret);
+ return ret;
}

req->ki_ioprio = iocb->aio_reqprio;
--
2.17.0