@@ -290,6 +290,24 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int whence)
}
EXPORT_SYMBOL(vfs_llseek);
+loff_t vfs_lseek_nowait(struct file *file, off_t offset,
+ int whence, bool nowait)
+{
+ if (!(file->f_mode & FMODE_LSEEK))
+ return -ESPIPE;
+ /*
+ * This function is only used by io_uring, thus
+ * returning -ENOTSUPP is not proper since doing
+ * nonblock lseek as the first try is asked internally
+ * by io_uring not by users. Return -ENOTSUPP to users
+ * is not sane.
+ */
+ if (!file->f_op->llseek_nowait)
+ return -EAGAIN;
+ return file->f_op->llseek_nowait(file, offset, whence, nowait);
+}
+EXPORT_SYMBOL(vfs_lseek_nowait);
+
static off_t ksys_lseek(unsigned int fd, off_t offset, unsigned int whence)
{
off_t retval;
@@ -2654,6 +2654,9 @@ extern loff_t default_llseek(struct file *file, loff_t offset, int whence);
extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
+extern loff_t vfs_lseek_nowait(struct file *file, off_t offset,
+ int whence, bool nowait);
+
extern int inode_init_always(struct super_block *, struct inode *);
extern void inode_init_once(struct inode *);
extern void address_space_init_once(struct address_space *mapping);