Whamcloud - gitweb
LU-9183 libcfs: handle get_user_pages() with gup_flags
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-curproc.c
index d9c06ac..7b2e46e 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -153,8 +149,13 @@ static int cfs_access_process_vm(struct task_struct *tsk,
                int bytes, rc, offset;
                void *maddr;
 
-               rc = get_user_pages(tsk, mm, addr, 1,
-                                    write, 1, &page, &vma);
+#if defined(HAVE_GET_USER_PAGES_GUP_FLAGS)
+               rc = get_user_pages(addr, 1, write ? FOLL_WRITE : 0, &page, &vma);
+#elif defined(HAVE_GET_USER_PAGES_6ARG)
+               rc = get_user_pages(addr, 1, write, 1, &page, &vma);
+#else
+               rc = get_user_pages(tsk, mm, addr, 1, write, 1, &page, &vma);
+#endif
                if (rc <= 0)
                        break;
 
@@ -173,7 +174,7 @@ static int cfs_access_process_vm(struct task_struct *tsk,
                                            buf, maddr + offset, bytes);
                }
                kunmap(page);
-               page_cache_release(page);
+               put_page(page);
                len -= bytes;
                buf += bytes;
                addr += bytes;