diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 65671bace..4874c7c62 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1371,7 +1371,7 @@ retry: set_fs(KERNEL_DS); res = vfs_writev(file, (struct iovec __force __user *)iop, - count, &off); + count, &off, 0); set_fs(oldfs); TRACE_WRITE("sid %#Lx, cid %u, res %d, iov_len %zd", (unsigned long long int)conn->session->sid, diff --git a/scst/include/backport.h b/scst/include/backport.h index d12657087..d791e555d 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -212,6 +212,25 @@ static inline struct inode *file_inode(const struct file *f) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) +static inline ssize_t vfs_readv_backport(struct file *file, + const struct iovec __user *vec, + unsigned long vlen, loff_t *pos, + int flags) +{ + return vfs_readv(file, vec, vlen, pos); +} +static inline ssize_t vfs_writev_backport(struct file *file, + const struct iovec __user *vec, + unsigned long vlen, loff_t *pos, + int flags) +{ + return vfs_writev(file, vec, vlen, pos); +} +#define vfs_readv vfs_readv_backport +#define vfs_writev vfs_writev_backport +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) static inline int vfs_fsync_backport(struct file *file, int datasync) { @@ -325,6 +344,21 @@ static inline bool list_entry_in_list(const struct list_head *entry) #define lockdep_assert_held(l) do { (void)(l); } while (0) #endif +/* */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) +static inline long get_user_pages_backport(unsigned long start, + unsigned long nr_pages, + int write, int force, + struct page **pages, + struct vm_area_struct **vmas) +{ + return get_user_pages(current, current->mm, start, nr_pages, write, + force, pages, vmas); +} +#define get_user_pages get_user_pages_backport +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 1615572bf..20dd9da8d 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -1267,8 +1267,8 @@ static int dev_user_map_buf(struct scst_user_cmd *ucmd, unsigned long ubuff, (ucmd->cmd != NULL) ? ucmd->cmd->bufflen : -1); down_read(&tsk->mm->mmap_sem); - rc = get_user_pages(tsk, tsk->mm, ubuff, ucmd->num_data_pages, - 1/*writable*/, 0/*don't force*/, ucmd->data_pages, NULL); + rc = get_user_pages(ubuff, ucmd->num_data_pages, 1/*writable*/, + 0/*don't force*/, ucmd->data_pages, NULL); up_read(&tsk->mm->mmap_sem); /* get_user_pages() flushes dcache */ diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index a420fdce5..559d79781 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2023,8 +2023,8 @@ static int vdisk_format_dif(struct scst_cmd *cmd, uint64_t start_lba, full_len, (long long)loff); /* WRITE */ - err = vfs_writev(fd, (struct iovec __force __user *)iv, iv_count, - &loff); + err = vfs_writev(fd, (struct iovec __force __user *)iv, + iv_count, &loff, 0); if (err < 0) { PRINT_ERROR("Formatting DIF write() returned %lld from " "%zd", (long long)err, full_len); @@ -5860,7 +5860,7 @@ static int vdev_read_dif_tags(struct vdisk_cmd_params *p) /* READ */ err = vfs_readv(fd, (struct iovec __force __user *)iv, iv_count, - &loff); + &loff, 0); if ((err < 0) || (err < full_len)) { unsigned long flags; @@ -5994,8 +5994,8 @@ restart: TRACE_DBG("Writing DIF: eiv_count %d, full_len %zd", eiv_count, full_len); /* WRITE */ - err = vfs_writev(fd, (struct iovec __force __user *)eiv, eiv_count, - &loff); + err = vfs_writev(fd, (struct iovec __force __user *)eiv, + eiv_count, &loff, 0); if (err < 0) { unsigned long flags; @@ -6141,7 +6141,7 @@ static enum compl_status_e fileio_exec_read(struct vdisk_cmd_params *p) /* READ */ err = vfs_readv(fd, (struct iovec __force __user *)iv, iv_count, - &loff); + &loff, 0); if ((err < 0) || (err < full_len)) { PRINT_ERROR("readv() returned %lld from %zd", (unsigned long long int)err, @@ -6334,8 +6334,8 @@ restart: TRACE_DBG("Writing: eiv_count %d, full_len %zd", eiv_count, full_len); /* WRITE */ - err = vfs_writev(fd, (struct iovec __force __user *)eiv, eiv_count, - &loff); + err = vfs_writev(fd, (struct iovec __force __user *)eiv, + eiv_count, &loff, 0); if (err < 0) { PRINT_ERROR("write() returned %lld from %zd", (unsigned long long int)err,