diff -ur lin_tape-3.0.8.orig/lin_tape_scsi_tape.c lin_tape-3.0.8/lin_tape_scsi_tape.c --- lin_tape-3.0.8.orig/lin_tape_scsi_tape.c 2016-02-23 22:16:42.000000000 +0100 +++ lin_tape-3.0.8/lin_tape_scsi_tape.c 2016-06-19 13:17:29.632951394 +0200 @@ -11480,10 +11480,14 @@ memset(pages, '\0', drv->supported_sg_tablesize * sizeof(struct page*)); +#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) + mapped_pages = get_user_pages_unlocked((ulong)user_location, number_pages, rw, 0, pages); +#else down_read(¤t->mm->mmap_sem); mapped_pages = get_user_pages(current, current->mm, (ulong)user_location, number_pages, rw, 0, pages, NULL); up_read(¤t->mm->mmap_sem); +#endif if(mapped_pages < number_pages) { rc = -EFAULT; @@ -11532,7 +11536,11 @@ EXIT_LABEL: if(rc < STATUS_SUCCESS) +#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) + for(i = 0; i < mapped_pages; i++) put_page(pages[i]); +#else for(i = 0; i < mapped_pages; i++) page_cache_release(pages[i]); +#endif if(pages_allocd) kfree(pages); return rc; } /* lin_tape_get_user_pages() */ @@ -11567,7 +11575,11 @@ &drv->sg_list->gather[i]))) { SetPageDirty(sg_page(&drv->sg_list->gather[i])); } /* if */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) + put_page(sg_page(&drv->sg_list->gather[i])); +#else page_cache_release(sg_page(&drv->sg_list->gather[i])); +#endif } /* if */ } /* for */ diff -ur lin_tape-3.0.8.orig/stmp.c lin_tape-3.0.8/stmp.c --- lin_tape-3.0.8.orig/stmp.c 2016-06-19 13:17:14.000000000 +0200 +++ lin_tape-3.0.8/stmp.c 2016-06-19 13:17:29.632951394 +0200 @@ -5329,7 +5329,14 @@ if ((pages = kmalloc(max_pages * sizeof(*pages), GFP_KERNEL)) == NULL) return -ENOMEM; - +#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) + res = get_user_pages_unlocked( + uaddr, + nr_pages, + rw == READ, + 0, /* don't force */ + pages); +#else /* Try to fault in all of the necessary pages */ down_read(¤t->mm->mmap_sem); /* rw==READ means read from drive, write into memory area */ @@ -5343,6 +5350,7 @@ pages, NULL); up_read(¤t->mm->mmap_sem); +#endif /* Errors and no page mapped should return here */ if (res < nr_pages) @@ -5362,7 +5370,11 @@ out_unmap: if (res > 0) { for (j=0; j < res; j++) +#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) + put_page(pages[j]); +#else page_cache_release(pages[j]); +#endif res = 0; } kfree(pages); @@ -5384,7 +5396,11 @@ /* FIXME: cache flush missing for rw==READ * FIXME: call the correct reference counting function */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0) + put_page(page); +#else page_cache_release(page); +#endif } kfree(STbp->mapped_pages); STbp->mapped_pages = NULL; Only in lin_tape-3.0.8: stmp.c.orig