Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-10698 obdclass: allow specifying complex jobids
[fs/lustre-release.git]
/
libcfs
/
libcfs
/
linux
/
linux-curproc.c
diff --git
a/libcfs/libcfs/linux/linux-curproc.c
b/libcfs/libcfs/linux/linux-curproc.c
index
b846627
..
fee47a2
100644
(file)
--- a/
libcfs/libcfs/linux/linux-curproc.c
+++ b/
libcfs/libcfs/linux/linux-curproc.c
@@
-23,7
+23,7
@@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 201
5
, Intel Corporation.
+ * Copyright (c) 2012, 201
7
, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-37,8
+37,12
@@
*/
#include <linux/sched.h>
*/
#include <linux/sched.h>
+#ifdef HAVE_SCHED_HEADERS
+#include <linux/sched/signal.h>
+#include <linux/sched/mm.h>
+#endif
#include <linux/fs_struct.h>
#include <linux/fs_struct.h>
-
+#include <linux/pagemap.h>
#include <linux/compat.h>
#include <linux/thread_info.h>
#include <linux/compat.h>
#include <linux/thread_info.h>
@@
-149,7
+153,9
@@
static int cfs_access_process_vm(struct task_struct *tsk,
int bytes, rc, offset;
void *maddr;
int bytes, rc, offset;
void *maddr;
-#ifdef HAVE_GET_USER_PAGES_6ARG
+#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);
rc = get_user_pages(addr, 1, write, 1, &page, &vma);
#else
rc = get_user_pages(tsk, mm, addr, 1, write, 1, &page, &vma);
@@
-256,9
+262,14
@@
int cfs_get_environ(const char *key, char *value, int *val_len)
!memcmp(entry, key, key_len)) {
entry += key_len + 1;
entry_len -= key_len + 1;
!memcmp(entry, key, key_len)) {
entry += key_len + 1;
entry_len -= key_len + 1;
- /* The 'value' buffer passed in is too small.*/
- if (entry_len >= *val_len)
+
+ /* The 'value' buffer passed in is too small.
+ * Copy what fits, but return -EOVERFLOW. */
+ if (entry_len >= *val_len) {
+ memcpy(value, entry, *val_len);
+ value[*val_len - 1] = 0;
GOTO(out, rc = -EOVERFLOW);
GOTO(out, rc = -EOVERFLOW);
+ }
memcpy(value, entry, entry_len);
*val_len = entry_len;
memcpy(value, entry, entry_len);
*val_len = entry_len;