|
@@ -143,6 +143,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
|
|
|
/* File was opened by fanotify and shouldn't generate fanotify events */
|
|
|
#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
|
|
|
|
|
|
+/* File is capable of returning -EAGAIN if AIO will block */
|
|
|
+#define FMODE_AIO_NOWAIT ((__force fmode_t)0x8000000)
|
|
|
+
|
|
|
/*
|
|
|
* Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
|
|
|
* that indicates that they should check the contents of the iovec are
|
|
@@ -269,6 +272,7 @@ struct writeback_control;
|
|
|
#define IOCB_DSYNC (1 << 4)
|
|
|
#define IOCB_SYNC (1 << 5)
|
|
|
#define IOCB_WRITE (1 << 6)
|
|
|
+#define IOCB_NOWAIT (1 << 7)
|
|
|
|
|
|
struct kiocb {
|
|
|
struct file *ki_filp;
|
|
@@ -3064,6 +3068,11 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, int flags)
|
|
|
if (unlikely(flags & ~RWF_SUPPORTED))
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
+ if (flags & RWF_NOWAIT) {
|
|
|
+ if (!(ki->ki_filp->f_mode & FMODE_AIO_NOWAIT))
|
|
|
+ return -EOPNOTSUPP;
|
|
|
+ ki->ki_flags |= IOCB_NOWAIT;
|
|
|
+ }
|
|
|
if (flags & RWF_HIPRI)
|
|
|
ki->ki_flags |= IOCB_HIPRI;
|
|
|
if (flags & RWF_DSYNC)
|