[PATCH v2 01/29] staging/lustre/llite: allocate and free client cache asynchronously

2016-06-20 Thread Oleg Drokin
From: Emoly Liu 

Since the inflight request holds import refcount as well as export,
sometimes obd_disconnect() in client_common_put_super() can't put
the last refcount of OSC import (e.g. due to network disconnection),
this will cause cl_cache being accessed after free.

To fix this issue, ccc_users is used as cl_cache refcount, and
lov/llite/osc all hold one cl_cache refcount respectively, to avoid
the race that a new OST is being added into the system when the client
is mounted.
The following cl_cache functions are added:
- cl_cache_init(): allocate and initialize cl_cache
- cl_cache_incref(): increase cl_cache refcount
- cl_cache_decref(): decrease cl_cache refcount and free the cache
  if refcount=0.

Signed-off-by: Emoly Liu 
Reviewed-on: http://review.whamcloud.com/13746
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6173
Reviewed-by: Niu Yawei 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/cl_object.h  | 10 -
 drivers/staging/lustre/lustre/include/obd.h|  2 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c| 35 +++-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |  6 +--
 drivers/staging/lustre/lustre/lov/lov_obd.c|  7 
 drivers/staging/lustre/lustre/obdclass/cl_page.c   | 46 ++
 drivers/staging/lustre/lustre/osc/osc_page.c   |  4 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|  4 +-
 9 files changed, 86 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index 36ca935..3cd4a25 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -2322,7 +2322,8 @@ void cl_lock_descr_print(const struct lu_env *env, void 
*cookie,
  */
 struct cl_client_cache {
/**
-* # of users (OSCs)
+* # of client cache refcount
+* # of users (OSCs) + 2 (held by llite and lov)
 */
atomic_tccc_users;
/**
@@ -2357,6 +2358,13 @@ struct cl_client_cache {
 
 };
 
+/**
+ * cl_cache functions
+ */
+struct cl_client_cache *cl_cache_init(unsigned long lru_page_max);
+void cl_cache_incref(struct cl_client_cache *cache);
+void cl_cache_decref(struct cl_client_cache *cache);
+
 /** @} cl_page */
 
 /** \defgroup cl_lock cl_lock
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index e654d42..ed1081a 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -415,7 +415,7 @@ struct lov_obd {
enum lustre_sec_partlov_sp_me;
 
/* Cached LRU and unstable data from upper layer */
-   void   *lov_cache;
+   struct cl_client_cache *lov_cache;
 
struct rw_semaphore lov_notify_lock;
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 7c1a3254..74cd241 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -493,7 +493,7 @@ struct ll_sb_info {
 * any page which is sent to a server as part of a bulk request,
 * but is uncommitted to stable storage.
 */
-   struct cl_client_cachell_cache;
+   struct cl_client_cache*ll_cache;
 
struct lprocfs_stats *ll_ra_stats;
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index ac833db..83f4e1a 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -83,15 +83,11 @@ static struct ll_sb_info *ll_init_sbi(struct super_block 
*sb)
pages = si.totalram - si.totalhigh;
lru_page_max = pages / 2;
 
-   /* initialize ll_cache data */
-   atomic_set(>ll_cache.ccc_users, 0);
-   sbi->ll_cache.ccc_lru_max = lru_page_max;
-   atomic_set(>ll_cache.ccc_lru_left, lru_page_max);
-   spin_lock_init(>ll_cache.ccc_lru_lock);
-   INIT_LIST_HEAD(>ll_cache.ccc_lru);
-
-   atomic_set(>ll_cache.ccc_unstable_nr, 0);
-   init_waitqueue_head(>ll_cache.ccc_unstable_waitq);
+   sbi->ll_cache = cl_cache_init(lru_page_max);
+   if (!sbi->ll_cache) {
+   kfree(sbi);
+   return NULL;
+   }
 
sbi->ll_ra_info.ra_max_pages_per_file = min(pages / 32,
   SBI_DEFAULT_READAHEAD_MAX);
@@ -131,6 +127,11 @@ static void ll_free_sbi(struct super_block *sb)
 {
struct ll_sb_info *sbi = ll_s2sbi(sb);
 
+   if (sbi->ll_cache) {
+   cl_cache_decref(sbi->ll_cache);
+   sbi->ll_cache = NULL;
+   }
+
kfree(sbi);
 }
 
@@ -514,8 +515,8 @@ static int client_common_fill_super(struct super_block *sb, 
char *md, char 

Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr

2016-06-20 Thread Andi Kleen
Borislav Petkov  writes:

> Comments are, as always, appreciated.

Seems like a waste of kernel code to me. The MSR interface works
perfectly fine. There are potentially hundreds of useful MSRs,
are you going to add new sysfs for each of them?

Even the more obscure ones can be very useful for debugging
and monitoring.

Most MSRs are model specific so this would end up with tons
of switch (x86_model) ... which are always difficult to maintain
and need to be updated all the time when new CPUs come out.

This will likely generate a really large ongoing number of patches,
and to solve what problem exactly?

The whole thing doesn't make any sense to me.

It's just a waste of code, maintainer time, patch review
capacity, which all could be far more usefully employed
to do something that actually solves real problems.

-Andi

-- 
a...@linux.intel.com -- Speaking for myself only


[PATCH v2 18/29] staging/lustre/ldlm: const qualify struct lustre_handle * params

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

Add a const qualifier to several struct lustre_handle * parameters in
the LDLM interface.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17071
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_dlm.h | 18 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 14 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|  2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |  4 ++--
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h 
b/drivers/staging/lustre/lustre/include/lustre_dlm.h
index 63085a0..60051a5 100644
--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h
@@ -1073,7 +1073,7 @@ void ldlm_lock2handle(const struct ldlm_lock *lock,
 struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, __u64 
flags);
 void ldlm_cancel_callback(struct ldlm_lock *);
 int ldlm_lock_remove_from_lru(struct ldlm_lock *);
-int ldlm_lock_set_data(struct lustre_handle *, void *);
+int ldlm_lock_set_data(const struct lustre_handle *lockh, void *data);
 
 /**
  * Obtain a lock reference by its handle.
@@ -1162,10 +1162,10 @@ do {\
 struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);
 void ldlm_lock_put(struct ldlm_lock *lock);
 void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc);
-void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode);
-int  ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode);
-void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode);
-void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode);
+void ldlm_lock_addref(const struct lustre_handle *lockh, __u32 mode);
+int  ldlm_lock_addref_try(const struct lustre_handle *lockh, __u32 mode);
+void ldlm_lock_decref(const struct lustre_handle *lockh, __u32 mode);
+void ldlm_lock_decref_and_cancel(const struct lustre_handle *lockh, __u32 
mode);
 void ldlm_lock_fail_match_locked(struct ldlm_lock *lock);
 void ldlm_lock_allow_match(struct ldlm_lock *lock);
 void ldlm_lock_allow_match_locked(struct ldlm_lock *lock);
@@ -1174,10 +1174,10 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace 
*ns, __u64 flags,
   enum ldlm_type type, ldlm_policy_data_t *,
   enum ldlm_mode mode, struct lustre_handle *,
   int unref);
-enum ldlm_mode ldlm_revalidate_lock_handle(struct lustre_handle *lockh,
+enum ldlm_mode ldlm_revalidate_lock_handle(const struct lustre_handle *lockh,
   __u64 *bits);
 void ldlm_lock_cancel(struct ldlm_lock *lock);
-void ldlm_lock_dump_handle(int level, struct lustre_handle *);
+void ldlm_lock_dump_handle(int level, const struct lustre_handle *);
 void ldlm_unlink_lock_skiplist(struct ldlm_lock *req);
 
 /* resource.c */
@@ -1251,9 +1251,9 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct 
ptlrpc_request *req,
  enum ldlm_type type, __u8 with_policy,
  enum ldlm_mode mode,
  __u64 *flags, void *lvb, __u32 lvb_len,
- struct lustre_handle *lockh, int rc);
+ const struct lustre_handle *lockh, int rc);
 int ldlm_cli_update_pool(struct ptlrpc_request *req);
-int ldlm_cli_cancel(struct lustre_handle *lockh,
+int ldlm_cli_cancel(const struct lustre_handle *lockh,
enum ldlm_cancel_flags cancel_flags);
 int ldlm_cli_cancel_unused(struct ldlm_namespace *, const struct ldlm_res_id *,
   enum ldlm_cancel_flags flags, void *opaque);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index b7254eb..a5993f7 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -658,7 +658,7 @@ static void ldlm_add_ast_work_item(struct ldlm_lock *lock,
  * r/w reference type is determined by \a mode
  * Calls ldlm_lock_addref_internal.
  */
-void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode)
+void ldlm_lock_addref(const struct lustre_handle *lockh, __u32 mode)
 {
struct ldlm_lock *lock;
 
@@ -700,7 +700,7 @@ void ldlm_lock_addref_internal_nolock(struct ldlm_lock 
*lock, __u32 mode)
  *
  * \retval -EAGAIN lock is being canceled.
  */
-int ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode)
+int ldlm_lock_addref_try(const struct lustre_handle *lockh, __u32 mode)
 {
struct ldlm_lock *lock;
intresult;
@@ -832,7 +832,7 @@ void 

[PATCH v2 18/29] staging/lustre/ldlm: const qualify struct lustre_handle * params

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

Add a const qualifier to several struct lustre_handle * parameters in
the LDLM interface.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17071
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_dlm.h | 18 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 14 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|  2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |  4 ++--
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h 
b/drivers/staging/lustre/lustre/include/lustre_dlm.h
index 63085a0..60051a5 100644
--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h
@@ -1073,7 +1073,7 @@ void ldlm_lock2handle(const struct ldlm_lock *lock,
 struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, __u64 
flags);
 void ldlm_cancel_callback(struct ldlm_lock *);
 int ldlm_lock_remove_from_lru(struct ldlm_lock *);
-int ldlm_lock_set_data(struct lustre_handle *, void *);
+int ldlm_lock_set_data(const struct lustre_handle *lockh, void *data);
 
 /**
  * Obtain a lock reference by its handle.
@@ -1162,10 +1162,10 @@ do {\
 struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);
 void ldlm_lock_put(struct ldlm_lock *lock);
 void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc);
-void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode);
-int  ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode);
-void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode);
-void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode);
+void ldlm_lock_addref(const struct lustre_handle *lockh, __u32 mode);
+int  ldlm_lock_addref_try(const struct lustre_handle *lockh, __u32 mode);
+void ldlm_lock_decref(const struct lustre_handle *lockh, __u32 mode);
+void ldlm_lock_decref_and_cancel(const struct lustre_handle *lockh, __u32 
mode);
 void ldlm_lock_fail_match_locked(struct ldlm_lock *lock);
 void ldlm_lock_allow_match(struct ldlm_lock *lock);
 void ldlm_lock_allow_match_locked(struct ldlm_lock *lock);
@@ -1174,10 +1174,10 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace 
*ns, __u64 flags,
   enum ldlm_type type, ldlm_policy_data_t *,
   enum ldlm_mode mode, struct lustre_handle *,
   int unref);
-enum ldlm_mode ldlm_revalidate_lock_handle(struct lustre_handle *lockh,
+enum ldlm_mode ldlm_revalidate_lock_handle(const struct lustre_handle *lockh,
   __u64 *bits);
 void ldlm_lock_cancel(struct ldlm_lock *lock);
-void ldlm_lock_dump_handle(int level, struct lustre_handle *);
+void ldlm_lock_dump_handle(int level, const struct lustre_handle *);
 void ldlm_unlink_lock_skiplist(struct ldlm_lock *req);
 
 /* resource.c */
@@ -1251,9 +1251,9 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct 
ptlrpc_request *req,
  enum ldlm_type type, __u8 with_policy,
  enum ldlm_mode mode,
  __u64 *flags, void *lvb, __u32 lvb_len,
- struct lustre_handle *lockh, int rc);
+ const struct lustre_handle *lockh, int rc);
 int ldlm_cli_update_pool(struct ptlrpc_request *req);
-int ldlm_cli_cancel(struct lustre_handle *lockh,
+int ldlm_cli_cancel(const struct lustre_handle *lockh,
enum ldlm_cancel_flags cancel_flags);
 int ldlm_cli_cancel_unused(struct ldlm_namespace *, const struct ldlm_res_id *,
   enum ldlm_cancel_flags flags, void *opaque);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index b7254eb..a5993f7 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -658,7 +658,7 @@ static void ldlm_add_ast_work_item(struct ldlm_lock *lock,
  * r/w reference type is determined by \a mode
  * Calls ldlm_lock_addref_internal.
  */
-void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode)
+void ldlm_lock_addref(const struct lustre_handle *lockh, __u32 mode)
 {
struct ldlm_lock *lock;
 
@@ -700,7 +700,7 @@ void ldlm_lock_addref_internal_nolock(struct ldlm_lock 
*lock, __u32 mode)
  *
  * \retval -EAGAIN lock is being canceled.
  */
-int ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode)
+int ldlm_lock_addref_try(const struct lustre_handle *lockh, __u32 mode)
 {
struct ldlm_lock *lock;
intresult;
@@ -832,7 +832,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, 
__u32 mode)
 /**
  * Decrease reader/writer refcount for LDLM lock with handle \a 

[PATCH v2 08/29] staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set

2016-06-20 Thread Oleg Drokin
From: Liang Zhen 

This patch changes a few things:

- There is no guarantee that request_out_callback will happen
  before reply_in_callback, if a request got reply and unlinked
  reply buffer before request_out_callback is called, then the
  thread waiting on ptlrpc_request_set will miss wakeup event.

  This may seriously impact performance of some IO workloads or
  result in RPC timeout

- To make code more easier to understand, this patch changes
  action-bits "rq_req_unlink" and "rq_reply_unlink" to
  status-bits "rq_req_unlinked" and "rq_reply_unlinked"

Signed-off-by: Liang Zhen 
Reviewed-on: http://review.whamcloud.com/12158
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5696
Reviewed-by: Johann Lombardi 
Reviewed-by: Li Wei 
Reviewed-by: Mike Pershin 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h | 27 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 12 --
 drivers/staging/lustre/lustre/ptlrpc/events.c  | 22 +++---
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  | 14 +--
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |  9 
 5 files changed, 51 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 5968c3c..523d082 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -1428,7 +1428,7 @@ struct ptlrpc_request {
 * rq_list
 */
spinlock_t rq_lock;
-   /** client-side flags are serialized by rq_lock */
+   /** client-side flags are serialized by rq_lock @{ */
unsigned int rq_intr:1, rq_replied:1, rq_err:1,
rq_timedout:1, rq_resend:1, rq_restart:1,
/**
@@ -1444,18 +1444,15 @@ struct ptlrpc_request {
rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
rq_no_delay:1, rq_net_err:1, rq_wait_ctx:1,
rq_early:1,
-   rq_req_unlink:1, rq_reply_unlink:1,
+   rq_req_unlinked:1,  /* unlinked request buffer from lnet */
+   rq_reply_unlinked:1,/* unlinked reply buffer from lnet */
rq_memalloc:1,  /* req originated from "kswapd" */
-   /* server-side flags */
-   rq_packed_final:1,  /* packed final reply */
-   rq_hp:1,/* high priority RPC */
-   rq_at_linked:1, /* link into service's srv_at_array */
-   rq_reply_truncate:1,
rq_committed:1,
-   /* whether the "rq_set" is a valid one */
+   rq_reply_truncated:1,
+   /** whether the "rq_set" is a valid one */
rq_invalid_rqset:1,
rq_generation_set:1,
-   /* do not resend request on -EINPROGRESS */
+   /** do not resend request on -EINPROGRESS */
rq_no_retry_einprogress:1,
/* allow the req to be sent if the import is in recovery
 * status
@@ -1463,6 +1460,14 @@ struct ptlrpc_request {
rq_allow_replay:1,
/* bulk request, sent to server, but uncommitted */
rq_unstable:1;
+   /** @} */
+
+   /** server-side flags @{ */
+   unsigned int
+   rq_hp:1,/**< high priority RPC */
+   rq_at_linked:1, /**< link into service's srv_at_array */
+   rq_packed_final:1;  /**< packed final reply */
+   /** @} */
 
/** one of RQ_PHASE_* */
enum rq_phase   rq_phase;
@@ -2785,8 +2790,8 @@ ptlrpc_client_recv_or_unlink(struct ptlrpc_request *req)
spin_unlock(>rq_lock);
return 1;
}
-   rc = req->rq_receiving_reply;
-   rc = rc || req->rq_req_unlink || req->rq_reply_unlink;
+   rc = !req->rq_req_unlinked || !req->rq_reply_unlinked ||
+req->rq_receiving_reply;
spin_unlock(>rq_lock);
return rc;
 }
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 9abd469..ae1cef3 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -1148,9 +1148,9 @@ static int after_reply(struct ptlrpc_request *req)
 
LASSERT(obd);
/* repbuf must be unlinked */
-   LASSERT(!req->rq_receiving_reply && !req->rq_reply_unlink);
+   LASSERT(!req->rq_receiving_reply && req->rq_reply_unlinked);
 
-   if (req->rq_reply_truncate) {
+   if (req->rq_reply_truncated) {
if (ptlrpc_no_resend(req)) {
DEBUG_REQ(D_ERROR, req, "reply buffer overflow, 
expected: %d, actual size: %d",
 

[PATCH v2 27/29] staging/lustre/osc: glimpse lock should match only with granted locks

2016-06-20 Thread Oleg Drokin
From: Andriy Skulysh 

A deadlock is possible during ccc_prep_size()->ldlm_lock_match() vs
cl_io_lock() which is waiting for a matched lock and conflicts with
already taken lock before ccc_prep_size().

It is better to send an additional lock request to avoid deadlock.

Seagate-bug-id: MRP-3312
Signed-off-by: Andriy Skulysh 
Reviewed-on: http://review.whamcloud.com/18738
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7829
Reviewed-by: Jinshan Xiong 
Reviewed-by: Bobi Jam 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/osc_request.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c 
b/drivers/staging/lustre/lustre/osc/osc_request.c
index 9334349..536b868 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -2246,7 +2246,7 @@ int osc_enqueue_base(struct obd_export *exp, struct 
ldlm_res_id *res_id,
struct lustre_handle lockh = { 0 };
struct ptlrpc_request *req = NULL;
int intent = *flags & LDLM_FL_HAS_INTENT;
-   __u64 match_lvb = agl ? 0 : LDLM_FL_LVB_READY;
+   __u64 match_flags = *flags;
enum ldlm_mode mode;
int rc;
 
@@ -2281,7 +2281,11 @@ int osc_enqueue_base(struct obd_export *exp, struct 
ldlm_res_id *res_id,
mode = einfo->ei_mode;
if (einfo->ei_mode == LCK_PR)
mode |= LCK_PW;
-   mode = ldlm_lock_match(obd->obd_namespace, *flags | match_lvb, res_id,
+   if (agl == 0)
+   match_flags |= LDLM_FL_LVB_READY;
+   if (intent != 0)
+   match_flags |= LDLM_FL_BLOCK_GRANTED;
+   mode = ldlm_lock_match(obd->obd_namespace, match_flags, res_id,
   einfo->ei_type, policy, mode, , 0);
if (mode) {
struct ldlm_lock *matched;
-- 
2.7.4



[PATCH v2 17/29] staging/lustre/llite: change it_data to it_request

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

Change the void *it_data member of struct lookup_intent to struct
ptlrpc_request *it_request.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17070
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_intent.h |  2 +-
 drivers/staging/lustre/lustre/llite/dcache.c  |  6 +++---
 drivers/staging/lustre/lustre/llite/dir.c |  2 +-
 drivers/staging/lustre/lustre/llite/file.c| 17 -
 drivers/staging/lustre/lustre/llite/namei.c   |  2 +-
 drivers/staging/lustre/lustre/llite/xattr_cache.c |  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_intent.c|  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c   |  4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c |  6 +++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c   |  2 +-
 10 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h 
b/drivers/staging/lustre/lustre/include/lustre_intent.h
index 3aed810..ed2b6c6 100644
--- a/drivers/staging/lustre/lustre/include/lustre_intent.h
+++ b/drivers/staging/lustre/lustre/include/lustre_intent.h
@@ -46,7 +46,7 @@ struct lookup_intent {
int it_lock_mode;
int it_remote_lock_mode;
__u64  it_remote_lock_handle;
-   void   *it_data;
+   struct ptlrpc_request *it_request;
unsigned intit_lock_set:1;
 };
 
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index c5789f7..d964f4f 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -233,13 +233,13 @@ void ll_intent_release(struct lookup_intent *it)
ll_intent_drop_lock(it);
/* We are still holding extra reference on a request, need to free it */
if (it_disposition(it, DISP_ENQ_OPEN_REF))
-   ptlrpc_req_finished(it->it_data); /* ll_file_open */
+   ptlrpc_req_finished(it->it_request); /* ll_file_open */
 
if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */
-   ptlrpc_req_finished(it->it_data);
+   ptlrpc_req_finished(it->it_request);
 
it->it_disposition = 0;
-   it->it_data = NULL;
+   it->it_request = NULL;
 }
 
 void ll_invalidate_aliases(struct inode *inode)
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index a62df87..f0eb64b 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -362,7 +362,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
 
ll_finish_md_op_data(op_data);
 
-   request = (struct ptlrpc_request *)it.it_data;
+   request = (struct ptlrpc_request *)it.it_request;
if (request)
ptlrpc_req_finished(request);
if (rc < 0) {
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 92fab63..a188366 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -476,10 +476,9 @@ void ll_ioepoch_open(struct ll_inode_info *lli, __u64 
ioepoch)
 static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
   struct obd_client_handle *och)
 {
-   struct ptlrpc_request *req = it->it_data;
struct mdt_body *body;
 
-   body = req_capsule_server_get(>rq_pill, _MDT_BODY);
+   body = req_capsule_server_get(>it_request->rq_pill, _MDT_BODY);
och->och_fh = body->handle;
och->och_fid = body->fid1;
och->och_lease_handle.cookie = it->it_lock_handle;
@@ -500,7 +499,6 @@ static int ll_local_open(struct file *file, struct 
lookup_intent *it,
LASSERT(fd);
 
if (och) {
-   struct ptlrpc_request *req = it->it_data;
struct mdt_body *body;
int rc;
 
@@ -508,7 +506,8 @@ static int ll_local_open(struct file *file, struct 
lookup_intent *it,
if (rc != 0)
return rc;
 
-   body = req_capsule_server_get(>rq_pill, _MDT_BODY);
+   body = req_capsule_server_get(>it_request->rq_pill,
+ _MDT_BODY);
ll_ioepoch_open(lli, body->ioepoch);
}
 
@@ -725,7 +724,7 @@ out_openerr:
}
 
if (it && it_disposition(it, DISP_ENQ_OPEN_REF)) {
-   ptlrpc_req_finished(it->it_data);
+   ptlrpc_req_finished(it->it_request);
it_clear_disposition(it, DISP_ENQ_OPEN_REF);
 

[PATCH v2 08/29] staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set

2016-06-20 Thread Oleg Drokin
From: Liang Zhen 

This patch changes a few things:

- There is no guarantee that request_out_callback will happen
  before reply_in_callback, if a request got reply and unlinked
  reply buffer before request_out_callback is called, then the
  thread waiting on ptlrpc_request_set will miss wakeup event.

  This may seriously impact performance of some IO workloads or
  result in RPC timeout

- To make code more easier to understand, this patch changes
  action-bits "rq_req_unlink" and "rq_reply_unlink" to
  status-bits "rq_req_unlinked" and "rq_reply_unlinked"

Signed-off-by: Liang Zhen 
Reviewed-on: http://review.whamcloud.com/12158
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5696
Reviewed-by: Johann Lombardi 
Reviewed-by: Li Wei 
Reviewed-by: Mike Pershin 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h | 27 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 12 --
 drivers/staging/lustre/lustre/ptlrpc/events.c  | 22 +++---
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  | 14 +--
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |  9 
 5 files changed, 51 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 5968c3c..523d082 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -1428,7 +1428,7 @@ struct ptlrpc_request {
 * rq_list
 */
spinlock_t rq_lock;
-   /** client-side flags are serialized by rq_lock */
+   /** client-side flags are serialized by rq_lock @{ */
unsigned int rq_intr:1, rq_replied:1, rq_err:1,
rq_timedout:1, rq_resend:1, rq_restart:1,
/**
@@ -1444,18 +1444,15 @@ struct ptlrpc_request {
rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
rq_no_delay:1, rq_net_err:1, rq_wait_ctx:1,
rq_early:1,
-   rq_req_unlink:1, rq_reply_unlink:1,
+   rq_req_unlinked:1,  /* unlinked request buffer from lnet */
+   rq_reply_unlinked:1,/* unlinked reply buffer from lnet */
rq_memalloc:1,  /* req originated from "kswapd" */
-   /* server-side flags */
-   rq_packed_final:1,  /* packed final reply */
-   rq_hp:1,/* high priority RPC */
-   rq_at_linked:1, /* link into service's srv_at_array */
-   rq_reply_truncate:1,
rq_committed:1,
-   /* whether the "rq_set" is a valid one */
+   rq_reply_truncated:1,
+   /** whether the "rq_set" is a valid one */
rq_invalid_rqset:1,
rq_generation_set:1,
-   /* do not resend request on -EINPROGRESS */
+   /** do not resend request on -EINPROGRESS */
rq_no_retry_einprogress:1,
/* allow the req to be sent if the import is in recovery
 * status
@@ -1463,6 +1460,14 @@ struct ptlrpc_request {
rq_allow_replay:1,
/* bulk request, sent to server, but uncommitted */
rq_unstable:1;
+   /** @} */
+
+   /** server-side flags @{ */
+   unsigned int
+   rq_hp:1,/**< high priority RPC */
+   rq_at_linked:1, /**< link into service's srv_at_array */
+   rq_packed_final:1;  /**< packed final reply */
+   /** @} */
 
/** one of RQ_PHASE_* */
enum rq_phase   rq_phase;
@@ -2785,8 +2790,8 @@ ptlrpc_client_recv_or_unlink(struct ptlrpc_request *req)
spin_unlock(>rq_lock);
return 1;
}
-   rc = req->rq_receiving_reply;
-   rc = rc || req->rq_req_unlink || req->rq_reply_unlink;
+   rc = !req->rq_req_unlinked || !req->rq_reply_unlinked ||
+req->rq_receiving_reply;
spin_unlock(>rq_lock);
return rc;
 }
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 9abd469..ae1cef3 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -1148,9 +1148,9 @@ static int after_reply(struct ptlrpc_request *req)
 
LASSERT(obd);
/* repbuf must be unlinked */
-   LASSERT(!req->rq_receiving_reply && !req->rq_reply_unlink);
+   LASSERT(!req->rq_receiving_reply && req->rq_reply_unlinked);
 
-   if (req->rq_reply_truncate) {
+   if (req->rq_reply_truncated) {
if (ptlrpc_no_resend(req)) {
DEBUG_REQ(D_ERROR, req, "reply buffer overflow, 
expected: %d, actual size: %d",
  req->rq_nob_received, req->rq_repbuf_len);
@@ -2342,9 +2342,10 @@ int ptlrpc_unregister_reply(struct 

[PATCH v2 27/29] staging/lustre/osc: glimpse lock should match only with granted locks

2016-06-20 Thread Oleg Drokin
From: Andriy Skulysh 

A deadlock is possible during ccc_prep_size()->ldlm_lock_match() vs
cl_io_lock() which is waiting for a matched lock and conflicts with
already taken lock before ccc_prep_size().

It is better to send an additional lock request to avoid deadlock.

Seagate-bug-id: MRP-3312
Signed-off-by: Andriy Skulysh 
Reviewed-on: http://review.whamcloud.com/18738
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7829
Reviewed-by: Jinshan Xiong 
Reviewed-by: Bobi Jam 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/osc_request.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c 
b/drivers/staging/lustre/lustre/osc/osc_request.c
index 9334349..536b868 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -2246,7 +2246,7 @@ int osc_enqueue_base(struct obd_export *exp, struct 
ldlm_res_id *res_id,
struct lustre_handle lockh = { 0 };
struct ptlrpc_request *req = NULL;
int intent = *flags & LDLM_FL_HAS_INTENT;
-   __u64 match_lvb = agl ? 0 : LDLM_FL_LVB_READY;
+   __u64 match_flags = *flags;
enum ldlm_mode mode;
int rc;
 
@@ -2281,7 +2281,11 @@ int osc_enqueue_base(struct obd_export *exp, struct 
ldlm_res_id *res_id,
mode = einfo->ei_mode;
if (einfo->ei_mode == LCK_PR)
mode |= LCK_PW;
-   mode = ldlm_lock_match(obd->obd_namespace, *flags | match_lvb, res_id,
+   if (agl == 0)
+   match_flags |= LDLM_FL_LVB_READY;
+   if (intent != 0)
+   match_flags |= LDLM_FL_BLOCK_GRANTED;
+   mode = ldlm_lock_match(obd->obd_namespace, match_flags, res_id,
   einfo->ei_type, policy, mode, , 0);
if (mode) {
struct ldlm_lock *matched;
-- 
2.7.4



[PATCH v2 17/29] staging/lustre/llite: change it_data to it_request

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

Change the void *it_data member of struct lookup_intent to struct
ptlrpc_request *it_request.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17070
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_intent.h |  2 +-
 drivers/staging/lustre/lustre/llite/dcache.c  |  6 +++---
 drivers/staging/lustre/lustre/llite/dir.c |  2 +-
 drivers/staging/lustre/lustre/llite/file.c| 17 -
 drivers/staging/lustre/lustre/llite/namei.c   |  2 +-
 drivers/staging/lustre/lustre/llite/xattr_cache.c |  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_intent.c|  2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c   |  4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c |  6 +++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c   |  2 +-
 10 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h 
b/drivers/staging/lustre/lustre/include/lustre_intent.h
index 3aed810..ed2b6c6 100644
--- a/drivers/staging/lustre/lustre/include/lustre_intent.h
+++ b/drivers/staging/lustre/lustre/include/lustre_intent.h
@@ -46,7 +46,7 @@ struct lookup_intent {
int it_lock_mode;
int it_remote_lock_mode;
__u64  it_remote_lock_handle;
-   void   *it_data;
+   struct ptlrpc_request *it_request;
unsigned intit_lock_set:1;
 };
 
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index c5789f7..d964f4f 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -233,13 +233,13 @@ void ll_intent_release(struct lookup_intent *it)
ll_intent_drop_lock(it);
/* We are still holding extra reference on a request, need to free it */
if (it_disposition(it, DISP_ENQ_OPEN_REF))
-   ptlrpc_req_finished(it->it_data); /* ll_file_open */
+   ptlrpc_req_finished(it->it_request); /* ll_file_open */
 
if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */
-   ptlrpc_req_finished(it->it_data);
+   ptlrpc_req_finished(it->it_request);
 
it->it_disposition = 0;
-   it->it_data = NULL;
+   it->it_request = NULL;
 }
 
 void ll_invalidate_aliases(struct inode *inode)
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index a62df87..f0eb64b 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -362,7 +362,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
 
ll_finish_md_op_data(op_data);
 
-   request = (struct ptlrpc_request *)it.it_data;
+   request = (struct ptlrpc_request *)it.it_request;
if (request)
ptlrpc_req_finished(request);
if (rc < 0) {
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 92fab63..a188366 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -476,10 +476,9 @@ void ll_ioepoch_open(struct ll_inode_info *lli, __u64 
ioepoch)
 static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
   struct obd_client_handle *och)
 {
-   struct ptlrpc_request *req = it->it_data;
struct mdt_body *body;
 
-   body = req_capsule_server_get(>rq_pill, _MDT_BODY);
+   body = req_capsule_server_get(>it_request->rq_pill, _MDT_BODY);
och->och_fh = body->handle;
och->och_fid = body->fid1;
och->och_lease_handle.cookie = it->it_lock_handle;
@@ -500,7 +499,6 @@ static int ll_local_open(struct file *file, struct 
lookup_intent *it,
LASSERT(fd);
 
if (och) {
-   struct ptlrpc_request *req = it->it_data;
struct mdt_body *body;
int rc;
 
@@ -508,7 +506,8 @@ static int ll_local_open(struct file *file, struct 
lookup_intent *it,
if (rc != 0)
return rc;
 
-   body = req_capsule_server_get(>rq_pill, _MDT_BODY);
+   body = req_capsule_server_get(>it_request->rq_pill,
+ _MDT_BODY);
ll_ioepoch_open(lli, body->ioepoch);
}
 
@@ -725,7 +724,7 @@ out_openerr:
}
 
if (it && it_disposition(it, DISP_ENQ_OPEN_REF)) {
-   ptlrpc_req_finished(it->it_data);
+   ptlrpc_req_finished(it->it_request);
it_clear_disposition(it, DISP_ENQ_OPEN_REF);
}
 
@@ -1413,7 +1412,7 @@ out_unlock:
 out:
return rc;
 out_req_free:
-   

[PATCH v2 04/29] staging/lustre/llite: lock i_lock before __d_drop()

2016-06-20 Thread Oleg Drokin
From: Bruno Faccini 

There has been several Lustre Client crashes reported by sites
running with Lustre versions 2.1/2.5, all showing the same
dentry->d_hash->next corrupted pointer cause.

This patch fixes a regression that has been introduced since a
long time by commit :
(LU-506 kernel: FC15 - support dcache scalability changes.)

where i_lock protection usage has been removed and
that is likely to cause racy condition during dentry [un]hashing
and to be the root cause of these crashes.

Signed-off-by: Bruno Faccini 
Reviewed-on: http://review.whamcloud.com/19287
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7973
Reviewed-by: Lai Siyao 
Reviewed-by: Yang Sheng 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/file.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index b0c4548..5436a54 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2975,8 +2975,11 @@ static int __ll_inode_revalidate(struct dentry *dentry, 
__u64 ibits)
 * here to preserve get_cwd functionality on 2.6.
 * Bug 10503
 */
-   if (!d_inode(dentry)->i_nlink)
+   if (!d_inode(dentry)->i_nlink) {
+   spin_lock(>i_lock);
d_lustre_invalidate(dentry, 0);
+   spin_unlock(>i_lock);
+   }
 
ll_lookup_finish_locks(, inode);
} else if (!ll_have_md_lock(d_inode(dentry), , LCK_MINMODE)) {
-- 
2.7.4



[PATCH v2 29/29] staging: lustre: quiet lockdep recursive lock warning

2016-06-20 Thread Oleg Drokin
From: Andreas Dilger 

Lockdep complains about potential recursive locking during mount
because the client configuration log is holding a lock on the MGC
obd_device to prevent it from being torn down, while also getting
mutexes on the MDC and OSC devices as they are instantiated:

 Lustre: Mounted myth-client
=
[ INFO: possible recursive locking detected ]
4.7.0-rc2-vm-nfs+ #127 Tainted: G C
-

 May be due to missing lock nesting notation
2 locks held by ll_cfg_requeue/5928:
 #0:  (>cl_sem){.+.+.+}, at: mgc_requeue_thread+0x15d/0x730 [mgc]
 #1:  (>cld_lock){+.+.+.}, at: mgc_process_log+0x5e/0xf80 [mgc]
CPU: 0 PID: 5928 Comm: ll_cfg_requeue
Call Trace:
 [] dump_stack+0x86/0xc1
 [] __lock_acquire+0x726/0x1210
 [] lock_acquire+0xfe/0x1f0
 [] down_read+0x51/0xa0
 [] sptlrpc_conf_client_adapt+0x47/0x150 [ptlrpc]
 [] mdc_set_info_async+0x2b6/0x470 [mdc]
 [] class_notify_sptlrpc_conf+0x190/0x360 [obdclass]
 [] mgc_process_log+0x925/0xf80 [mgc]
 [] mgc_requeue_thread+0x1fa/0x730 [mgc]
 [] kthread+0x101/0x120
 [] ret_from_fork+0x1f/0x40

Add a separate lock class for the MGC callpath, since it will always
be held first, and none of the other obd_device locks should ever
be held concurrently.

Signed-off-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/obd.h   | 6 ++
 drivers/staging/lustre/lustre/mgc/mgc_request.c   | 4 +++-
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index ed1081a..593d107 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -228,6 +228,12 @@ enum {
 #define MDC_MAX_RIF_DEFAULT   8
 #define MDC_MAX_RIF_MAX 512
 
+enum obd_cl_sem_lock_class {
+   OBD_CLI_SEM_NORMAL,
+   OBD_CLI_SEM_MGC,
+   OBD_CLI_SEM_MDCOSC,
+};
+
 struct mdc_rpc_lock;
 struct obd_import;
 struct client_obd {
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index fbbf276..9d0bd47 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -496,7 +496,9 @@ static void do_requeue(struct config_llog_data *cld)
 * export which is being disconnected. Take the client
 * semaphore to make the check non-racy.
 */
-   down_read(>cld_mgcexp->exp_obd->u.cli.cl_sem);
+   down_read_nested(>cld_mgcexp->exp_obd->u.cli.cl_sem,
+OBD_CLI_SEM_MGC);
+
if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
int rc;
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
index 1238c87..c140354 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
@@ -815,7 +815,7 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd)
CDEBUG(D_SEC, "obd %s\n", obd->u.cli.cl_target_uuid.uuid);
 
/* serialize with connect/disconnect import */
-   down_read(>u.cli.cl_sem);
+   down_read_nested(>u.cli.cl_sem, OBD_CLI_SEM_MDCOSC);
 
imp = obd->u.cli.cl_import;
if (imp) {
-- 
2.7.4



[PATCH v2 3/3] drm/i915: Enable polling when we don't have hpd

2016-06-20 Thread Lyude
Unfortunately, there's two situations where we lose hpd right now:
- Runtime suspend
- When we've shut off all of the power wells on Valleyview/Cherryview

While it would be nice if this didn't cause issues, this has the
ability to get us in some awkward states where a user won't be able to
get their display to turn on. For instance; if we boot a Valleyview
system without any monitors connected, it won't need any of it's power
wells and thus shut them off. Since this causes us to lose HPD, this
means that unless the user knows how to ssh into their machine and do a
manual reprobe for monitors, none of the monitors they connect after
booting will actually work.

Eventually we should come up with a better fix then having to enable
polling for this, since this makes rpm a lot less useful, but for now
the infrastructure in i915 just isn't there yet to get hpd in these
situations.

Changes since v1:
 - Add comment explaining the addition of the if
   (!mode_config->poll_running) in intel_hpd_init()
 - Remove unneeded if (!dev->mode_config.poll_enabled) in
   i915_hpd_poll_init_work()
 - Call to drm_helper_hpd_irq_event() after we disable polling
 - Add cancel_work_sync() call to intel_hpd_cancel_work()

Cc: sta...@vger.kernel.org
Cc: Ville Syrjälä 
Acked-by: Daniel Vetter 
Signed-off-by: Lyude 
---
 drivers/gpu/drm/i915/i915_drv.c |  7 ++-
 drivers/gpu/drm/i915/i915_drv.h |  3 ++
 drivers/gpu/drm/i915/intel_drv.h|  2 +
 drivers/gpu/drm/i915/intel_hotplug.c| 82 +
 drivers/gpu/drm/i915/intel_runtime_pm.c |  3 ++
 5 files changed, 86 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 3eb47fb..5381d9e 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1612,6 +1612,9 @@ static int intel_runtime_suspend(struct device *device)
 
assert_forcewakes_inactive(dev_priv);
 
+   if (!IS_VALLEYVIEW(dev_priv) || !IS_CHERRYVIEW(dev_priv))
+   intel_hpd_poll_enable(dev_priv, true);
+
DRM_DEBUG_KMS("Device suspended\n");
return 0;
 }
@@ -1667,8 +1670,10 @@ static int intel_runtime_resume(struct device *device)
 * power well, so hpd is reinitialized from there. For
 * everyone else do it here.
 */
-   if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
+   if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) {
intel_hpd_init(dev_priv);
+   intel_hpd_poll_enable(dev_priv, false);
+   }
 
intel_enable_gt_powersave(dev_priv);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1eef5ef..6f7075d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -283,6 +283,9 @@ struct i915_hotplug {
u32 short_port_mask;
struct work_struct dig_port_work;
 
+   struct work_struct poll_enable_work;
+   bool poll_enabled;
+
/*
 * if we get a HPD irq from DP and a HPD irq from non-DP
 * the non-DP HPD could block the workqueue on a mode config
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cd14751..87c5143 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1384,6 +1384,8 @@ int intel_dsi_dcs_init_backlight_funcs(struct 
intel_connector *intel_connector);
 
 /* intel_dvo.c */
 void intel_dvo_init(struct drm_device *dev);
+/* intel_hotplug.c */
+void intel_hpd_poll_enable(struct drm_i915_private *dev_priv, bool enabled);
 
 
 /* legacy fbdev emulation in intel_fbdev.c */
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c 
b/drivers/gpu/drm/i915/intel_hotplug.c
index ec3285f..3ef5096 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -464,20 +464,34 @@ void intel_hpd_init(struct drm_i915_private *dev_priv)
dev_priv->hotplug.stats[i].count = 0;
dev_priv->hotplug.stats[i].state = HPD_ENABLED;
}
-   list_for_each_entry(connector, _config->connector_list, head) {
-   struct intel_connector *intel_connector = 
to_intel_connector(connector);
-   connector->polled = intel_connector->polled;
 
-   /* MST has a dynamic intel_connector->encoder and it's reprobing
-* is all handled by the MST helpers. */
-   if (intel_connector->mst_port)
-   continue;
+   /*
+* When we're in the midst of doing connector polling in situations
+* where we don't have working hpd, we need to make sure we don't try
+* changing the polling settings of any connectors, since this can lead
+* to us setting connector->polled to DRM_CONNECTOR_POLL_HPD, resulting
+* in DRM's polling helpers automatically skipping the rest of the
+* 

[PATCH v2 04/29] staging/lustre/llite: lock i_lock before __d_drop()

2016-06-20 Thread Oleg Drokin
From: Bruno Faccini 

There has been several Lustre Client crashes reported by sites
running with Lustre versions 2.1/2.5, all showing the same
dentry->d_hash->next corrupted pointer cause.

This patch fixes a regression that has been introduced since a
long time by commit :
(LU-506 kernel: FC15 - support dcache scalability changes.)

where i_lock protection usage has been removed and
that is likely to cause racy condition during dentry [un]hashing
and to be the root cause of these crashes.

Signed-off-by: Bruno Faccini 
Reviewed-on: http://review.whamcloud.com/19287
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7973
Reviewed-by: Lai Siyao 
Reviewed-by: Yang Sheng 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/file.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index b0c4548..5436a54 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2975,8 +2975,11 @@ static int __ll_inode_revalidate(struct dentry *dentry, 
__u64 ibits)
 * here to preserve get_cwd functionality on 2.6.
 * Bug 10503
 */
-   if (!d_inode(dentry)->i_nlink)
+   if (!d_inode(dentry)->i_nlink) {
+   spin_lock(>i_lock);
d_lustre_invalidate(dentry, 0);
+   spin_unlock(>i_lock);
+   }
 
ll_lookup_finish_locks(, inode);
} else if (!ll_have_md_lock(d_inode(dentry), , LCK_MINMODE)) {
-- 
2.7.4



[PATCH v2 29/29] staging: lustre: quiet lockdep recursive lock warning

2016-06-20 Thread Oleg Drokin
From: Andreas Dilger 

Lockdep complains about potential recursive locking during mount
because the client configuration log is holding a lock on the MGC
obd_device to prevent it from being torn down, while also getting
mutexes on the MDC and OSC devices as they are instantiated:

 Lustre: Mounted myth-client
=
[ INFO: possible recursive locking detected ]
4.7.0-rc2-vm-nfs+ #127 Tainted: G C
-

 May be due to missing lock nesting notation
2 locks held by ll_cfg_requeue/5928:
 #0:  (>cl_sem){.+.+.+}, at: mgc_requeue_thread+0x15d/0x730 [mgc]
 #1:  (>cld_lock){+.+.+.}, at: mgc_process_log+0x5e/0xf80 [mgc]
CPU: 0 PID: 5928 Comm: ll_cfg_requeue
Call Trace:
 [] dump_stack+0x86/0xc1
 [] __lock_acquire+0x726/0x1210
 [] lock_acquire+0xfe/0x1f0
 [] down_read+0x51/0xa0
 [] sptlrpc_conf_client_adapt+0x47/0x150 [ptlrpc]
 [] mdc_set_info_async+0x2b6/0x470 [mdc]
 [] class_notify_sptlrpc_conf+0x190/0x360 [obdclass]
 [] mgc_process_log+0x925/0xf80 [mgc]
 [] mgc_requeue_thread+0x1fa/0x730 [mgc]
 [] kthread+0x101/0x120
 [] ret_from_fork+0x1f/0x40

Add a separate lock class for the MGC callpath, since it will always
be held first, and none of the other obd_device locks should ever
be held concurrently.

Signed-off-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/obd.h   | 6 ++
 drivers/staging/lustre/lustre/mgc/mgc_request.c   | 4 +++-
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index ed1081a..593d107 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -228,6 +228,12 @@ enum {
 #define MDC_MAX_RIF_DEFAULT   8
 #define MDC_MAX_RIF_MAX 512
 
+enum obd_cl_sem_lock_class {
+   OBD_CLI_SEM_NORMAL,
+   OBD_CLI_SEM_MGC,
+   OBD_CLI_SEM_MDCOSC,
+};
+
 struct mdc_rpc_lock;
 struct obd_import;
 struct client_obd {
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index fbbf276..9d0bd47 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -496,7 +496,9 @@ static void do_requeue(struct config_llog_data *cld)
 * export which is being disconnected. Take the client
 * semaphore to make the check non-racy.
 */
-   down_read(>cld_mgcexp->exp_obd->u.cli.cl_sem);
+   down_read_nested(>cld_mgcexp->exp_obd->u.cli.cl_sem,
+OBD_CLI_SEM_MGC);
+
if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
int rc;
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
index 1238c87..c140354 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
@@ -815,7 +815,7 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd)
CDEBUG(D_SEC, "obd %s\n", obd->u.cli.cl_target_uuid.uuid);
 
/* serialize with connect/disconnect import */
-   down_read(>u.cli.cl_sem);
+   down_read_nested(>u.cli.cl_sem, OBD_CLI_SEM_MDCOSC);
 
imp = obd->u.cli.cl_import;
if (imp) {
-- 
2.7.4



[PATCH v2 3/3] drm/i915: Enable polling when we don't have hpd

2016-06-20 Thread Lyude
Unfortunately, there's two situations where we lose hpd right now:
- Runtime suspend
- When we've shut off all of the power wells on Valleyview/Cherryview

While it would be nice if this didn't cause issues, this has the
ability to get us in some awkward states where a user won't be able to
get their display to turn on. For instance; if we boot a Valleyview
system without any monitors connected, it won't need any of it's power
wells and thus shut them off. Since this causes us to lose HPD, this
means that unless the user knows how to ssh into their machine and do a
manual reprobe for monitors, none of the monitors they connect after
booting will actually work.

Eventually we should come up with a better fix then having to enable
polling for this, since this makes rpm a lot less useful, but for now
the infrastructure in i915 just isn't there yet to get hpd in these
situations.

Changes since v1:
 - Add comment explaining the addition of the if
   (!mode_config->poll_running) in intel_hpd_init()
 - Remove unneeded if (!dev->mode_config.poll_enabled) in
   i915_hpd_poll_init_work()
 - Call to drm_helper_hpd_irq_event() after we disable polling
 - Add cancel_work_sync() call to intel_hpd_cancel_work()

Cc: sta...@vger.kernel.org
Cc: Ville Syrjälä 
Acked-by: Daniel Vetter 
Signed-off-by: Lyude 
---
 drivers/gpu/drm/i915/i915_drv.c |  7 ++-
 drivers/gpu/drm/i915/i915_drv.h |  3 ++
 drivers/gpu/drm/i915/intel_drv.h|  2 +
 drivers/gpu/drm/i915/intel_hotplug.c| 82 +
 drivers/gpu/drm/i915/intel_runtime_pm.c |  3 ++
 5 files changed, 86 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 3eb47fb..5381d9e 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1612,6 +1612,9 @@ static int intel_runtime_suspend(struct device *device)
 
assert_forcewakes_inactive(dev_priv);
 
+   if (!IS_VALLEYVIEW(dev_priv) || !IS_CHERRYVIEW(dev_priv))
+   intel_hpd_poll_enable(dev_priv, true);
+
DRM_DEBUG_KMS("Device suspended\n");
return 0;
 }
@@ -1667,8 +1670,10 @@ static int intel_runtime_resume(struct device *device)
 * power well, so hpd is reinitialized from there. For
 * everyone else do it here.
 */
-   if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
+   if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) {
intel_hpd_init(dev_priv);
+   intel_hpd_poll_enable(dev_priv, false);
+   }
 
intel_enable_gt_powersave(dev_priv);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1eef5ef..6f7075d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -283,6 +283,9 @@ struct i915_hotplug {
u32 short_port_mask;
struct work_struct dig_port_work;
 
+   struct work_struct poll_enable_work;
+   bool poll_enabled;
+
/*
 * if we get a HPD irq from DP and a HPD irq from non-DP
 * the non-DP HPD could block the workqueue on a mode config
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cd14751..87c5143 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1384,6 +1384,8 @@ int intel_dsi_dcs_init_backlight_funcs(struct 
intel_connector *intel_connector);
 
 /* intel_dvo.c */
 void intel_dvo_init(struct drm_device *dev);
+/* intel_hotplug.c */
+void intel_hpd_poll_enable(struct drm_i915_private *dev_priv, bool enabled);
 
 
 /* legacy fbdev emulation in intel_fbdev.c */
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c 
b/drivers/gpu/drm/i915/intel_hotplug.c
index ec3285f..3ef5096 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -464,20 +464,34 @@ void intel_hpd_init(struct drm_i915_private *dev_priv)
dev_priv->hotplug.stats[i].count = 0;
dev_priv->hotplug.stats[i].state = HPD_ENABLED;
}
-   list_for_each_entry(connector, _config->connector_list, head) {
-   struct intel_connector *intel_connector = 
to_intel_connector(connector);
-   connector->polled = intel_connector->polled;
 
-   /* MST has a dynamic intel_connector->encoder and it's reprobing
-* is all handled by the MST helpers. */
-   if (intel_connector->mst_port)
-   continue;
+   /*
+* When we're in the midst of doing connector polling in situations
+* where we don't have working hpd, we need to make sure we don't try
+* changing the polling settings of any connectors, since this can lead
+* to us setting connector->polled to DRM_CONNECTOR_POLL_HPD, resulting
+* in DRM's polling helpers automatically skipping the rest of the
+* connectors that still need polling
+*/
+   if 

[PATCH 3/4] MAINTAINERS: Update BCM63XX entry

2016-06-20 Thread Jon Mason
There are more files being supported by the BCM63XX than simply
"arch/arm/mach-bcm/bcm63xx.c" and "arch/arm/include/debug/bcm63xx.S".
Add a regex of "bcm63xx" to catch all the other files that are out
there.

Signed-off-by: Jon Mason 
---
 MAINTAINERS | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 81be402..28a35f4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2523,8 +2523,7 @@ L:linux-arm-ker...@lists.infradead.org (moderated 
for non-subscribers)
 L: bcm-kernel-feedback-l...@broadcom.com
 T: git git://github.com/broadcom/stblinux.git
 S: Maintained
-F: arch/arm/mach-bcm/bcm63xx.c
-F: arch/arm/include/debug/bcm63xx.S
+N: bcm63xx
 
 BROADCOM BCM63XX/BCM33XX UDC DRIVER
 M: Kevin Cernekee 
-- 
1.9.1



[PATCH 3/4] MAINTAINERS: Update BCM63XX entry

2016-06-20 Thread Jon Mason
There are more files being supported by the BCM63XX than simply
"arch/arm/mach-bcm/bcm63xx.c" and "arch/arm/include/debug/bcm63xx.S".
Add a regex of "bcm63xx" to catch all the other files that are out
there.

Signed-off-by: Jon Mason 
---
 MAINTAINERS | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 81be402..28a35f4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2523,8 +2523,7 @@ L:linux-arm-ker...@lists.infradead.org (moderated 
for non-subscribers)
 L: bcm-kernel-feedback-l...@broadcom.com
 T: git git://github.com/broadcom/stblinux.git
 S: Maintained
-F: arch/arm/mach-bcm/bcm63xx.c
-F: arch/arm/include/debug/bcm63xx.S
+N: bcm63xx
 
 BROADCOM BCM63XX/BCM33XX UDC DRIVER
 M: Kevin Cernekee 
-- 
1.9.1



[PATCH v2 21/29] staging/lustre/llite: don't panic when fid is insane

2016-06-20 Thread Oleg Drokin
From: Sergey Cheremencev 

LASSERT should never be done on data that is
received to over the network. Return EINVAL
when server returns invalid fid despite of
it_status == 0.

Signed-off-by: Sergey Cheremencev 
Seagate-bug-id: MRP-3073
Reviewed-on: http://review.whamcloud.com/17985
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7422
Reviewed-by: John L. Hammond 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 539fdd1..118e41d 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1971,7 +1971,13 @@ int ll_prep_inode(struct inode **inode, struct 
ptlrpc_request *req,
 * At this point server returns to client's same fid as client
 * generated for creating. So using ->fid1 is okay here.
 */
-   LASSERT(fid_is_sane(>fid1));
+   if (!fid_is_sane(>fid1)) {
+   CERROR("%s: Fid is insane " DFID "\n",
+  ll_get_fsname(sb, NULL, 0),
+  PFID(>fid1));
+   rc = -EINVAL;
+   goto out;
+   }
 
*inode = ll_iget(sb, cl_fid_build_ino(>fid1,
 sbi->ll_flags & LL_SBI_32BIT_API),
-- 
2.7.4



[PATCH v2 21/29] staging/lustre/llite: don't panic when fid is insane

2016-06-20 Thread Oleg Drokin
From: Sergey Cheremencev 

LASSERT should never be done on data that is
received to over the network. Return EINVAL
when server returns invalid fid despite of
it_status == 0.

Signed-off-by: Sergey Cheremencev 
Seagate-bug-id: MRP-3073
Reviewed-on: http://review.whamcloud.com/17985
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7422
Reviewed-by: John L. Hammond 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 539fdd1..118e41d 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1971,7 +1971,13 @@ int ll_prep_inode(struct inode **inode, struct 
ptlrpc_request *req,
 * At this point server returns to client's same fid as client
 * generated for creating. So using ->fid1 is okay here.
 */
-   LASSERT(fid_is_sane(>fid1));
+   if (!fid_is_sane(>fid1)) {
+   CERROR("%s: Fid is insane " DFID "\n",
+  ll_get_fsname(sb, NULL, 0),
+  PFID(>fid1));
+   rc = -EINVAL;
+   goto out;
+   }
 
*inode = ll_iget(sb, cl_fid_build_ino(>fid1,
 sbi->ll_flags & LL_SBI_32BIT_API),
-- 
2.7.4



[PATCH v2 25/29] staging/lustre/osc: fix signed one bit field

2016-06-20 Thread Oleg Drokin
From: Dmitry Eremin 

Bit field 'oi_lockless' and 'oi_is_active' has one bit and is signed
which is confusing.

Signed-off-by: Dmitry Eremin 
Reviewed-on: http://review.whamcloud.com/19196
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7258
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Reviewed-by: Frank Zago 
Reviewed-by: John L. Hammond 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/osc_cl_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h 
b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
index 437c659..c8c3f1c 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
+++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
@@ -62,7 +62,7 @@ struct osc_io {
/** super class */
struct cl_io_slice oi_cl;
/** true if this io is lockless. */
-   int oi_lockless;
+   unsigned intoi_lockless;
/** how many LRU pages are reserved for this IO */
int oi_lru_reserved;
 
-- 
2.7.4



[PATCH v2 00/29] Lustre fixes

2016-06-20 Thread Oleg Drokin
Changes from v1:
This is rebased and retested on top of latest staging tree,
one patch dropped because it made it to the tree by other means,
two more fixes added.

These patches represent another round of Lustre fixes
and also a few cleanups that some of the fixes were
building up upon.

Alex Zhuravlev (1):
  staging/lustre: LDLM_DEBUG() shouldn't be passed \n

Andreas Dilger (1):
  staging: lustre: quiet lockdep recursive lock warning

Andriy Skulysh (1):
  staging/lustre/osc: glimpse lock should match only with granted locks

Ben Evans (1):
  staging/lustre/ptlrpc: Remove __ptlrpc_request_bufs_pack

Bob Glossman (1):
  staging/lustre: Add newline to LU_OBJECT_DEBUG() message

Bruno Faccini (1):
  staging/lustre/llite: lock i_lock before __d_drop()

Dmitry Eremin (1):
  staging/lustre/osc: fix signed one bit field

Emoly Liu (1):
  staging/lustre/llite: allocate and free client cache asynchronously

Jinshan Xiong (1):
  staging/lustre/osc: osc_lock_weight endless loop fix

John L. Hammond (4):
  staging/lustre/llite: correct request handling after ll_lookup_it()
  staging/lustre/llite: flatten struct lookup_intent
  staging/lustre/llite: change it_data to it_request
  staging/lustre/ldlm: const qualify struct lustre_handle * params

Liang Zhen (2):
  staging/lustre/ptlrpc: reorganize ptlrpc_request
  staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set

Niu Yawei (1):
  staging/lustre/mdc: Zero atime in close RPC

Oleg Drokin (7):
  staging/lustre/llite: Get rid of ll_lock_dcache/ll_unlock_dcache
  staging/lustre/osc: Fix reverted condition in osc_lock_weight
  staging/lustre: Inline Lustre intent disposition functions
  staging/lustre/llite: Restore proper opencache operations
  staging/lustre/llite: ll_revalidate_dentry update
  staging/lustre: Add documentation for unstable_stats in sysfs
  staging/lustre/libcfs: Do not call kthread_run in wrong state

Patrick Farrell (1):
  staging/lustre/llite: take trunc_sem only at vvp layer

Sergey Cheremencev (1):
  staging/lustre/llite: don't panic when fid is insane

Vitaly Fertman (2):
  staging/lustre/ptlrpc: Early Reply vs Reply MDunlink
  staging/lustre/ptlrpc: lost bulk leads to a hang

Yang Sheng (1):
  staging/lustre/llite: ensure obd is effective in onu_upcall

akam kumar bharathi (1):
  staging/lustre/llite: IOC_MDC_GETFILEINFO returns the wrong ino

 drivers/staging/lustre/lnet/libcfs/debug.c |   2 +-
 drivers/staging/lustre/lustre/include/cl_object.h  |  10 +-
 drivers/staging/lustre/lustre/include/lu_object.h  |   2 +-
 drivers/staging/lustre/lustre/include/lustre_dlm.h |  18 +-
 .../staging/lustre/lustre/include/lustre_intent.h  |  30 +-
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   3 -
 drivers/staging/lustre/lustre/include/lustre_net.h | 414 -
 drivers/staging/lustre/lustre/include/obd.h|   8 +-
 .../staging/lustre/lustre/include/obd_support.h|   3 +
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |  16 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|   5 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |   6 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   2 +-
 drivers/staging/lustre/lustre/llite/dcache.c   |  41 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   8 +-
 drivers/staging/lustre/lustre/llite/file.c |  66 ++--
 drivers/staging/lustre/lustre/llite/lcommon_misc.c |   8 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  27 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  47 +--
 drivers/staging/lustre/lustre/llite/llite_mmap.c   |   7 -
 drivers/staging/lustre/lustre/llite/llite_nfs.c|  18 +
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |   6 +-
 drivers/staging/lustre/lustre/llite/namei.c|  25 +-
 drivers/staging/lustre/lustre/llite/statahead.c|  10 +-
 drivers/staging/lustre/lustre/llite/xattr_cache.c  |  16 +-
 drivers/staging/lustre/lustre/lmv/lmv_intent.c |  26 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c|   8 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c|   7 +
 drivers/staging/lustre/lustre/lov/lov_object.c |   4 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c|  12 +
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |  93 ++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c|   2 +-
 drivers/staging/lustre/lustre/mgc/mgc_request.c|   4 +-
 drivers/staging/lustre/lustre/obdclass/cl_page.c   |  46 +++
 drivers/staging/lustre/lustre/osc/osc_cache.c  |   4 +-
 .../staging/lustre/lustre/osc/osc_cl_internal.h|   2 +-
 drivers/staging/lustre/lustre/osc/osc_lock.c   |  18 +-
 drivers/staging/lustre/lustre/osc/osc_page.c   |   4 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|  12 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 159 
 drivers/staging/lustre/lustre/ptlrpc/events.c  |  30 +-
 drivers/staging/lustre/lustre/ptlrpc/import.c  |   3 +-
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |  20 

[PATCH v2 03/29] staging/lustre/llite: Get rid of ll_lock_dcache/ll_unlock_dcache

2016-06-20 Thread Oleg Drokin
These are just doing spin_lock/unlock on inode's i_lock,
so just do the spinlock directly to make the code more clear

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dcache.c |  4 ++--
 drivers/staging/lustre/lustre/llite/llite_internal.h | 10 --
 drivers/staging/lustre/lustre/llite/namei.c  |  8 
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index 9d13d5e..f002b3a 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -249,7 +249,7 @@ void ll_invalidate_aliases(struct inode *inode)
CDEBUG(D_INODE, "marking dentries for ino "DFID"(%p) invalid\n",
   PFID(ll_inode2fid(inode)), inode);
 
-   ll_lock_dcache(inode);
+   spin_lock(>i_lock);
hlist_for_each_entry(dentry, >i_dentry, d_u.d_alias) {
CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p 
flags %d\n",
   dentry, dentry, dentry->d_parent,
@@ -257,7 +257,7 @@ void ll_invalidate_aliases(struct inode *inode)
 
d_lustre_invalidate(dentry, 0);
}
-   ll_unlock_dcache(inode);
+   spin_unlock(>i_lock);
 }
 
 int ll_revalidate_it_finish(struct ptlrpc_request *request,
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 74cd241..098155f 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -1313,16 +1313,6 @@ static inline void ll_set_lock_data(struct obd_export 
*exp, struct inode *inode,
*bits = it->d.lustre.it_lock_bits;
 }
 
-static inline void ll_lock_dcache(struct inode *inode)
-{
-   spin_lock(>i_lock);
-}
-
-static inline void ll_unlock_dcache(struct inode *inode)
-{
-   spin_unlock(>i_lock);
-}
-
 static inline int d_lustre_invalid(const struct dentry *dentry)
 {
struct ll_dentry_data *lld = ll_d2d(dentry);
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 6414d52..e4df510 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -140,7 +140,7 @@ static void ll_invalidate_negative_children(struct inode 
*dir)
 {
struct dentry *dentry, *tmp_subdir;
 
-   ll_lock_dcache(dir);
+   spin_lock(>i_lock);
hlist_for_each_entry(dentry, >i_dentry, d_u.d_alias) {
spin_lock(>d_lock);
if (!list_empty(>d_subdirs)) {
@@ -155,7 +155,7 @@ static void ll_invalidate_negative_children(struct inode 
*dir)
}
spin_unlock(>d_lock);
}
-   ll_unlock_dcache(dir);
+   spin_unlock(>i_lock);
 }
 
 int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
@@ -317,7 +317,7 @@ static struct dentry *ll_find_alias(struct inode *inode, 
struct dentry *dentry)
discon_alias = NULL;
invalid_alias = NULL;
 
-   ll_lock_dcache(inode);
+   spin_lock(>i_lock);
hlist_for_each_entry(alias, >i_dentry, d_u.d_alias) {
LASSERT(alias != dentry);
 
@@ -342,7 +342,7 @@ static struct dentry *ll_find_alias(struct inode *inode, 
struct dentry *dentry)
dget_dlock(alias);
spin_unlock(>d_lock);
}
-   ll_unlock_dcache(inode);
+   spin_unlock(>i_lock);
 
return alias;
 }
-- 
2.7.4



Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices

2016-06-20 Thread Kani, Toshimitsu
On Mon, 2016-06-20 at 14:00 -0400, Mike Snitzer wrote:
> On Mon, Jun 13 2016 at  6:57pm -0400,
> Mike Snitzer  wrote:
> 
> > 
> > On Mon, Jun 13 2016 at  6:21pm -0400,
> > Toshi Kani  wrote:
> > 
> > > 
> > > This patch-set adds DAX support to device-mapper dm-linear devices
> > > used by LVM.  It works with LVM commands as follows:
> > >  - Creation of a logical volume with all DAX capable devices (such
> > >    as pmem) sets the logical volume DAX capable as well.
> > >  - Once a logical volume is set to DAX capable, the volume may not
> > >    be extended with non-DAX capable devices.
> > > 
> > > The direct_access interface is added to dm and dm-linear to map
> > > a request to a target device.
> > > 
> > >  - Patch 1-2 introduce GENHD_FL_DAX flag to indicate DAX capability.
> > >  - Patch 3-4 add direct_access functions to dm and dm-linear.
> > >  - Patch 5-6 set GENHD_FL_DAX to dm when all targets are DAX capable.
> > > 
> > > ---
> > > Toshi Kani (6):
> > >  1/6 genhd: Add GENHD_FL_DAX to gendisk flags
> > >  2/6 block: Check GENHD_FL_DAX for DAX capability
> > >  3/6 dm: Add dm_blk_direct_access() for mapped device
> > >  4/6 dm-linear: Add linear_direct_access()
> > >  5/6 dm, dm-linear: Add dax_supported to dm_target
> > >  6/6 dm: Enable DAX support for mapper device
> > Thanks a lot for doing this.  I recently added it to my TODO so your
> > patches come at a great time.
> > 
> > I'll try to get to reviewing/testing your work by the end of this week.
>
> I rebased your patches on linux-dm.git's 'for-next' (which includes what
> I've already staged for the 4.8 merge window).  And I folded/changed
> some of the DM patches so that there are only 2 now (1 for DM core and 1
> for dm-linear).  Please see the 4 topmost commits in my 'wip' here:
> 
> http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/log/?h=wip
> 
> Feel free to pick these patches up to use as the basis for continued
> work or re-posting of this set.. either that or I could post them as v2
> on your behalf.
> 
> As for testing, I've verified that basic IO works to a pmem-based DM
> linear device and that mixed table types are rejected as expected.

Great! I will send additional patch, add DAX support to dm-stripe, on top of
these once I finish my testing.

Thanks,
-Toshi

[PATCH v2 03/29] staging/lustre/llite: Get rid of ll_lock_dcache/ll_unlock_dcache

2016-06-20 Thread Oleg Drokin
These are just doing spin_lock/unlock on inode's i_lock,
so just do the spinlock directly to make the code more clear

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dcache.c |  4 ++--
 drivers/staging/lustre/lustre/llite/llite_internal.h | 10 --
 drivers/staging/lustre/lustre/llite/namei.c  |  8 
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index 9d13d5e..f002b3a 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -249,7 +249,7 @@ void ll_invalidate_aliases(struct inode *inode)
CDEBUG(D_INODE, "marking dentries for ino "DFID"(%p) invalid\n",
   PFID(ll_inode2fid(inode)), inode);
 
-   ll_lock_dcache(inode);
+   spin_lock(>i_lock);
hlist_for_each_entry(dentry, >i_dentry, d_u.d_alias) {
CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p 
flags %d\n",
   dentry, dentry, dentry->d_parent,
@@ -257,7 +257,7 @@ void ll_invalidate_aliases(struct inode *inode)
 
d_lustre_invalidate(dentry, 0);
}
-   ll_unlock_dcache(inode);
+   spin_unlock(>i_lock);
 }
 
 int ll_revalidate_it_finish(struct ptlrpc_request *request,
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 74cd241..098155f 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -1313,16 +1313,6 @@ static inline void ll_set_lock_data(struct obd_export 
*exp, struct inode *inode,
*bits = it->d.lustre.it_lock_bits;
 }
 
-static inline void ll_lock_dcache(struct inode *inode)
-{
-   spin_lock(>i_lock);
-}
-
-static inline void ll_unlock_dcache(struct inode *inode)
-{
-   spin_unlock(>i_lock);
-}
-
 static inline int d_lustre_invalid(const struct dentry *dentry)
 {
struct ll_dentry_data *lld = ll_d2d(dentry);
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 6414d52..e4df510 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -140,7 +140,7 @@ static void ll_invalidate_negative_children(struct inode 
*dir)
 {
struct dentry *dentry, *tmp_subdir;
 
-   ll_lock_dcache(dir);
+   spin_lock(>i_lock);
hlist_for_each_entry(dentry, >i_dentry, d_u.d_alias) {
spin_lock(>d_lock);
if (!list_empty(>d_subdirs)) {
@@ -155,7 +155,7 @@ static void ll_invalidate_negative_children(struct inode 
*dir)
}
spin_unlock(>d_lock);
}
-   ll_unlock_dcache(dir);
+   spin_unlock(>i_lock);
 }
 
 int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
@@ -317,7 +317,7 @@ static struct dentry *ll_find_alias(struct inode *inode, 
struct dentry *dentry)
discon_alias = NULL;
invalid_alias = NULL;
 
-   ll_lock_dcache(inode);
+   spin_lock(>i_lock);
hlist_for_each_entry(alias, >i_dentry, d_u.d_alias) {
LASSERT(alias != dentry);
 
@@ -342,7 +342,7 @@ static struct dentry *ll_find_alias(struct inode *inode, 
struct dentry *dentry)
dget_dlock(alias);
spin_unlock(>d_lock);
}
-   ll_unlock_dcache(inode);
+   spin_unlock(>i_lock);
 
return alias;
 }
-- 
2.7.4



Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices

2016-06-20 Thread Kani, Toshimitsu
On Mon, 2016-06-20 at 14:00 -0400, Mike Snitzer wrote:
> On Mon, Jun 13 2016 at  6:57pm -0400,
> Mike Snitzer  wrote:
> 
> > 
> > On Mon, Jun 13 2016 at  6:21pm -0400,
> > Toshi Kani  wrote:
> > 
> > > 
> > > This patch-set adds DAX support to device-mapper dm-linear devices
> > > used by LVM.  It works with LVM commands as follows:
> > >  - Creation of a logical volume with all DAX capable devices (such
> > >    as pmem) sets the logical volume DAX capable as well.
> > >  - Once a logical volume is set to DAX capable, the volume may not
> > >    be extended with non-DAX capable devices.
> > > 
> > > The direct_access interface is added to dm and dm-linear to map
> > > a request to a target device.
> > > 
> > >  - Patch 1-2 introduce GENHD_FL_DAX flag to indicate DAX capability.
> > >  - Patch 3-4 add direct_access functions to dm and dm-linear.
> > >  - Patch 5-6 set GENHD_FL_DAX to dm when all targets are DAX capable.
> > > 
> > > ---
> > > Toshi Kani (6):
> > >  1/6 genhd: Add GENHD_FL_DAX to gendisk flags
> > >  2/6 block: Check GENHD_FL_DAX for DAX capability
> > >  3/6 dm: Add dm_blk_direct_access() for mapped device
> > >  4/6 dm-linear: Add linear_direct_access()
> > >  5/6 dm, dm-linear: Add dax_supported to dm_target
> > >  6/6 dm: Enable DAX support for mapper device
> > Thanks a lot for doing this.  I recently added it to my TODO so your
> > patches come at a great time.
> > 
> > I'll try to get to reviewing/testing your work by the end of this week.
>
> I rebased your patches on linux-dm.git's 'for-next' (which includes what
> I've already staged for the 4.8 merge window).  And I folded/changed
> some of the DM patches so that there are only 2 now (1 for DM core and 1
> for dm-linear).  Please see the 4 topmost commits in my 'wip' here:
> 
> http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/log/?h=wip
> 
> Feel free to pick these patches up to use as the basis for continued
> work or re-posting of this set.. either that or I could post them as v2
> on your behalf.
> 
> As for testing, I've verified that basic IO works to a pmem-based DM
> linear device and that mixed table types are rejected as expected.

Great! I will send additional patch, add DAX support to dm-stripe, on top of
these once I finish my testing.

Thanks,
-Toshi

[PATCH v2 25/29] staging/lustre/osc: fix signed one bit field

2016-06-20 Thread Oleg Drokin
From: Dmitry Eremin 

Bit field 'oi_lockless' and 'oi_is_active' has one bit and is signed
which is confusing.

Signed-off-by: Dmitry Eremin 
Reviewed-on: http://review.whamcloud.com/19196
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7258
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Reviewed-by: Frank Zago 
Reviewed-by: John L. Hammond 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/osc_cl_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h 
b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
index 437c659..c8c3f1c 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
+++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
@@ -62,7 +62,7 @@ struct osc_io {
/** super class */
struct cl_io_slice oi_cl;
/** true if this io is lockless. */
-   int oi_lockless;
+   unsigned intoi_lockless;
/** how many LRU pages are reserved for this IO */
int oi_lru_reserved;
 
-- 
2.7.4



[PATCH v2 00/29] Lustre fixes

2016-06-20 Thread Oleg Drokin
Changes from v1:
This is rebased and retested on top of latest staging tree,
one patch dropped because it made it to the tree by other means,
two more fixes added.

These patches represent another round of Lustre fixes
and also a few cleanups that some of the fixes were
building up upon.

Alex Zhuravlev (1):
  staging/lustre: LDLM_DEBUG() shouldn't be passed \n

Andreas Dilger (1):
  staging: lustre: quiet lockdep recursive lock warning

Andriy Skulysh (1):
  staging/lustre/osc: glimpse lock should match only with granted locks

Ben Evans (1):
  staging/lustre/ptlrpc: Remove __ptlrpc_request_bufs_pack

Bob Glossman (1):
  staging/lustre: Add newline to LU_OBJECT_DEBUG() message

Bruno Faccini (1):
  staging/lustre/llite: lock i_lock before __d_drop()

Dmitry Eremin (1):
  staging/lustre/osc: fix signed one bit field

Emoly Liu (1):
  staging/lustre/llite: allocate and free client cache asynchronously

Jinshan Xiong (1):
  staging/lustre/osc: osc_lock_weight endless loop fix

John L. Hammond (4):
  staging/lustre/llite: correct request handling after ll_lookup_it()
  staging/lustre/llite: flatten struct lookup_intent
  staging/lustre/llite: change it_data to it_request
  staging/lustre/ldlm: const qualify struct lustre_handle * params

Liang Zhen (2):
  staging/lustre/ptlrpc: reorganize ptlrpc_request
  staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set

Niu Yawei (1):
  staging/lustre/mdc: Zero atime in close RPC

Oleg Drokin (7):
  staging/lustre/llite: Get rid of ll_lock_dcache/ll_unlock_dcache
  staging/lustre/osc: Fix reverted condition in osc_lock_weight
  staging/lustre: Inline Lustre intent disposition functions
  staging/lustre/llite: Restore proper opencache operations
  staging/lustre/llite: ll_revalidate_dentry update
  staging/lustre: Add documentation for unstable_stats in sysfs
  staging/lustre/libcfs: Do not call kthread_run in wrong state

Patrick Farrell (1):
  staging/lustre/llite: take trunc_sem only at vvp layer

Sergey Cheremencev (1):
  staging/lustre/llite: don't panic when fid is insane

Vitaly Fertman (2):
  staging/lustre/ptlrpc: Early Reply vs Reply MDunlink
  staging/lustre/ptlrpc: lost bulk leads to a hang

Yang Sheng (1):
  staging/lustre/llite: ensure obd is effective in onu_upcall

akam kumar bharathi (1):
  staging/lustre/llite: IOC_MDC_GETFILEINFO returns the wrong ino

 drivers/staging/lustre/lnet/libcfs/debug.c |   2 +-
 drivers/staging/lustre/lustre/include/cl_object.h  |  10 +-
 drivers/staging/lustre/lustre/include/lu_object.h  |   2 +-
 drivers/staging/lustre/lustre/include/lustre_dlm.h |  18 +-
 .../staging/lustre/lustre/include/lustre_intent.h  |  30 +-
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   3 -
 drivers/staging/lustre/lustre/include/lustre_net.h | 414 -
 drivers/staging/lustre/lustre/include/obd.h|   8 +-
 .../staging/lustre/lustre/include/obd_support.h|   3 +
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |  16 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|   5 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |   6 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   2 +-
 drivers/staging/lustre/lustre/llite/dcache.c   |  41 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   8 +-
 drivers/staging/lustre/lustre/llite/file.c |  66 ++--
 drivers/staging/lustre/lustre/llite/lcommon_misc.c |   8 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  27 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  47 +--
 drivers/staging/lustre/lustre/llite/llite_mmap.c   |   7 -
 drivers/staging/lustre/lustre/llite/llite_nfs.c|  18 +
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |   6 +-
 drivers/staging/lustre/lustre/llite/namei.c|  25 +-
 drivers/staging/lustre/lustre/llite/statahead.c|  10 +-
 drivers/staging/lustre/lustre/llite/xattr_cache.c  |  16 +-
 drivers/staging/lustre/lustre/lmv/lmv_intent.c |  26 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c|   8 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c|   7 +
 drivers/staging/lustre/lustre/lov/lov_object.c |   4 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c|  12 +
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |  93 ++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c|   2 +-
 drivers/staging/lustre/lustre/mgc/mgc_request.c|   4 +-
 drivers/staging/lustre/lustre/obdclass/cl_page.c   |  46 +++
 drivers/staging/lustre/lustre/osc/osc_cache.c  |   4 +-
 .../staging/lustre/lustre/osc/osc_cl_internal.h|   2 +-
 drivers/staging/lustre/lustre/osc/osc_lock.c   |  18 +-
 drivers/staging/lustre/lustre/osc/osc_page.c   |   4 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|  12 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 159 
 drivers/staging/lustre/lustre/ptlrpc/events.c  |  30 +-
 drivers/staging/lustre/lustre/ptlrpc/import.c  |   3 +-
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |  20 

[PATCH v2 23/29] staging/lustre/llite: ll_revalidate_dentry update

2016-06-20 Thread Oleg Drokin
From: Oleg Drokin 

There are a couple of cases in ll_revalidate_dentry() where
we are pretty sure the dentry is valid, so check for them early
and save more expensive checks for later.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dcache.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index d964f4f..581a63a 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -302,6 +302,17 @@ static int ll_revalidate_dentry(struct dentry *dentry,
 {
struct inode *dir = d_inode(dentry->d_parent);
 
+   /* If this is intermediate component path lookup and we were able to get
+* to this dentry, then its lock has not been revoked and the
+* path component is valid.
+*/
+   if (lookup_flags & LOOKUP_PARENT)
+   return 1;
+
+   /* Symlink - always valid as long as the dentry was found */
+   if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode))
+   return 1;
+
/*
 * if open is set, talk to MDS to make sure file is created if
 * necessary, because we can't do this in ->open() later since that's
-- 
2.7.4



[PATCH v2 23/29] staging/lustre/llite: ll_revalidate_dentry update

2016-06-20 Thread Oleg Drokin
From: Oleg Drokin 

There are a couple of cases in ll_revalidate_dentry() where
we are pretty sure the dentry is valid, so check for them early
and save more expensive checks for later.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dcache.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index d964f4f..581a63a 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -302,6 +302,17 @@ static int ll_revalidate_dentry(struct dentry *dentry,
 {
struct inode *dir = d_inode(dentry->d_parent);
 
+   /* If this is intermediate component path lookup and we were able to get
+* to this dentry, then its lock has not been revoked and the
+* path component is valid.
+*/
+   if (lookup_flags & LOOKUP_PARENT)
+   return 1;
+
+   /* Symlink - always valid as long as the dentry was found */
+   if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode))
+   return 1;
+
/*
 * if open is set, talk to MDS to make sure file is created if
 * necessary, because we can't do this in ->open() later since that's
-- 
2.7.4



[PATCH v2 02/29] staging/lustre/llite: correct request handling after ll_lookup_it()

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

In the FIFO cases of ll_atomic_open() and ll_lookup_nd() remove
spurious calls to ptlrpc_req_finished(). Explain that these cases are
unreachable in practice anyway.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17068
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7402
Reviewed-by: Dmitry Eremin 
Reviewed-by: Lai Siyao 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/namei.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index d7459bd..6414d52 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -622,13 +622,10 @@ static int ll_atomic_open(struct inode *dir, struct 
dentry *dentry,
if (d_really_is_positive(dentry) && it_disposition(it, 
DISP_OPEN_OPEN)) {
/* Open dentry. */
if (S_ISFIFO(d_inode(dentry)->i_mode)) {
-   /* We cannot call open here as it would
-* deadlock.
+   /* We cannot call open here as it might
+* deadlock. This case is unreachable in
+* practice because of OBD_CONNECT_NODEVOH.
 */
-   if (it_disposition(it, DISP_ENQ_OPEN_REF))
-   ptlrpc_req_finished(
-  (struct ptlrpc_request *)
- it->d.lustre.it_data);
rc = finish_no_open(file, de);
} else {
file->private_data = it;
-- 
2.7.4



[PATCH v2 02/29] staging/lustre/llite: correct request handling after ll_lookup_it()

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

In the FIFO cases of ll_atomic_open() and ll_lookup_nd() remove
spurious calls to ptlrpc_req_finished(). Explain that these cases are
unreachable in practice anyway.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17068
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7402
Reviewed-by: Dmitry Eremin 
Reviewed-by: Lai Siyao 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/namei.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index d7459bd..6414d52 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -622,13 +622,10 @@ static int ll_atomic_open(struct inode *dir, struct 
dentry *dentry,
if (d_really_is_positive(dentry) && it_disposition(it, 
DISP_OPEN_OPEN)) {
/* Open dentry. */
if (S_ISFIFO(d_inode(dentry)->i_mode)) {
-   /* We cannot call open here as it would
-* deadlock.
+   /* We cannot call open here as it might
+* deadlock. This case is unreachable in
+* practice because of OBD_CONNECT_NODEVOH.
 */
-   if (it_disposition(it, DISP_ENQ_OPEN_REF))
-   ptlrpc_req_finished(
-  (struct ptlrpc_request *)
- it->d.lustre.it_data);
rc = finish_no_open(file, de);
} else {
file->private_data = it;
-- 
2.7.4



[PATCH 0/4] MAINTAINERS: update BCM SoC entries

2016-06-20 Thread Jon Mason
An overall clean-up to the MAINTAINER entries for a few Broadcom SoCs.

Jon Mason (4):
  MAINTAINERS: Fix nsp false-positives
  MAINTAINERS: Add NS2 entry
  MAINTAINERS: Update BCM63XX entry
  MAINTAINERS: Update BCM281XX/BCM11XXX/BCM216XX entry

 MAINTAINERS | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

-- 
1.9.1



[PATCH 2/4] MAINTAINERS: Add NS2 entry

2016-06-20 Thread Jon Mason
Add NS2 to the Broadcom iProc Subsystem maintainers entry.  Since most
of the NS2 entries are already covered via the ns* already present
there, all that is currently needed is to reference the device tree
files.

Signed-off-by: Jon Mason 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 18b235a..81be402 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2612,6 +2612,7 @@ N:bcm583*
 N: bcm585*
 N: bcm586*
 N: bcm88312
+F: arch/arm64/boot/dts/broadcom/ns2*
 F: drivers/clk/bcm/clk-ns*
 F: drivers/pinctrl/bcm/pinctrl-ns*
 
-- 
1.9.1



[PATCH 0/4] MAINTAINERS: update BCM SoC entries

2016-06-20 Thread Jon Mason
An overall clean-up to the MAINTAINER entries for a few Broadcom SoCs.

Jon Mason (4):
  MAINTAINERS: Fix nsp false-positives
  MAINTAINERS: Add NS2 entry
  MAINTAINERS: Update BCM63XX entry
  MAINTAINERS: Update BCM281XX/BCM11XXX/BCM216XX entry

 MAINTAINERS | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

-- 
1.9.1



[PATCH 2/4] MAINTAINERS: Add NS2 entry

2016-06-20 Thread Jon Mason
Add NS2 to the Broadcom iProc Subsystem maintainers entry.  Since most
of the NS2 entries are already covered via the ns* already present
there, all that is currently needed is to reference the device tree
files.

Signed-off-by: Jon Mason 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 18b235a..81be402 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2612,6 +2612,7 @@ N:bcm583*
 N: bcm585*
 N: bcm586*
 N: bcm88312
+F: arch/arm64/boot/dts/broadcom/ns2*
 F: drivers/clk/bcm/clk-ns*
 F: drivers/pinctrl/bcm/pinctrl-ns*
 
-- 
1.9.1



[PATCH 1/4] MAINTAINERS: Fix nsp false-positives

2016-06-20 Thread Jon Mason
The 'nsp' regex pattern in the "BROADCOM IPROC ARM ARCHITECTURE" section
is getting unintended hits due to the common frequence of these letters
appearing in sequence.  To change the regex expression to be more
specific to the files we care about, add a "bcm" prefix to the regex and
add file entries for those that do not naturally match this new regex.

Signed-off-by: Jon Mason 
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7304d2e..18b235a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2601,7 +2601,7 @@ T:git git://github.com/broadcom/cygnus-linux.git
 S: Maintained
 N: iproc
 N: cygnus
-N: nsp
+N: bcm[-_]nsp
 N: bcm9113*
 N: bcm9583*
 N: bcm9585*
@@ -2612,6 +2612,8 @@ N:bcm583*
 N: bcm585*
 N: bcm586*
 N: bcm88312
+F: drivers/clk/bcm/clk-ns*
+F: drivers/pinctrl/bcm/pinctrl-ns*
 
 BROADCOM BRCMSTB GPIO DRIVER
 M: Gregory Fong 
-- 
1.9.1



[PATCH v2 26/29] staging/lustre: Add documentation for unstable_stats in sysfs

2016-06-20 Thread Oleg Drokin
commit ac5b14810952 ("staging: lustre: osc: Track and limit
"unstable" pages") added a new sysfs variable, but corresponding bit of
documentation was not forgotten.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/sysfs-fs-lustre | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/lustre/sysfs-fs-lustre 
b/drivers/staging/lustre/sysfs-fs-lustre
index 873e2cf..20206ba 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -294,6 +294,14 @@ Description:
Controls extended attributes client-side cache.
1 to enable, 0 to disable.
 
+What:  /sys/fs/lustre/llite/-/unstable_stats
+Date:  Apr 2016
+Contact:   "Oleg Drokin" 
+Description:
+   Shows number of pages that were sent and acknowledged by
+   server but were not yet committed and therefore still
+   pinned in client memory even though no longer dirty.
+
 What:  /sys/fs/lustre/ldlm/cancel_unused_locks_before_replay
 Date:  May 2015
 Contact:   "Oleg Drokin" 
-- 
2.7.4



[PATCH 1/4] MAINTAINERS: Fix nsp false-positives

2016-06-20 Thread Jon Mason
The 'nsp' regex pattern in the "BROADCOM IPROC ARM ARCHITECTURE" section
is getting unintended hits due to the common frequence of these letters
appearing in sequence.  To change the regex expression to be more
specific to the files we care about, add a "bcm" prefix to the regex and
add file entries for those that do not naturally match this new regex.

Signed-off-by: Jon Mason 
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7304d2e..18b235a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2601,7 +2601,7 @@ T:git git://github.com/broadcom/cygnus-linux.git
 S: Maintained
 N: iproc
 N: cygnus
-N: nsp
+N: bcm[-_]nsp
 N: bcm9113*
 N: bcm9583*
 N: bcm9585*
@@ -2612,6 +2612,8 @@ N:bcm583*
 N: bcm585*
 N: bcm586*
 N: bcm88312
+F: drivers/clk/bcm/clk-ns*
+F: drivers/pinctrl/bcm/pinctrl-ns*
 
 BROADCOM BRCMSTB GPIO DRIVER
 M: Gregory Fong 
-- 
1.9.1



[PATCH v2 26/29] staging/lustre: Add documentation for unstable_stats in sysfs

2016-06-20 Thread Oleg Drokin
commit ac5b14810952 ("staging: lustre: osc: Track and limit
"unstable" pages") added a new sysfs variable, but corresponding bit of
documentation was not forgotten.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/sysfs-fs-lustre | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/lustre/sysfs-fs-lustre 
b/drivers/staging/lustre/sysfs-fs-lustre
index 873e2cf..20206ba 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -294,6 +294,14 @@ Description:
Controls extended attributes client-side cache.
1 to enable, 0 to disable.
 
+What:  /sys/fs/lustre/llite/-/unstable_stats
+Date:  Apr 2016
+Contact:   "Oleg Drokin" 
+Description:
+   Shows number of pages that were sent and acknowledged by
+   server but were not yet committed and therefore still
+   pinned in client memory even though no longer dirty.
+
 What:  /sys/fs/lustre/ldlm/cancel_unused_locks_before_replay
 Date:  May 2015
 Contact:   "Oleg Drokin" 
-- 
2.7.4



[PATCH v2 16/29] staging/lustre: Inline Lustre intent disposition functions

2016-06-20 Thread Oleg Drokin
They are just one-liners, so no point in having them exported
and called through a different module.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_intent.h | 15 +++
 drivers/staging/lustre/lustre/include/lustre_mdc.h|  3 ---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c | 18 --
 3 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h 
b/drivers/staging/lustre/lustre/include/lustre_intent.h
index 41c03d7..3aed810 100644
--- a/drivers/staging/lustre/lustre/include/lustre_intent.h
+++ b/drivers/staging/lustre/lustre/include/lustre_intent.h
@@ -50,4 +50,19 @@ struct lookup_intent {
unsigned intit_lock_set:1;
 };
 
+static inline int it_disposition(struct lookup_intent *it, int flag)
+{
+   return it->it_disposition & flag;
+}
+
+static inline void it_set_disposition(struct lookup_intent *it, int flag)
+{
+   it->it_disposition |= flag;
+}
+
+static inline void it_clear_disposition(struct lookup_intent *it, int flag)
+{
+   it->it_disposition &= ~flag;
+}
+
 #endif
diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h 
b/drivers/staging/lustre/lustre/include/lustre_mdc.h
index 0ef4226..fa62b95 100644
--- a/drivers/staging/lustre/lustre/include/lustre_mdc.h
+++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h
@@ -185,9 +185,6 @@ struct mdc_cache_waiter {
 };
 
 /* mdc/mdc_locks.c */
-int it_disposition(struct lookup_intent *it, int flag);
-void it_clear_disposition(struct lookup_intent *it, int flag);
-void it_set_disposition(struct lookup_intent *it, int flag);
 int it_open_error(int phase, struct lookup_intent *it);
 
 static inline bool cl_is_lov_delay_create(unsigned int flags)
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 5da2a1e..c43b3a2 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -50,24 +50,6 @@ struct mdc_getattr_args {
struct ldlm_enqueue_info*ga_einfo;
 };
 
-int it_disposition(struct lookup_intent *it, int flag)
-{
-   return it->it_disposition & flag;
-}
-EXPORT_SYMBOL(it_disposition);
-
-void it_set_disposition(struct lookup_intent *it, int flag)
-{
-   it->it_disposition |= flag;
-}
-EXPORT_SYMBOL(it_set_disposition);
-
-void it_clear_disposition(struct lookup_intent *it, int flag)
-{
-   it->it_disposition &= ~flag;
-}
-EXPORT_SYMBOL(it_clear_disposition);
-
 int it_open_error(int phase, struct lookup_intent *it)
 {
if (it_disposition(it, DISP_OPEN_LEASE)) {
-- 
2.7.4



[PATCH v2 16/29] staging/lustre: Inline Lustre intent disposition functions

2016-06-20 Thread Oleg Drokin
They are just one-liners, so no point in having them exported
and called through a different module.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_intent.h | 15 +++
 drivers/staging/lustre/lustre/include/lustre_mdc.h|  3 ---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c | 18 --
 3 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h 
b/drivers/staging/lustre/lustre/include/lustre_intent.h
index 41c03d7..3aed810 100644
--- a/drivers/staging/lustre/lustre/include/lustre_intent.h
+++ b/drivers/staging/lustre/lustre/include/lustre_intent.h
@@ -50,4 +50,19 @@ struct lookup_intent {
unsigned intit_lock_set:1;
 };
 
+static inline int it_disposition(struct lookup_intent *it, int flag)
+{
+   return it->it_disposition & flag;
+}
+
+static inline void it_set_disposition(struct lookup_intent *it, int flag)
+{
+   it->it_disposition |= flag;
+}
+
+static inline void it_clear_disposition(struct lookup_intent *it, int flag)
+{
+   it->it_disposition &= ~flag;
+}
+
 #endif
diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h 
b/drivers/staging/lustre/lustre/include/lustre_mdc.h
index 0ef4226..fa62b95 100644
--- a/drivers/staging/lustre/lustre/include/lustre_mdc.h
+++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h
@@ -185,9 +185,6 @@ struct mdc_cache_waiter {
 };
 
 /* mdc/mdc_locks.c */
-int it_disposition(struct lookup_intent *it, int flag);
-void it_clear_disposition(struct lookup_intent *it, int flag);
-void it_set_disposition(struct lookup_intent *it, int flag);
 int it_open_error(int phase, struct lookup_intent *it);
 
 static inline bool cl_is_lov_delay_create(unsigned int flags)
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 5da2a1e..c43b3a2 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -50,24 +50,6 @@ struct mdc_getattr_args {
struct ldlm_enqueue_info*ga_einfo;
 };
 
-int it_disposition(struct lookup_intent *it, int flag)
-{
-   return it->it_disposition & flag;
-}
-EXPORT_SYMBOL(it_disposition);
-
-void it_set_disposition(struct lookup_intent *it, int flag)
-{
-   it->it_disposition |= flag;
-}
-EXPORT_SYMBOL(it_set_disposition);
-
-void it_clear_disposition(struct lookup_intent *it, int flag)
-{
-   it->it_disposition &= ~flag;
-}
-EXPORT_SYMBOL(it_clear_disposition);
-
 int it_open_error(int phase, struct lookup_intent *it)
 {
if (it_disposition(it, DISP_OPEN_LEASE)) {
-- 
2.7.4



[PATCH v2 11/29] staging/lustre/ptlrpc: lost bulk leads to a hang

2016-06-20 Thread Oleg Drokin
From: Vitaly Fertman 

The reverse order of request_out_callback() and reply_in_callback()
puts the RPC into UNREGISTERING state, which is waiting for RPC &
bulk md unlink, whereas only RPC md unlink has been called so far.
If bulk is lost, even expired_set does not check for UNREGISTERING
state.

The same for write if server returns an error.

This phase is ambiguous, split to UNREG_RPC and UNREG_BULK.

Signed-off-by: Vitaly Fertman 
Seagate-bug-id:  MRP-2953, MRP-3206
Reviewed-by: Andriy Skulysh 
Reviewed-by: Alexey Leonidovich Lyashkov 
Tested-by: Elena V. Gryaznova 
Reviewed-on: http://review.whamcloud.com/19953
Reviewed-by: Chris Horn 
Reviewed-by: Ann Koehler 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h | 48 +---
 .../staging/lustre/lustre/include/obd_support.h|  3 +
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 64 +++---
 drivers/staging/lustre/lustre/ptlrpc/import.c  |  3 +-
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |  4 +-
 5 files changed, 91 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 523d082..3f43664 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -480,8 +480,9 @@ enum rq_phase {
RQ_PHASE_BULK  = 0xebc0de02,
RQ_PHASE_INTERPRET  = 0xebc0de03,
RQ_PHASE_COMPLETE   = 0xebc0de04,
-   RQ_PHASE_UNREGISTERING  = 0xebc0de05,
-   RQ_PHASE_UNDEFINED  = 0xebc0de06
+   RQ_PHASE_UNREG_RPC  = 0xebc0de05,
+   RQ_PHASE_UNREG_BULK = 0xebc0de06,
+   RQ_PHASE_UNDEFINED  = 0xebc0de07
 };
 
 /** Type of request interpreter call-back */
@@ -1263,6 +1264,8 @@ struct ptlrpc_cli_req {
time_t   cr_reply_deadline;
/** when req bulk unlink must finish. */
time_t   cr_bulk_deadline;
+   /** when req unlink must finish. */
+   time_t   cr_req_deadline;
/** Portal to which this request would be sent */
shortcr_req_ptl;
/** Portal where to wait for reply and where reply would be sent */
@@ -1318,6 +1321,7 @@ struct ptlrpc_cli_req {
 #define rq_real_sent   rq_cli.cr_sent_out
 #define rq_reply_deadline  rq_cli.cr_reply_deadline
 #define rq_bulk_deadline   rq_cli.cr_bulk_deadline
+#define rq_req_deadlinerq_cli.cr_req_deadline
 #define rq_nr_resend   rq_cli.cr_resend_nr
 #define rq_request_portal  rq_cli.cr_req_ptl
 #define rq_reply_portalrq_cli.cr_rep_ptl
@@ -1693,8 +1697,10 @@ ptlrpc_phase2str(enum rq_phase phase)
return "Interpret";
case RQ_PHASE_COMPLETE:
return "Complete";
-   case RQ_PHASE_UNREGISTERING:
-   return "Unregistering";
+   case RQ_PHASE_UNREG_RPC:
+   return "UnregRPC";
+   case RQ_PHASE_UNREG_BULK:
+   return "UnregBULK";
default:
return "?Phase?";
}
@@ -1721,7 +1727,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req)
 #define DEBUG_REQ_FLAGS(req)   \
ptlrpc_rqphase2str(req),
\
FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"),\
-   FLAG(req->rq_err, "E"),  \
+   FLAG(req->rq_err, "E"), FLAG(req->rq_net_err, "e"), \
FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"),   
\
FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"),\
FLAG(req->rq_no_resend, "N"),  \
@@ -1729,7 +1735,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req)
FLAG(req->rq_wait_ctx, "C"), FLAG(req->rq_hp, "H"),  \
FLAG(req->rq_committed, "M")
 
-#define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s"
+#define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s%s"
 
 void _debug_req(struct ptlrpc_request *req,
struct libcfs_debug_msg_data *data, const char *fmt, ...)
@@ -2380,8 +2386,7 @@ static inline int ptlrpc_client_bulk_active(struct 
ptlrpc_request *req)
 
desc = req->rq_bulk;
 
-   if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_BULK_UNLINK) &&
-   req->rq_bulk_deadline > ktime_get_real_seconds())
+   if (req->rq_bulk_deadline > ktime_get_real_seconds())
return 1;
 
if (!desc)
@@ -2728,13 +2733,20 @@ ptlrpc_rqphase_move(struct ptlrpc_request *req, enum 
rq_phase 

[PATCH v2 11/29] staging/lustre/ptlrpc: lost bulk leads to a hang

2016-06-20 Thread Oleg Drokin
From: Vitaly Fertman 

The reverse order of request_out_callback() and reply_in_callback()
puts the RPC into UNREGISTERING state, which is waiting for RPC &
bulk md unlink, whereas only RPC md unlink has been called so far.
If bulk is lost, even expired_set does not check for UNREGISTERING
state.

The same for write if server returns an error.

This phase is ambiguous, split to UNREG_RPC and UNREG_BULK.

Signed-off-by: Vitaly Fertman 
Seagate-bug-id:  MRP-2953, MRP-3206
Reviewed-by: Andriy Skulysh 
Reviewed-by: Alexey Leonidovich Lyashkov 
Tested-by: Elena V. Gryaznova 
Reviewed-on: http://review.whamcloud.com/19953
Reviewed-by: Chris Horn 
Reviewed-by: Ann Koehler 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h | 48 +---
 .../staging/lustre/lustre/include/obd_support.h|  3 +
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 64 +++---
 drivers/staging/lustre/lustre/ptlrpc/import.c  |  3 +-
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |  4 +-
 5 files changed, 91 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 523d082..3f43664 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -480,8 +480,9 @@ enum rq_phase {
RQ_PHASE_BULK  = 0xebc0de02,
RQ_PHASE_INTERPRET  = 0xebc0de03,
RQ_PHASE_COMPLETE   = 0xebc0de04,
-   RQ_PHASE_UNREGISTERING  = 0xebc0de05,
-   RQ_PHASE_UNDEFINED  = 0xebc0de06
+   RQ_PHASE_UNREG_RPC  = 0xebc0de05,
+   RQ_PHASE_UNREG_BULK = 0xebc0de06,
+   RQ_PHASE_UNDEFINED  = 0xebc0de07
 };
 
 /** Type of request interpreter call-back */
@@ -1263,6 +1264,8 @@ struct ptlrpc_cli_req {
time_t   cr_reply_deadline;
/** when req bulk unlink must finish. */
time_t   cr_bulk_deadline;
+   /** when req unlink must finish. */
+   time_t   cr_req_deadline;
/** Portal to which this request would be sent */
shortcr_req_ptl;
/** Portal where to wait for reply and where reply would be sent */
@@ -1318,6 +1321,7 @@ struct ptlrpc_cli_req {
 #define rq_real_sent   rq_cli.cr_sent_out
 #define rq_reply_deadline  rq_cli.cr_reply_deadline
 #define rq_bulk_deadline   rq_cli.cr_bulk_deadline
+#define rq_req_deadlinerq_cli.cr_req_deadline
 #define rq_nr_resend   rq_cli.cr_resend_nr
 #define rq_request_portal  rq_cli.cr_req_ptl
 #define rq_reply_portalrq_cli.cr_rep_ptl
@@ -1693,8 +1697,10 @@ ptlrpc_phase2str(enum rq_phase phase)
return "Interpret";
case RQ_PHASE_COMPLETE:
return "Complete";
-   case RQ_PHASE_UNREGISTERING:
-   return "Unregistering";
+   case RQ_PHASE_UNREG_RPC:
+   return "UnregRPC";
+   case RQ_PHASE_UNREG_BULK:
+   return "UnregBULK";
default:
return "?Phase?";
}
@@ -1721,7 +1727,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req)
 #define DEBUG_REQ_FLAGS(req)   \
ptlrpc_rqphase2str(req),
\
FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"),\
-   FLAG(req->rq_err, "E"),  \
+   FLAG(req->rq_err, "E"), FLAG(req->rq_net_err, "e"), \
FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"),   
\
FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"),\
FLAG(req->rq_no_resend, "N"),  \
@@ -1729,7 +1735,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req)
FLAG(req->rq_wait_ctx, "C"), FLAG(req->rq_hp, "H"),  \
FLAG(req->rq_committed, "M")
 
-#define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s"
+#define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s%s"
 
 void _debug_req(struct ptlrpc_request *req,
struct libcfs_debug_msg_data *data, const char *fmt, ...)
@@ -2380,8 +2386,7 @@ static inline int ptlrpc_client_bulk_active(struct 
ptlrpc_request *req)
 
desc = req->rq_bulk;
 
-   if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_BULK_UNLINK) &&
-   req->rq_bulk_deadline > ktime_get_real_seconds())
+   if (req->rq_bulk_deadline > ktime_get_real_seconds())
return 1;
 
if (!desc)
@@ -2728,13 +2733,20 @@ ptlrpc_rqphase_move(struct ptlrpc_request *req, enum 
rq_phase new_phase)
if (req->rq_phase == new_phase)
return;
 
-   if (new_phase == RQ_PHASE_UNREGISTERING) {
+   if (new_phase == RQ_PHASE_UNREG_RPC ||
+   new_phase == RQ_PHASE_UNREG_BULK) {
+   

[PATCH v2 13/29] staging/lustre: LDLM_DEBUG() shouldn't be passed \n

2016-06-20 Thread Oleg Drokin
From: Alex Zhuravlev 

as it adds own \n, so any extra \n break log format.

Signed-off-by: Alex Zhuravlev 
Reviewed-on: http://review.whamcloud.com/17494
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7521
Reviewed-by: James Simmons 
Reviewed-by: John L. Hammond 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c| 3 ++-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +-
 drivers/staging/lustre/lustre/lov/lov_object.c | 4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  | 2 +-
 drivers/staging/lustre/lustre/osc/osc_cache.c  | 4 ++--
 drivers/staging/lustre/lustre/osc/osc_lock.c   | 2 +-
 8 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index 1ecdfa2..b7254eb 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -1440,7 +1440,7 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct 
req_capsule *pill,
memcpy(data, lvb, size);
break;
default:
-   LDLM_ERROR(lock, "Unknown LVB type: %d\n", lock->l_lvb_type);
+   LDLM_ERROR(lock, "Unknown LVB type: %d", lock->l_lvb_type);
dump_stack();
return -EINVAL;
}
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index 3eab059..8294703 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -637,7 +637,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 */
if ((ldlm_is_canceling(lock) && ldlm_is_bl_done(lock)) ||
ldlm_is_failed(lock)) {
-   LDLM_DEBUG(lock, "callback on lock %#llx - lock 
disappeared\n",
+   LDLM_DEBUG(lock,
+  "callback on lock %#llx - lock disappeared",
   dlm_req->lock_handle[0].cookie);
unlock_res_and_lock(lock);
LDLM_LOCK_RELEASE(lock);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index 471ab08..d3a376e 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -711,7 +711,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct 
ptlrpc_request **reqp,
 
lock->l_req_extent = policy->l_extent;
}
-   LDLM_DEBUG(lock, "client-side enqueue START, flags %llx\n",
+   LDLM_DEBUG(lock, "client-side enqueue START, flags %llx",
   *flags);
}
 
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index f7c95b7..51a28d9 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -1275,7 +1275,7 @@ void ldlm_resource_add_lock(struct ldlm_resource *res, 
struct list_head *head,
 {
check_res_locked(res);
 
-   LDLM_DEBUG(lock, "About to add this lock:\n");
+   LDLM_DEBUG(lock, "About to add this lock:");
 
if (ldlm_is_destroyed(lock)) {
CDEBUG(D_OTHER, "Lock destroyed, not adding to resource\n");
diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c 
b/drivers/staging/lustre/lustre/lov/lov_object.c
index ec55b88..f9621b0 100644
--- a/drivers/staging/lustre/lustre/lov/lov_object.c
+++ b/drivers/staging/lustre/lustre/lov/lov_object.c
@@ -181,8 +181,8 @@ static int lov_init_sub(const struct lu_env *env, struct 
lov_object *lov,
}
 
LU_OBJECT_DEBUG(mask, env, >co_lu,
-   "stripe %d is already owned.\n", idx);
-   LU_OBJECT_DEBUG(mask, env, old_obj, "owned.\n");
+   "stripe %d is already owned.", idx);
+   LU_OBJECT_DEBUG(mask, env, old_obj, "owned.");
LU_OBJECT_HEADER(mask, env, lov2lu(lov), "try to own.\n");
cl_object_put(env, stripe);
}
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index b395420..19b549c 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -711,7 +711,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
if (lock && ldlm_has_layout(lock) && lvb_data) {
void *lmm;
 
-   

[PATCH v2 13/29] staging/lustre: LDLM_DEBUG() shouldn't be passed \n

2016-06-20 Thread Oleg Drokin
From: Alex Zhuravlev 

as it adds own \n, so any extra \n break log format.

Signed-off-by: Alex Zhuravlev 
Reviewed-on: http://review.whamcloud.com/17494
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7521
Reviewed-by: James Simmons 
Reviewed-by: John L. Hammond 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c| 3 ++-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +-
 drivers/staging/lustre/lustre/lov/lov_object.c | 4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  | 2 +-
 drivers/staging/lustre/lustre/osc/osc_cache.c  | 4 ++--
 drivers/staging/lustre/lustre/osc/osc_lock.c   | 2 +-
 8 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index 1ecdfa2..b7254eb 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -1440,7 +1440,7 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct 
req_capsule *pill,
memcpy(data, lvb, size);
break;
default:
-   LDLM_ERROR(lock, "Unknown LVB type: %d\n", lock->l_lvb_type);
+   LDLM_ERROR(lock, "Unknown LVB type: %d", lock->l_lvb_type);
dump_stack();
return -EINVAL;
}
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index 3eab059..8294703 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -637,7 +637,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 */
if ((ldlm_is_canceling(lock) && ldlm_is_bl_done(lock)) ||
ldlm_is_failed(lock)) {
-   LDLM_DEBUG(lock, "callback on lock %#llx - lock 
disappeared\n",
+   LDLM_DEBUG(lock,
+  "callback on lock %#llx - lock disappeared",
   dlm_req->lock_handle[0].cookie);
unlock_res_and_lock(lock);
LDLM_LOCK_RELEASE(lock);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index 471ab08..d3a376e 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -711,7 +711,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct 
ptlrpc_request **reqp,
 
lock->l_req_extent = policy->l_extent;
}
-   LDLM_DEBUG(lock, "client-side enqueue START, flags %llx\n",
+   LDLM_DEBUG(lock, "client-side enqueue START, flags %llx",
   *flags);
}
 
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index f7c95b7..51a28d9 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -1275,7 +1275,7 @@ void ldlm_resource_add_lock(struct ldlm_resource *res, 
struct list_head *head,
 {
check_res_locked(res);
 
-   LDLM_DEBUG(lock, "About to add this lock:\n");
+   LDLM_DEBUG(lock, "About to add this lock:");
 
if (ldlm_is_destroyed(lock)) {
CDEBUG(D_OTHER, "Lock destroyed, not adding to resource\n");
diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c 
b/drivers/staging/lustre/lustre/lov/lov_object.c
index ec55b88..f9621b0 100644
--- a/drivers/staging/lustre/lustre/lov/lov_object.c
+++ b/drivers/staging/lustre/lustre/lov/lov_object.c
@@ -181,8 +181,8 @@ static int lov_init_sub(const struct lu_env *env, struct 
lov_object *lov,
}
 
LU_OBJECT_DEBUG(mask, env, >co_lu,
-   "stripe %d is already owned.\n", idx);
-   LU_OBJECT_DEBUG(mask, env, old_obj, "owned.\n");
+   "stripe %d is already owned.", idx);
+   LU_OBJECT_DEBUG(mask, env, old_obj, "owned.");
LU_OBJECT_HEADER(mask, env, lov2lu(lov), "try to own.\n");
cl_object_put(env, stripe);
}
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index b395420..19b549c 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -711,7 +711,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
if (lock && ldlm_has_layout(lock) && lvb_data) {
void *lmm;
 
-   LDLM_DEBUG(lock, "layout lock returned by: %s, lvb_len: %d\n",
+   LDLM_DEBUG(lock, "layout lock returned by: %s, lvb_len: %d",
   

[PATCH v2 15/29] staging/lustre/llite: flatten struct lookup_intent

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

Replace the union in struct lookup_intent with the members of struct
lustre_indent_data. Remove the then unused struct lustre_intent_data.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17069
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
Reviewed-by: James Simmons 
Reviewed-by: Dmitry Eremin 
Reviewed-by: Frank Zago 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre_intent.h  | 15 ++--
 drivers/staging/lustre/lustre/llite/dcache.c   | 26 +++
 drivers/staging/lustre/lustre/llite/dir.c  |  4 +-
 drivers/staging/lustre/lustre/llite/file.c | 44 ++--
 .../staging/lustre/lustre/llite/llite_internal.h   | 14 ++--
 drivers/staging/lustre/lustre/llite/llite_lib.c|  4 +-
 drivers/staging/lustre/lustre/llite/namei.c|  8 +--
 drivers/staging/lustre/lustre/llite/statahead.c| 10 +--
 drivers/staging/lustre/lustre/llite/xattr_cache.c  | 16 ++---
 drivers/staging/lustre/lustre/lmv/lmv_intent.c | 26 +++
 drivers/staging/lustre/lustre/lmv/lmv_obd.c|  8 +--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  | 79 +++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c|  2 +-
 13 files changed, 125 insertions(+), 131 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h 
b/drivers/staging/lustre/lustre/include/lustre_intent.h
index fdc6236..41c03d7 100644
--- a/drivers/staging/lustre/lustre/include/lustre_intent.h
+++ b/drivers/staging/lustre/lustre/include/lustre_intent.h
@@ -34,7 +34,11 @@
 #define LUSTRE_INTENT_H
 
 /* intent IT_XXX are defined in lustre/include/obd.h */
-struct lustre_intent_data {
+
+struct lookup_intent {
+   int it_op;
+   int it_create_mode;
+   __u64   it_flags;
int it_disposition;
int it_status;
__u64   it_lock_handle;
@@ -46,13 +50,4 @@ struct lustre_intent_data {
unsigned intit_lock_set:1;
 };
 
-struct lookup_intent {
-   int it_op;
-   int it_create_mode;
-   __u64   it_flags;
-   union {
-   struct lustre_intent_data lustre;
-   } d;
-};
-
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index f002b3a..c5789f7 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -202,27 +202,27 @@ int ll_d_init(struct dentry *de)
 
 void ll_intent_drop_lock(struct lookup_intent *it)
 {
-   if (it->it_op && it->d.lustre.it_lock_mode) {
+   if (it->it_op && it->it_lock_mode) {
struct lustre_handle handle;
 
-   handle.cookie = it->d.lustre.it_lock_handle;
+   handle.cookie = it->it_lock_handle;
 
CDEBUG(D_DLMTRACE, "releasing lock with cookie %#llx from it 
%p\n",
   handle.cookie, it);
-   ldlm_lock_decref(, it->d.lustre.it_lock_mode);
+   ldlm_lock_decref(, it->it_lock_mode);
 
/* bug 494: intent_release may be called multiple times, from
 * this thread and we don't want to double-decref this lock
 */
-   it->d.lustre.it_lock_mode = 0;
-   if (it->d.lustre.it_remote_lock_mode != 0) {
-   handle.cookie = it->d.lustre.it_remote_lock_handle;
+   it->it_lock_mode = 0;
+   if (it->it_remote_lock_mode != 0) {
+   handle.cookie = it->it_remote_lock_handle;
 
CDEBUG(D_DLMTRACE, "releasing remote lock with 
cookie%#llx from it %p\n",
   handle.cookie, it);
ldlm_lock_decref(,
-it->d.lustre.it_remote_lock_mode);
-   it->d.lustre.it_remote_lock_mode = 0;
+it->it_remote_lock_mode);
+   it->it_remote_lock_mode = 0;
}
}
 }
@@ -233,13 +233,13 @@ void ll_intent_release(struct lookup_intent *it)
ll_intent_drop_lock(it);
/* We are still holding extra reference on a request, need to free it */
if (it_disposition(it, DISP_ENQ_OPEN_REF))
-   ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */
+   ptlrpc_req_finished(it->it_data); /* ll_file_open */
 
if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */
-   ptlrpc_req_finished(it->d.lustre.it_data);
+   ptlrpc_req_finished(it->it_data);
 
-   it->d.lustre.it_disposition = 0;
-   it->d.lustre.it_data = NULL;
+   it->it_disposition = 0;
+   it->it_data = NULL;
 }
 
 void ll_invalidate_aliases(struct inode *inode)
@@ -279,7 

[PATCH v2 15/29] staging/lustre/llite: flatten struct lookup_intent

2016-06-20 Thread Oleg Drokin
From: "John L. Hammond" 

Replace the union in struct lookup_intent with the members of struct
lustre_indent_data. Remove the then unused struct lustre_intent_data.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/17069
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
Reviewed-by: James Simmons 
Reviewed-by: Dmitry Eremin 
Reviewed-by: Frank Zago 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre_intent.h  | 15 ++--
 drivers/staging/lustre/lustre/llite/dcache.c   | 26 +++
 drivers/staging/lustre/lustre/llite/dir.c  |  4 +-
 drivers/staging/lustre/lustre/llite/file.c | 44 ++--
 .../staging/lustre/lustre/llite/llite_internal.h   | 14 ++--
 drivers/staging/lustre/lustre/llite/llite_lib.c|  4 +-
 drivers/staging/lustre/lustre/llite/namei.c|  8 +--
 drivers/staging/lustre/lustre/llite/statahead.c| 10 +--
 drivers/staging/lustre/lustre/llite/xattr_cache.c  | 16 ++---
 drivers/staging/lustre/lustre/lmv/lmv_intent.c | 26 +++
 drivers/staging/lustre/lustre/lmv/lmv_obd.c|  8 +--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  | 79 +++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c|  2 +-
 13 files changed, 125 insertions(+), 131 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h 
b/drivers/staging/lustre/lustre/include/lustre_intent.h
index fdc6236..41c03d7 100644
--- a/drivers/staging/lustre/lustre/include/lustre_intent.h
+++ b/drivers/staging/lustre/lustre/include/lustre_intent.h
@@ -34,7 +34,11 @@
 #define LUSTRE_INTENT_H
 
 /* intent IT_XXX are defined in lustre/include/obd.h */
-struct lustre_intent_data {
+
+struct lookup_intent {
+   int it_op;
+   int it_create_mode;
+   __u64   it_flags;
int it_disposition;
int it_status;
__u64   it_lock_handle;
@@ -46,13 +50,4 @@ struct lustre_intent_data {
unsigned intit_lock_set:1;
 };
 
-struct lookup_intent {
-   int it_op;
-   int it_create_mode;
-   __u64   it_flags;
-   union {
-   struct lustre_intent_data lustre;
-   } d;
-};
-
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index f002b3a..c5789f7 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -202,27 +202,27 @@ int ll_d_init(struct dentry *de)
 
 void ll_intent_drop_lock(struct lookup_intent *it)
 {
-   if (it->it_op && it->d.lustre.it_lock_mode) {
+   if (it->it_op && it->it_lock_mode) {
struct lustre_handle handle;
 
-   handle.cookie = it->d.lustre.it_lock_handle;
+   handle.cookie = it->it_lock_handle;
 
CDEBUG(D_DLMTRACE, "releasing lock with cookie %#llx from it 
%p\n",
   handle.cookie, it);
-   ldlm_lock_decref(, it->d.lustre.it_lock_mode);
+   ldlm_lock_decref(, it->it_lock_mode);
 
/* bug 494: intent_release may be called multiple times, from
 * this thread and we don't want to double-decref this lock
 */
-   it->d.lustre.it_lock_mode = 0;
-   if (it->d.lustre.it_remote_lock_mode != 0) {
-   handle.cookie = it->d.lustre.it_remote_lock_handle;
+   it->it_lock_mode = 0;
+   if (it->it_remote_lock_mode != 0) {
+   handle.cookie = it->it_remote_lock_handle;
 
CDEBUG(D_DLMTRACE, "releasing remote lock with 
cookie%#llx from it %p\n",
   handle.cookie, it);
ldlm_lock_decref(,
-it->d.lustre.it_remote_lock_mode);
-   it->d.lustre.it_remote_lock_mode = 0;
+it->it_remote_lock_mode);
+   it->it_remote_lock_mode = 0;
}
}
 }
@@ -233,13 +233,13 @@ void ll_intent_release(struct lookup_intent *it)
ll_intent_drop_lock(it);
/* We are still holding extra reference on a request, need to free it */
if (it_disposition(it, DISP_ENQ_OPEN_REF))
-   ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */
+   ptlrpc_req_finished(it->it_data); /* ll_file_open */
 
if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */
-   ptlrpc_req_finished(it->d.lustre.it_data);
+   ptlrpc_req_finished(it->it_data);
 
-   it->d.lustre.it_disposition = 0;
-   it->d.lustre.it_data = NULL;
+   it->it_disposition = 0;
+   it->it_data = NULL;
 }
 
 void ll_invalidate_aliases(struct inode *inode)
@@ -279,7 +279,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,
 
 void ll_lookup_finish_locks(struct lookup_intent *it, 

[PATCH v2 10/29] staging/lustre/ptlrpc: Remove __ptlrpc_request_bufs_pack

2016-06-20 Thread Oleg Drokin
From: Ben Evans 

Combine __ptlrpc_request_bufs_pack into ptlrpc_request_bufs_pack
because it was an unnecessary wrapper otherwise.

Signed-off-by: Ben Evans 
Reviewed-on: http://review.whamcloud.com/16765
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7269
Reviewed-by: Frank Zago 
Reviewed-by: Andreas Dilger 
Reviewed-by: John L. Hammond 
Reviewed-by: Chris Horn 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c | 34 ++-
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index ae1cef3..5d832eb 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -583,14 +583,19 @@ static void __ptlrpc_free_req_to_pool(struct 
ptlrpc_request *request)
spin_unlock(>prp_lock);
 }
 
-static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
- __u32 version, int opcode,
- int count, __u32 *lengths, char **bufs,
- struct ptlrpc_cli_ctx *ctx)
+int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
+__u32 version, int opcode, char **bufs,
+struct ptlrpc_cli_ctx *ctx)
 {
-   struct obd_import *imp = request->rq_import;
+   int count;
+   struct obd_import *imp;
+   __u32 *lengths;
int rc;
 
+   count = req_capsule_filled_sizes(>rq_pill, RCL_CLIENT);
+   imp = request->rq_import;
+   lengths = request->rq_pill.rc_area[RCL_CLIENT];
+
if (unlikely(ctx)) {
request->rq_cli_ctx = sptlrpc_cli_ctx_get(ctx);
} else {
@@ -598,15 +603,12 @@ static int __ptlrpc_request_bufs_pack(struct 
ptlrpc_request *request,
if (rc)
goto out_free;
}
-
sptlrpc_req_set_flavor(request, opcode);
 
rc = lustre_pack_request(request, imp->imp_msg_magic, count,
 lengths, bufs);
-   if (rc) {
-   LASSERT(!request->rq_pool);
+   if (rc)
goto out_ctx;
-   }
 
lustre_msg_add_version(request->rq_reqmsg, version);
request->rq_send_state = LUSTRE_IMP_FULL;
@@ -631,24 +633,14 @@ static int __ptlrpc_request_bufs_pack(struct 
ptlrpc_request *request,
lustre_msg_set_opc(request->rq_reqmsg, opcode);
 
return 0;
+
 out_ctx:
+   LASSERT(!request->rq_pool);
sptlrpc_cli_ctx_put(request->rq_cli_ctx, 1);
 out_free:
class_import_put(imp);
return rc;
 }
-
-int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
-__u32 version, int opcode, char **bufs,
-struct ptlrpc_cli_ctx *ctx)
-{
-   int count;
-
-   count = req_capsule_filled_sizes(>rq_pill, RCL_CLIENT);
-   return __ptlrpc_request_bufs_pack(request, version, opcode, count,
- request->rq_pill.rc_area[RCL_CLIENT],
- bufs, ctx);
-}
 EXPORT_SYMBOL(ptlrpc_request_bufs_pack);
 
 /**
-- 
2.7.4



[PATCH v2 10/29] staging/lustre/ptlrpc: Remove __ptlrpc_request_bufs_pack

2016-06-20 Thread Oleg Drokin
From: Ben Evans 

Combine __ptlrpc_request_bufs_pack into ptlrpc_request_bufs_pack
because it was an unnecessary wrapper otherwise.

Signed-off-by: Ben Evans 
Reviewed-on: http://review.whamcloud.com/16765
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7269
Reviewed-by: Frank Zago 
Reviewed-by: Andreas Dilger 
Reviewed-by: John L. Hammond 
Reviewed-by: Chris Horn 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c | 34 ++-
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index ae1cef3..5d832eb 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -583,14 +583,19 @@ static void __ptlrpc_free_req_to_pool(struct 
ptlrpc_request *request)
spin_unlock(>prp_lock);
 }
 
-static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
- __u32 version, int opcode,
- int count, __u32 *lengths, char **bufs,
- struct ptlrpc_cli_ctx *ctx)
+int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
+__u32 version, int opcode, char **bufs,
+struct ptlrpc_cli_ctx *ctx)
 {
-   struct obd_import *imp = request->rq_import;
+   int count;
+   struct obd_import *imp;
+   __u32 *lengths;
int rc;
 
+   count = req_capsule_filled_sizes(>rq_pill, RCL_CLIENT);
+   imp = request->rq_import;
+   lengths = request->rq_pill.rc_area[RCL_CLIENT];
+
if (unlikely(ctx)) {
request->rq_cli_ctx = sptlrpc_cli_ctx_get(ctx);
} else {
@@ -598,15 +603,12 @@ static int __ptlrpc_request_bufs_pack(struct 
ptlrpc_request *request,
if (rc)
goto out_free;
}
-
sptlrpc_req_set_flavor(request, opcode);
 
rc = lustre_pack_request(request, imp->imp_msg_magic, count,
 lengths, bufs);
-   if (rc) {
-   LASSERT(!request->rq_pool);
+   if (rc)
goto out_ctx;
-   }
 
lustre_msg_add_version(request->rq_reqmsg, version);
request->rq_send_state = LUSTRE_IMP_FULL;
@@ -631,24 +633,14 @@ static int __ptlrpc_request_bufs_pack(struct 
ptlrpc_request *request,
lustre_msg_set_opc(request->rq_reqmsg, opcode);
 
return 0;
+
 out_ctx:
+   LASSERT(!request->rq_pool);
sptlrpc_cli_ctx_put(request->rq_cli_ctx, 1);
 out_free:
class_import_put(imp);
return rc;
 }
-
-int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
-__u32 version, int opcode, char **bufs,
-struct ptlrpc_cli_ctx *ctx)
-{
-   int count;
-
-   count = req_capsule_filled_sizes(>rq_pill, RCL_CLIENT);
-   return __ptlrpc_request_bufs_pack(request, version, opcode, count,
- request->rq_pill.rc_area[RCL_CLIENT],
- bufs, ctx);
-}
 EXPORT_SYMBOL(ptlrpc_request_bufs_pack);
 
 /**
-- 
2.7.4



[PATCH v2 14/29] staging/lustre: Add newline to LU_OBJECT_DEBUG() message

2016-06-20 Thread Oleg Drokin
From: Bob Glossman 

LU_OBJECT_DEBUG expects non \n terminated message from the caller,
so it should add it's own to keep debug logger happy.

Signed-off-by: Bob Glossman 
Reviewed-on: http://review.whamcloud.com/19960
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8094
Reviewed-by: Andreas Dilger 
Reviewed-by: Alex Zhuravlev 
Reviewed-by: John L. Hammond 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lu_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index c6281e6..6e25c1b 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -779,7 +779,7 @@ do {
  \
if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {\
LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);
\
lu_object_print(env, , lu_cdebug_printer, object);\
-   CDEBUG(mask, format, ## __VA_ARGS__);   \
+   CDEBUG(mask, format "\n", ## __VA_ARGS__);  \
}\
 } while (0)
 
-- 
2.7.4



[PATCH v2 12/29] staging/lustre/llite: take trunc_sem only at vvp layer

2016-06-20 Thread Oleg Drokin
From: Patrick Farrell 

The lli_trunc_sem is taken in 'read' mode in both
ll_page_mkwrite and vvp_io_fault_start. This can lead to a
deadlock with another thread which asks for the semaphore
in write mode between thse two read calls.

Since all users of lli_trunc_sem are in the vvp layer, we
can satisfy the requirement to exclude truncate by taking
the semaphore only in vvp_io_fault_start.

Signed-off-by: Patrick Farrell 
Reviewed-on: http://review.whamcloud.com/19315
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7981
Reviewed-by: Jinshan Xiong 
Reviewed-by: Andriy Skulysh 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_mmap.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c 
b/drivers/staging/lustre/lustre/llite/llite_mmap.c
index fb1c3b6..66ee5db 100644
--- a/drivers/staging/lustre/lustre/llite/llite_mmap.c
+++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c
@@ -196,18 +196,11 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, 
struct page *vmpage,
 
set = cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM));
 
-   /* we grab lli_trunc_sem to exclude truncate case.
-* Otherwise, we could add dirty pages into osc cache
-* while truncate is on-going.
-*/
inode = vvp_object_inode(io->ci_obj);
lli = ll_i2info(inode);
-   down_read(>lli_trunc_sem);
 
result = cl_io_loop(env, io);
 
-   up_read(>lli_trunc_sem);
-
cfs_restore_sigs(set);
 
if (result == 0) {
-- 
2.7.4



[PATCH v2 09/29] staging/lustre/ptlrpc: Early Reply vs Reply MDunlink

2016-06-20 Thread Oleg Drokin
From: Vitaly Fertman 

A race between unregister_reply & early reply.
When buffers are busy for the early transfer, they cannon be unlinked
by unregister_reply, so the RPC gets into UNREGISTERING state. The
coming reply_in_callback for the early RPC already has unlinked flag
set due to previous mdunlink attempt, but we handle it properly only
for UNILNK event, whereas this is PUT in this case.

Signed-off-by: Vitaly Fertman 
Seagate-bug-id: MRP-3323
Reviewed-by: Alexey Leonidovich Lyashkov 
Reviewed-by: Andriy Skulysh 
Tested-by: Parinay Vijayprakash Kondekar 
Reviewed-on: http://review.whamcloud.com/18934
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7434
Reviewed-by: Chris Horn 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ptlrpc/events.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c 
b/drivers/staging/lustre/lustre/ptlrpc/events.c
index a243342..b1ce725 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
@@ -137,7 +137,8 @@ void reply_in_callback(lnet_event_t *ev)
 
req->rq_early_count++; /* number received, client side */
 
-   if (req->rq_replied)   /* already got the real reply */
+   /* already got the real reply or buffers are already unlinked */
+   if (req->rq_replied || req->rq_reply_unlinked == 1)
goto out_wake;
 
req->rq_early = 1;
-- 
2.7.4



[PATCH v2 14/29] staging/lustre: Add newline to LU_OBJECT_DEBUG() message

2016-06-20 Thread Oleg Drokin
From: Bob Glossman 

LU_OBJECT_DEBUG expects non \n terminated message from the caller,
so it should add it's own to keep debug logger happy.

Signed-off-by: Bob Glossman 
Reviewed-on: http://review.whamcloud.com/19960
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8094
Reviewed-by: Andreas Dilger 
Reviewed-by: Alex Zhuravlev 
Reviewed-by: John L. Hammond 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lu_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index c6281e6..6e25c1b 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -779,7 +779,7 @@ do {
  \
if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {\
LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);
\
lu_object_print(env, , lu_cdebug_printer, object);\
-   CDEBUG(mask, format, ## __VA_ARGS__);   \
+   CDEBUG(mask, format "\n", ## __VA_ARGS__);  \
}\
 } while (0)
 
-- 
2.7.4



[PATCH v2 12/29] staging/lustre/llite: take trunc_sem only at vvp layer

2016-06-20 Thread Oleg Drokin
From: Patrick Farrell 

The lli_trunc_sem is taken in 'read' mode in both
ll_page_mkwrite and vvp_io_fault_start. This can lead to a
deadlock with another thread which asks for the semaphore
in write mode between thse two read calls.

Since all users of lli_trunc_sem are in the vvp layer, we
can satisfy the requirement to exclude truncate by taking
the semaphore only in vvp_io_fault_start.

Signed-off-by: Patrick Farrell 
Reviewed-on: http://review.whamcloud.com/19315
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7981
Reviewed-by: Jinshan Xiong 
Reviewed-by: Andriy Skulysh 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_mmap.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c 
b/drivers/staging/lustre/lustre/llite/llite_mmap.c
index fb1c3b6..66ee5db 100644
--- a/drivers/staging/lustre/lustre/llite/llite_mmap.c
+++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c
@@ -196,18 +196,11 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, 
struct page *vmpage,
 
set = cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM));
 
-   /* we grab lli_trunc_sem to exclude truncate case.
-* Otherwise, we could add dirty pages into osc cache
-* while truncate is on-going.
-*/
inode = vvp_object_inode(io->ci_obj);
lli = ll_i2info(inode);
-   down_read(>lli_trunc_sem);
 
result = cl_io_loop(env, io);
 
-   up_read(>lli_trunc_sem);
-
cfs_restore_sigs(set);
 
if (result == 0) {
-- 
2.7.4



[PATCH v2 09/29] staging/lustre/ptlrpc: Early Reply vs Reply MDunlink

2016-06-20 Thread Oleg Drokin
From: Vitaly Fertman 

A race between unregister_reply & early reply.
When buffers are busy for the early transfer, they cannon be unlinked
by unregister_reply, so the RPC gets into UNREGISTERING state. The
coming reply_in_callback for the early RPC already has unlinked flag
set due to previous mdunlink attempt, but we handle it properly only
for UNILNK event, whereas this is PUT in this case.

Signed-off-by: Vitaly Fertman 
Seagate-bug-id: MRP-3323
Reviewed-by: Alexey Leonidovich Lyashkov 
Reviewed-by: Andriy Skulysh 
Tested-by: Parinay Vijayprakash Kondekar 
Reviewed-on: http://review.whamcloud.com/18934
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7434
Reviewed-by: Chris Horn 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ptlrpc/events.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c 
b/drivers/staging/lustre/lustre/ptlrpc/events.c
index a243342..b1ce725 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
@@ -137,7 +137,8 @@ void reply_in_callback(lnet_event_t *ev)
 
req->rq_early_count++; /* number received, client side */
 
-   if (req->rq_replied)   /* already got the real reply */
+   /* already got the real reply or buffers are already unlinked */
+   if (req->rq_replied || req->rq_reply_unlinked == 1)
goto out_wake;
 
req->rq_early = 1;
-- 
2.7.4



Re: [PATCH] blktrace: reword comment about time overflow

2016-06-20 Thread Jeff Moyer
Arnd Bergmann  writes:

> Jeff Moyer looked up the blktrace source to see if an overflow might
> happen. The situation is as follows:
>
> - The time stamp is not used by the program itself, only for
>   printing human-readable output.
> - We normally don't print the timestamp at all, except when an
>   undocumented format option is given to blkparse.
> - The assumption is that no other program besides blktrace
>   even looks at this data, but of course cannot be sure.
> - On 64-bit systems, the time gets read from the unsigned
>   32-bit kernel structure into a timespec in a way that will
>   work correctly until 2106, so there is no 2038 problem.
> - On 32-bit systems that have a new (future) libc build with
>   a 64-bit time_t type, it will work the same way.
> - On current 32-bit systems, the time is passed into localtime(),
>   at which point the overflow happens, but those systems are
>   already broken.
>
> In short, it's good enough for now, so update the comment.
>
> Signed-off-by: Arnd Bergmann 
> Fixes: 59a37f8baeb2 ("blktrace: avoid using timespec")
> Cc: Jeff Moyer 

Acked-by: Jeff Moyer 

> ---
>  kernel/trace/blktrace.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index b0816e4a61a5..4a3666779589 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -131,7 +131,8 @@ static void trace_note_time(struct blk_trace *bt)
>   unsigned long flags;
>   u32 words[2];
>  
> - /* need to check user space to see if this breaks in y2038 or y2106 */
> + /* blktrace converts this to a time_t and will overflow in
> +2106, not in 2038 */
>   ktime_get_real_ts64();
>   words[0] = (u32)now.tv_sec;
>   words[1] = now.tv_nsec;


Re: [PATCH] blktrace: reword comment about time overflow

2016-06-20 Thread Jeff Moyer
Arnd Bergmann  writes:

> Jeff Moyer looked up the blktrace source to see if an overflow might
> happen. The situation is as follows:
>
> - The time stamp is not used by the program itself, only for
>   printing human-readable output.
> - We normally don't print the timestamp at all, except when an
>   undocumented format option is given to blkparse.
> - The assumption is that no other program besides blktrace
>   even looks at this data, but of course cannot be sure.
> - On 64-bit systems, the time gets read from the unsigned
>   32-bit kernel structure into a timespec in a way that will
>   work correctly until 2106, so there is no 2038 problem.
> - On 32-bit systems that have a new (future) libc build with
>   a 64-bit time_t type, it will work the same way.
> - On current 32-bit systems, the time is passed into localtime(),
>   at which point the overflow happens, but those systems are
>   already broken.
>
> In short, it's good enough for now, so update the comment.
>
> Signed-off-by: Arnd Bergmann 
> Fixes: 59a37f8baeb2 ("blktrace: avoid using timespec")
> Cc: Jeff Moyer 

Acked-by: Jeff Moyer 

> ---
>  kernel/trace/blktrace.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index b0816e4a61a5..4a3666779589 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -131,7 +131,8 @@ static void trace_note_time(struct blk_trace *bt)
>   unsigned long flags;
>   u32 words[2];
>  
> - /* need to check user space to see if this breaks in y2038 or y2106 */
> + /* blktrace converts this to a time_t and will overflow in
> +2106, not in 2038 */
>   ktime_get_real_ts64();
>   words[0] = (u32)now.tv_sec;
>   words[1] = now.tv_nsec;


Re: [PATCH v9 10/12] kthread: Allow to cancel kthread work

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:29PM +0200, Petr Mladek wrote:
> +/*
> + * Returns true when the work could not be queued at the moment.
> + * It happens when it is already pending in a worker list
> + * or when it is being cancelled.
> + *
> + * This function must be called under work->worker->lock.

Replace the comment with a lockdep assertion?

> + */
> +static inline bool queuing_blocked(const struct kthread_work *work)
> +{
> + return !list_empty(>node) || work->canceling;
> +}

Other than that,

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH v9 10/12] kthread: Allow to cancel kthread work

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:29PM +0200, Petr Mladek wrote:
> +/*
> + * Returns true when the work could not be queued at the moment.
> + * It happens when it is already pending in a worker list
> + * or when it is being cancelled.
> + *
> + * This function must be called under work->worker->lock.

Replace the comment with a lockdep assertion?

> + */
> +static inline bool queuing_blocked(const struct kthread_work *work)
> +{
> + return !list_empty(>node) || work->canceling;
> +}

Other than that,

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH 5/5] vmlinux.lds.h: replace config_enabled() with IS_ENABLED()

2016-06-20 Thread Michal Marek
Dne 14.6.2016 v 07:58 Masahiro Yamada napsal(a):
> The use of config_enabled() against config options is ambiguous.
> 
> Now, IS_ENABLED() is implemented purely with macro expansion, so
> let's replace config_enabled() with IS_ENABLED().
> 
> Signed-off-by: Masahiro Yamada 

I applied the whole series to kbuild.git#kbuild.

Michal



Re: [PATCH 5/5] vmlinux.lds.h: replace config_enabled() with IS_ENABLED()

2016-06-20 Thread Michal Marek
Dne 14.6.2016 v 07:58 Masahiro Yamada napsal(a):
> The use of config_enabled() against config options is ambiguous.
> 
> Now, IS_ENABLED() is implemented purely with macro expansion, so
> let's replace config_enabled() with IS_ENABLED().
> 
> Signed-off-by: Masahiro Yamada 

I applied the whole series to kbuild.git#kbuild.

Michal



Re: [PATCH v8 2/8] perf evlist: Introduce aux evlist

2016-06-20 Thread Arnaldo Carvalho de Melo
Em Mon, Jun 20, 2016 at 10:47:19AM +, Wang Nan escreveu:
> An auxiliary evlist is created by perf_evlist__new_aux() using an
> existing evlist as its parent. An auxiliary evlist can have its own
> 'struct perf_mmap', but can't have any other data. User should use its
> parent instead when accessing other data.
> 
> Auxiliary evlists are containers of 'struct perf_mmap'. It is introduced
> to allow its parent evlist to map different events into separated mmaps.
> 
> Following commits create an auxiliary evlist for overwritable
> events, because overwritable events need a read only and backwards ring
> buffer, which is different from normal events.
> 
> To achieve this goal, this patch carefully changes 'evlist' to
> 'evlist->parent' in all functions in the path of 'perf_evlist__mmap_ex',
> except 'evlist->mmap' related operations, to make sure all evlist
> modifications (like pollfd and event id hash tables) goes to original
> evlist.
> 
> A 'evlist->parent' pointer is added to 'struct perf_evlist' and points to
> the evlist itself for normal evlists.
> 
> Children of one evlist are linked into it so one can find all children
> from its parent.

> To avoid potential complexity, forbid creating aux evlist from another
> aux evlist.
> 
> Improve perf_evlist__munmap_filtered(), so when recording, if an event
> is terminated, unmap mmaps, from parent and children.
 
> Signed-off-by: Wang Nan 
> Cc: He Kuang 
> Cc: Jiri Olsa 
> Cc: Masami Hiramatsu 
> Cc: Namhyung Kim 
> Cc: Zefan Li 
> Cc: pi3or...@163.com
> ---
>  tools/perf/util/evlist.c | 49 
> +---
>  tools/perf/util/evlist.h | 12 
>  2 files changed, 50 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 1b918aa..b03cb3c 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -41,10 +41,12 @@ void perf_evlist__init(struct perf_evlist *evlist, struct 
> cpu_map *cpus,
>   for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
>   INIT_HLIST_HEAD(>heads[i]);
>   INIT_LIST_HEAD(>entries);
> + INIT_LIST_HEAD(>children);
>   perf_evlist__set_maps(evlist, cpus, threads);
>   fdarray__init(>pollfd, 64);
>   evlist->workload.pid = -1;
>   evlist->backward = false;
> + evlist->parent = evlist;
>  }
>  
>  struct perf_evlist *perf_evlist__new(void)
> @@ -487,13 +489,17 @@ static void perf_evlist__munmap_filtered(struct fdarray 
> *fda, int fd,
>void *arg __maybe_unused)
>  {
>   struct perf_evlist *evlist = container_of(fda, struct perf_evlist, 
> pollfd);
> + struct perf_evlist *child;
>  
>   perf_evlist__mmap_put(evlist, fda->priv[fd].idx);
> + list_for_each_entry(child, >children, list)
> + perf_evlist__mmap_put(child, fda->priv[fd].idx);
> +
>  }
>  
>  int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short 
> revents_and_mask)
>  {
> - return fdarray__filter(>pollfd, revents_and_mask,
> + return fdarray__filter(>parent->pollfd, revents_and_mask,
>  perf_evlist__munmap_filtered, NULL);
>  }
>  
> @@ -1012,7 +1018,7 @@ static int perf_evlist__mmap_per_evsel(struct 
> perf_evlist *evlist, int idx,
>   struct perf_evsel *evsel;
>   int revent;
>  
> - evlist__for_each(evlist, evsel) {
> + evlist__for_each(evlist->parent, evsel) {
>   int fd;
>  
>   if (evsel->overwrite != (evlist->overwrite && evlist->backward))
> @@ -1044,16 +1050,16 @@ static int perf_evlist__mmap_per_evsel(struct 
> perf_evlist *evlist, int idx,
>* Therefore don't add it for polling.
>*/
>   if (!evsel->system_wide &&
> - __perf_evlist__add_pollfd(evlist, fd, idx, revent) < 0) {
> + __perf_evlist__add_pollfd(evlist->parent, fd, idx, revent) 
> < 0) {
>   perf_evlist__mmap_put(evlist, idx);
>   return -1;
>   }
>  
>   if (evsel->attr.read_format & PERF_FORMAT_ID) {
> - if (perf_evlist__id_add_fd(evlist, evsel, cpu, thread,
> + if (perf_evlist__id_add_fd(evlist->parent, evsel, cpu, 
> thread,
>  fd) < 0)
>   return -1;
> - perf_evlist__set_sid_idx(evlist, evsel, idx, cpu,
> + perf_evlist__set_sid_idx(evlist->parent, evsel, idx, 
> cpu,
>thread);
>   }
>   }
> @@ -1094,13 +1100,13 @@ static int perf_evlist__mmap_per_thread(struct 
> perf_evlist *evlist,
>   struct mmap_params *mp)
>  {
>   int thread;
> - int nr_threads = thread_map__nr(evlist->threads);
> + 

Re: [PATCH v8 2/8] perf evlist: Introduce aux evlist

2016-06-20 Thread Arnaldo Carvalho de Melo
Em Mon, Jun 20, 2016 at 10:47:19AM +, Wang Nan escreveu:
> An auxiliary evlist is created by perf_evlist__new_aux() using an
> existing evlist as its parent. An auxiliary evlist can have its own
> 'struct perf_mmap', but can't have any other data. User should use its
> parent instead when accessing other data.
> 
> Auxiliary evlists are containers of 'struct perf_mmap'. It is introduced
> to allow its parent evlist to map different events into separated mmaps.
> 
> Following commits create an auxiliary evlist for overwritable
> events, because overwritable events need a read only and backwards ring
> buffer, which is different from normal events.
> 
> To achieve this goal, this patch carefully changes 'evlist' to
> 'evlist->parent' in all functions in the path of 'perf_evlist__mmap_ex',
> except 'evlist->mmap' related operations, to make sure all evlist
> modifications (like pollfd and event id hash tables) goes to original
> evlist.
> 
> A 'evlist->parent' pointer is added to 'struct perf_evlist' and points to
> the evlist itself for normal evlists.
> 
> Children of one evlist are linked into it so one can find all children
> from its parent.

> To avoid potential complexity, forbid creating aux evlist from another
> aux evlist.
> 
> Improve perf_evlist__munmap_filtered(), so when recording, if an event
> is terminated, unmap mmaps, from parent and children.
 
> Signed-off-by: Wang Nan 
> Cc: He Kuang 
> Cc: Jiri Olsa 
> Cc: Masami Hiramatsu 
> Cc: Namhyung Kim 
> Cc: Zefan Li 
> Cc: pi3or...@163.com
> ---
>  tools/perf/util/evlist.c | 49 
> +---
>  tools/perf/util/evlist.h | 12 
>  2 files changed, 50 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 1b918aa..b03cb3c 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -41,10 +41,12 @@ void perf_evlist__init(struct perf_evlist *evlist, struct 
> cpu_map *cpus,
>   for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
>   INIT_HLIST_HEAD(>heads[i]);
>   INIT_LIST_HEAD(>entries);
> + INIT_LIST_HEAD(>children);
>   perf_evlist__set_maps(evlist, cpus, threads);
>   fdarray__init(>pollfd, 64);
>   evlist->workload.pid = -1;
>   evlist->backward = false;
> + evlist->parent = evlist;
>  }
>  
>  struct perf_evlist *perf_evlist__new(void)
> @@ -487,13 +489,17 @@ static void perf_evlist__munmap_filtered(struct fdarray 
> *fda, int fd,
>void *arg __maybe_unused)
>  {
>   struct perf_evlist *evlist = container_of(fda, struct perf_evlist, 
> pollfd);
> + struct perf_evlist *child;
>  
>   perf_evlist__mmap_put(evlist, fda->priv[fd].idx);
> + list_for_each_entry(child, >children, list)
> + perf_evlist__mmap_put(child, fda->priv[fd].idx);
> +
>  }
>  
>  int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short 
> revents_and_mask)
>  {
> - return fdarray__filter(>pollfd, revents_and_mask,
> + return fdarray__filter(>parent->pollfd, revents_and_mask,
>  perf_evlist__munmap_filtered, NULL);
>  }
>  
> @@ -1012,7 +1018,7 @@ static int perf_evlist__mmap_per_evsel(struct 
> perf_evlist *evlist, int idx,
>   struct perf_evsel *evsel;
>   int revent;
>  
> - evlist__for_each(evlist, evsel) {
> + evlist__for_each(evlist->parent, evsel) {
>   int fd;
>  
>   if (evsel->overwrite != (evlist->overwrite && evlist->backward))
> @@ -1044,16 +1050,16 @@ static int perf_evlist__mmap_per_evsel(struct 
> perf_evlist *evlist, int idx,
>* Therefore don't add it for polling.
>*/
>   if (!evsel->system_wide &&
> - __perf_evlist__add_pollfd(evlist, fd, idx, revent) < 0) {
> + __perf_evlist__add_pollfd(evlist->parent, fd, idx, revent) 
> < 0) {
>   perf_evlist__mmap_put(evlist, idx);
>   return -1;
>   }
>  
>   if (evsel->attr.read_format & PERF_FORMAT_ID) {
> - if (perf_evlist__id_add_fd(evlist, evsel, cpu, thread,
> + if (perf_evlist__id_add_fd(evlist->parent, evsel, cpu, 
> thread,
>  fd) < 0)
>   return -1;
> - perf_evlist__set_sid_idx(evlist, evsel, idx, cpu,
> + perf_evlist__set_sid_idx(evlist->parent, evsel, idx, 
> cpu,
>thread);
>   }
>   }
> @@ -1094,13 +1100,13 @@ static int perf_evlist__mmap_per_thread(struct 
> perf_evlist *evlist,
>   struct mmap_params *mp)
>  {
>   int thread;
> - int nr_threads = thread_map__nr(evlist->threads);
> + int nr_threads = thread_map__nr(evlist->parent->threads);
>  
>   pr_debug2("perf event ring buffer mmapped per 

Re: [PATCH 1/2] x86/entry: Avoid interrupt flag save and restore

2016-06-20 Thread Andy Lutomirski
On Mon, Jun 20, 2016 at 7:58 AM, Paolo Bonzini  wrote:
> Thanks to all the work that was done by Andy Lutomirski and others,
> enter_from_user_mode and prepare_exit_to_usermode are now called only with
> interrupts disabled.  Let's provide them a version of user_enter/user_exit
> that skips saving and restoring the interrupt flag.

You're also skipping the in_interrupt() check, but that appears to be fine.

Reviewed-by: Andy Lutomirski 


Re: [PATCH 1/2] x86/entry: Avoid interrupt flag save and restore

2016-06-20 Thread Andy Lutomirski
On Mon, Jun 20, 2016 at 7:58 AM, Paolo Bonzini  wrote:
> Thanks to all the work that was done by Andy Lutomirski and others,
> enter_from_user_mode and prepare_exit_to_usermode are now called only with
> interrupts disabled.  Let's provide them a version of user_enter/user_exit
> that skips saving and restoring the interrupt flag.

You're also skipping the in_interrupt() check, but that appears to be fine.

Reviewed-by: Andy Lutomirski 


Re: [PATCH] coccicheck: Allow for overriding spatch flags

2016-06-20 Thread Michal Marek
On Sun, Jun 12, 2016 at 11:45:57PM +0200, Julia Lawall wrote:
> 
> 
> On Sun, 12 Jun 2016, Nicolas Palix (LIG) wrote:
> 
> > Le 12/06/16 à 21:04, Deepa Dinamani a écrit :
> > > Documentation/coccinelle.txt suggests using the SPFLAGS
> > > make variable to pass additional options to spatch.
> > > 
> > > Reorder the way SPFLAGS is added to FLAGS, to allow
> > > for options in the SPFLAGS to override the default
> > > --very-quiet option.
> > > 
> > > Similarly, rearrage the FLAGS for org or report mode.
> > > This allows for overriding of the default --no-show-diff
> > > option through SPFLAGS.
> > > 
> > > Signed-off-by: Deepa Dinamani 
> > > Cc: Julia Lawall 
> > > Cc: Gilles Muller 
> > > Cc: Nicolas Palix 
> > Acked-By: Nicolas Palix 
> 
> Acked-by: Julia Lawall 

Applied to kbuild.git#misc.

Michal


Re: [PATCH] coccicheck: Allow for overriding spatch flags

2016-06-20 Thread Michal Marek
On Sun, Jun 12, 2016 at 11:45:57PM +0200, Julia Lawall wrote:
> 
> 
> On Sun, 12 Jun 2016, Nicolas Palix (LIG) wrote:
> 
> > Le 12/06/16 à 21:04, Deepa Dinamani a écrit :
> > > Documentation/coccinelle.txt suggests using the SPFLAGS
> > > make variable to pass additional options to spatch.
> > > 
> > > Reorder the way SPFLAGS is added to FLAGS, to allow
> > > for options in the SPFLAGS to override the default
> > > --very-quiet option.
> > > 
> > > Similarly, rearrage the FLAGS for org or report mode.
> > > This allows for overriding of the default --no-show-diff
> > > option through SPFLAGS.
> > > 
> > > Signed-off-by: Deepa Dinamani 
> > > Cc: Julia Lawall 
> > > Cc: Gilles Muller 
> > > Cc: Nicolas Palix 
> > Acked-By: Nicolas Palix 
> 
> Acked-by: Julia Lawall 

Applied to kbuild.git#misc.

Michal


Re: [PATCH] memcg: mem_cgroup_migrate() may be called with irq disabled

2016-06-20 Thread Christian Borntraeger
On 06/20/2016 08:41 PM, Tejun Heo wrote:
> Hello,
> 
> Christian, I *think* this should fix it.  Can you please verify?

I cannot reliably reproduce the bug :-/,but at least I have not seen
it with this patch and the patch makes sense and matches the traces.

> 
> Thanks!
> -- 8< --
> mem_cgroup_migrate() uses local_irq_disable/enable() but can be called
> with irq disabled from migrate_page_copy().  This ends up enabling irq
> while holding a irq context lock triggering the following lockdep
> warning.  Fix it by using irq_save/restore instead.
> 
>   =
>   [ INFO: inconsistent lock state ]
>   4.7.0-rc1+ #52 Tainted: GW  
>   -
>   inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
>   kcompactd0/151 [HC0[0]:SC0[0]:HE1:SE1] takes:
>(&(>completion_lock)->rlock){+.?.-.}, at: [<0038fd96>] 
> aio_migratepage+0x156/0x1e8
>   {IN-SOFTIRQ-W} state was registered at:
> [<001a8366>] __lock_acquire+0x5b6/0x1930
> [<001a9b9e>] lock_acquire+0xee/0x270
> [<00951fee>] _raw_spin_lock_irqsave+0x66/0xb0
> [<00390108>] aio_complete+0x98/0x328
> [<0037c7d4>] dio_complete+0xe4/0x1e0
> [<00650e64>] blk_update_request+0xd4/0x450
> [<0072a1a8>] scsi_end_request+0x48/0x1c8
> [<0072d7e2>] scsi_io_completion+0x272/0x698
> [<0065adb2>] blk_done_softirq+0xca/0xe8
> [<00953f80>] __do_softirq+0xc8/0x518
> [<001495de>] irq_exit+0xee/0x110
> [<0010ceba>] do_IRQ+0x6a/0x88
> [<0095342e>] io_int_handler+0x11a/0x25c
> [<0094fb5c>] __mutex_unlock_slowpath+0x144/0x1d8
> [<0094fb58>] __mutex_unlock_slowpath+0x140/0x1d8
> [<003c6114>] kernfs_iop_permission+0x64/0x80
> [<0033ba86>] __inode_permission+0x9e/0xf0
> [<0033ea96>] link_path_walk+0x6e/0x510
> [<0033f09c>] path_lookupat+0xc4/0x1a8
> [<0034195c>] filename_lookup+0x9c/0x160
> [<00341b44>] user_path_at_empty+0x5c/0x70
> [<00335250>] SyS_readlinkat+0x68/0x140
> [<00952f8e>] system_call+0xd6/0x270
>   irq event stamp: 971410
>   hardirqs last  enabled at (971409): [<0030f982>] 
> migrate_page_move_mapping+0x3ea/0x588
>   hardirqs last disabled at (971410): [<00951fc4>] 
> _raw_spin_lock_irqsave+0x3c/0xb0
>   softirqs last  enabled at (970526): [<00954318>] 
> __do_softirq+0x460/0x518
>   softirqs last disabled at (970519): [<001495de>] irq_exit+0xee/0x110
> 
>   other info that might help us debug this:
>Possible unsafe locking scenario:
> 
>CPU0
>
> lock(&(>completion_lock)->rlock);
> 
>   lock(&(>completion_lock)->rlock);
> 
> *** DEADLOCK ***
> 
>   3 locks held by kcompactd0/151:
>#0:  (&(>private_lock)->rlock){+.+.-.}, at: [<0038fc82>] 
> aio_migratepage+0x42/0x1e8
>#1:  (>ring_lock){+.+.+.}, at: [<0038fc9a>] 
> aio_migratepage+0x5a/0x1e8
>#2:  (&(>completion_lock)->rlock){+.?.-.}, at: [<0038fd96>] 
> aio_migratepage+0x156/0x1e8
> 
>   stack backtrace:
>   CPU: 20 PID: 151 Comm: kcompactd0 Tainted: GW   4.7.0-rc1+ #52
>0001c6cbb730 0001c6cbb7c0 0002  
>0001c6cbb860 0001c6cbb7d8 0001c6cbb7d8 00114496 
> 00b517ec 00b680b6 000b 
>0001c6cbb820 0001c6cbb7c0   
>04000184ad18 00114496 0001c6cbb7c0 0001c6cbb820 
>   Call Trace:
>   ([<001143d2>] show_trace+0xea/0xf0)
>   ([<0011444a>] show_stack+0x72/0xf0)
>   ([<00684522>] dump_stack+0x9a/0xd8)
>   ([<0028679c>] print_usage_bug.part.27+0x2d4/0x2e8)
>   ([<001a71ce>] mark_lock+0x17e/0x758)
>   ([<001a784a>] mark_held_locks+0xa2/0xd0)
>   ([<001a79b8>] trace_hardirqs_on_caller+0x140/0x1c0)
>   ([<00326026>] mem_cgroup_migrate+0x266/0x370)
>   ([<0038fdaa>] aio_migratepage+0x16a/0x1e8)
>   ([<00310568>] move_to_new_page+0xb0/0x260)
>   ([<003111b4>] migrate_pages+0x8f4/0x9f0)
>   ([<002c507c>] compact_zone+0x4dc/0xdc8)
>   ([<002c5e22>] kcompactd_do_work+0x1aa/0x358)
>   ([<002c608a>] kcompactd+0xba/0x2c8)
>   ([<0016b09a>] kthread+0x10a/0x110)
>   ([<0095315a>] kernel_thread_starter+0x6/0xc)
>   ([<00953154>] kernel_thread_starter+0x0/0xc)
>   INFO: lockdep is turned off.
> 
> Signed-off-by: Tejun Heo 
> Reported-by: Christian Borntraeger 
> Link: http://lkml.kernel.org/g/5767cfe5.7080...@de.ibm.com
> ---
>  mm/memcontrol.c |5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 75e7440..d4a33e1 100644
> --- 

Re: [PATCH] memcg: mem_cgroup_migrate() may be called with irq disabled

2016-06-20 Thread Christian Borntraeger
On 06/20/2016 08:41 PM, Tejun Heo wrote:
> Hello,
> 
> Christian, I *think* this should fix it.  Can you please verify?

I cannot reliably reproduce the bug :-/,but at least I have not seen
it with this patch and the patch makes sense and matches the traces.

> 
> Thanks!
> -- 8< --
> mem_cgroup_migrate() uses local_irq_disable/enable() but can be called
> with irq disabled from migrate_page_copy().  This ends up enabling irq
> while holding a irq context lock triggering the following lockdep
> warning.  Fix it by using irq_save/restore instead.
> 
>   =
>   [ INFO: inconsistent lock state ]
>   4.7.0-rc1+ #52 Tainted: GW  
>   -
>   inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
>   kcompactd0/151 [HC0[0]:SC0[0]:HE1:SE1] takes:
>(&(>completion_lock)->rlock){+.?.-.}, at: [<0038fd96>] 
> aio_migratepage+0x156/0x1e8
>   {IN-SOFTIRQ-W} state was registered at:
> [<001a8366>] __lock_acquire+0x5b6/0x1930
> [<001a9b9e>] lock_acquire+0xee/0x270
> [<00951fee>] _raw_spin_lock_irqsave+0x66/0xb0
> [<00390108>] aio_complete+0x98/0x328
> [<0037c7d4>] dio_complete+0xe4/0x1e0
> [<00650e64>] blk_update_request+0xd4/0x450
> [<0072a1a8>] scsi_end_request+0x48/0x1c8
> [<0072d7e2>] scsi_io_completion+0x272/0x698
> [<0065adb2>] blk_done_softirq+0xca/0xe8
> [<00953f80>] __do_softirq+0xc8/0x518
> [<001495de>] irq_exit+0xee/0x110
> [<0010ceba>] do_IRQ+0x6a/0x88
> [<0095342e>] io_int_handler+0x11a/0x25c
> [<0094fb5c>] __mutex_unlock_slowpath+0x144/0x1d8
> [<0094fb58>] __mutex_unlock_slowpath+0x140/0x1d8
> [<003c6114>] kernfs_iop_permission+0x64/0x80
> [<0033ba86>] __inode_permission+0x9e/0xf0
> [<0033ea96>] link_path_walk+0x6e/0x510
> [<0033f09c>] path_lookupat+0xc4/0x1a8
> [<0034195c>] filename_lookup+0x9c/0x160
> [<00341b44>] user_path_at_empty+0x5c/0x70
> [<00335250>] SyS_readlinkat+0x68/0x140
> [<00952f8e>] system_call+0xd6/0x270
>   irq event stamp: 971410
>   hardirqs last  enabled at (971409): [<0030f982>] 
> migrate_page_move_mapping+0x3ea/0x588
>   hardirqs last disabled at (971410): [<00951fc4>] 
> _raw_spin_lock_irqsave+0x3c/0xb0
>   softirqs last  enabled at (970526): [<00954318>] 
> __do_softirq+0x460/0x518
>   softirqs last disabled at (970519): [<001495de>] irq_exit+0xee/0x110
> 
>   other info that might help us debug this:
>Possible unsafe locking scenario:
> 
>CPU0
>
> lock(&(>completion_lock)->rlock);
> 
>   lock(&(>completion_lock)->rlock);
> 
> *** DEADLOCK ***
> 
>   3 locks held by kcompactd0/151:
>#0:  (&(>private_lock)->rlock){+.+.-.}, at: [<0038fc82>] 
> aio_migratepage+0x42/0x1e8
>#1:  (>ring_lock){+.+.+.}, at: [<0038fc9a>] 
> aio_migratepage+0x5a/0x1e8
>#2:  (&(>completion_lock)->rlock){+.?.-.}, at: [<0038fd96>] 
> aio_migratepage+0x156/0x1e8
> 
>   stack backtrace:
>   CPU: 20 PID: 151 Comm: kcompactd0 Tainted: GW   4.7.0-rc1+ #52
>0001c6cbb730 0001c6cbb7c0 0002  
>0001c6cbb860 0001c6cbb7d8 0001c6cbb7d8 00114496 
> 00b517ec 00b680b6 000b 
>0001c6cbb820 0001c6cbb7c0   
>04000184ad18 00114496 0001c6cbb7c0 0001c6cbb820 
>   Call Trace:
>   ([<001143d2>] show_trace+0xea/0xf0)
>   ([<0011444a>] show_stack+0x72/0xf0)
>   ([<00684522>] dump_stack+0x9a/0xd8)
>   ([<0028679c>] print_usage_bug.part.27+0x2d4/0x2e8)
>   ([<001a71ce>] mark_lock+0x17e/0x758)
>   ([<001a784a>] mark_held_locks+0xa2/0xd0)
>   ([<001a79b8>] trace_hardirqs_on_caller+0x140/0x1c0)
>   ([<00326026>] mem_cgroup_migrate+0x266/0x370)
>   ([<0038fdaa>] aio_migratepage+0x16a/0x1e8)
>   ([<00310568>] move_to_new_page+0xb0/0x260)
>   ([<003111b4>] migrate_pages+0x8f4/0x9f0)
>   ([<002c507c>] compact_zone+0x4dc/0xdc8)
>   ([<002c5e22>] kcompactd_do_work+0x1aa/0x358)
>   ([<002c608a>] kcompactd+0xba/0x2c8)
>   ([<0016b09a>] kthread+0x10a/0x110)
>   ([<0095315a>] kernel_thread_starter+0x6/0xc)
>   ([<00953154>] kernel_thread_starter+0x0/0xc)
>   INFO: lockdep is turned off.
> 
> Signed-off-by: Tejun Heo 
> Reported-by: Christian Borntraeger 
> Link: http://lkml.kernel.org/g/5767cfe5.7080...@de.ibm.com
> ---
>  mm/memcontrol.c |5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 75e7440..d4a33e1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5544,6 

Re: [PATCH 5/7] random: replace non-blocking pool with a Chacha20-based CRNG

2016-06-20 Thread H. Peter Anvin
On 06/20/16 08:49, Stephan Mueller wrote:
> Am Montag, 20. Juni 2016, 11:01:47 schrieb Theodore Ts'o:
> 
> Hi Theodore,
> 
>>
>> So simply doing chacha20 encryption in a tight loop in the kernel
>> might not be a good proxy for what would actually happen in real life
>> when someone calls getrandom(2).  (Another good question to ask is
>> when someone might be needing to generate millions of 256-bit session
>> keys per second, when the D-H setup, even if you were using ECCDH,
>> would be largely dominating the time for the connection setup anyway.)
> 
> Is speed everything we should care about? What about:
> 
> - offloading of crypto operation from the CPU
> 

This sounds like a speed operation (and very unlikely to be a win given
the usage).

> - potentially additional security features a hardware cipher may provide like 
> cache coloring attack resistance?

How about burning that bridge when and if we get to it?  It sounds very
hypothetical.

I guess I could add in some comments here about how a lot of these
problems can be eliminated by offloading an entire DRNG into hardware,
but I don't think it is productive.

-hpa




Re: [PATCH v9 12/12] kthread: Better support freezable kthread workers

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:31PM +0200, Petr Mladek wrote:
> This patch allows to make kthread worker freezable via a new @flags
> parameter. It will allow to avoid an init work in some kthreads.
> 
> It currently does not affect the function of kthread_worker_fn()
> but it might help to do some optimization or fixes eventually.
> 
> I currently do not know about any other use for the @flags
> parameter but I believe that we will want more flags
> in the future.
> 
> Finally, I hope that it will not cause confusion with @flags member
> in struct kthread. Well, I guess that we will want to rework the
> basic kthreads implementation once all kthreads are converted into
> kthread workers or workqueues. It is possible that we will merge
> the two structures.
> 
> Signed-off-by: Petr Mladek 

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH 5/7] random: replace non-blocking pool with a Chacha20-based CRNG

2016-06-20 Thread H. Peter Anvin
On 06/20/16 08:49, Stephan Mueller wrote:
> Am Montag, 20. Juni 2016, 11:01:47 schrieb Theodore Ts'o:
> 
> Hi Theodore,
> 
>>
>> So simply doing chacha20 encryption in a tight loop in the kernel
>> might not be a good proxy for what would actually happen in real life
>> when someone calls getrandom(2).  (Another good question to ask is
>> when someone might be needing to generate millions of 256-bit session
>> keys per second, when the D-H setup, even if you were using ECCDH,
>> would be largely dominating the time for the connection setup anyway.)
> 
> Is speed everything we should care about? What about:
> 
> - offloading of crypto operation from the CPU
> 

This sounds like a speed operation (and very unlikely to be a win given
the usage).

> - potentially additional security features a hardware cipher may provide like 
> cache coloring attack resistance?

How about burning that bridge when and if we get to it?  It sounds very
hypothetical.

I guess I could add in some comments here about how a lot of these
problems can be eliminated by offloading an entire DRNG into hardware,
but I don't think it is productive.

-hpa




Re: [PATCH v9 12/12] kthread: Better support freezable kthread workers

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:31PM +0200, Petr Mladek wrote:
> This patch allows to make kthread worker freezable via a new @flags
> parameter. It will allow to avoid an init work in some kthreads.
> 
> It currently does not affect the function of kthread_worker_fn()
> but it might help to do some optimization or fixes eventually.
> 
> I currently do not know about any other use for the @flags
> parameter but I believe that we will want more flags
> in the future.
> 
> Finally, I hope that it will not cause confusion with @flags member
> in struct kthread. Well, I guess that we will want to rework the
> basic kthreads implementation once all kthreads are converted into
> kthread workers or workqueues. It is possible that we will merge
> the two structures.
> 
> Signed-off-by: Petr Mladek 

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH v9 11/12] kthread: Allow to modify delayed kthread work

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:30PM +0200, Petr Mladek wrote:
> There are situations when we need to modify the delay of a delayed kthread
> work. For example, when the work depends on an event and the initial delay
> means a timeout. Then we want to queue the work immediately when the event
> happens.
> 
> This patch implements kthread_mod_delayed_work() as inspired workqueues.
> It cancels the timer, removes the work from any worker list and queues it
> again with the given timeout.
> 
> A very special case is when the work is being canceled at the same time.
> It might happen because of the regular kthread_cancel_delayed_work_sync()
> or by another kthread_mod_delayed_work(). In this case, we do nothing and
> let the other operation win. This should not normally happen as the caller
> is supposed to synchronize these operations a reasonable way.
> 
> Signed-off-by: Petr Mladek 

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH v9 11/12] kthread: Allow to modify delayed kthread work

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:30PM +0200, Petr Mladek wrote:
> There are situations when we need to modify the delay of a delayed kthread
> work. For example, when the work depends on an event and the initial delay
> means a timeout. Then we want to queue the work immediately when the event
> happens.
> 
> This patch implements kthread_mod_delayed_work() as inspired workqueues.
> It cancels the timer, removes the work from any worker list and queues it
> again with the given timeout.
> 
> A very special case is when the work is being canceled at the same time.
> It might happen because of the regular kthread_cancel_delayed_work_sync()
> or by another kthread_mod_delayed_work(). In this case, we do nothing and
> let the other operation win. This should not normally happen as the caller
> is supposed to synchronize these operations a reasonable way.
> 
> Signed-off-by: Petr Mladek 

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH] clk: renesas: build clk-rcar-gen2.o for R8A7792

2016-06-20 Thread Geert Uytterhoeven
Hi Arnd,

On Mon, Jun 20, 2016 at 5:43 PM, Arnd Bergmann  wrote:
> The newly added support for R8A7792 causes build failures
> because we try to call rcar_gen2_clocks_init but that is not
> built into the kernel:
>
> arch/arm/mach-shmobile/built-in.o: In function `rcar_gen2_timer_init':
> :(.init.text+0x3b0): undefined reference to `rcar_gen2_clocks_init'
>
> This changes the clk Makefile to match the other platforms, though
> I guess it would be better to find another way to do this, e.g.
> by not requiring the external function call by relying on
> CLK_OF_DECLARE(), or by making the ARCH_RCAR_GEN2 also control
> the compilation of the clk driver.
>
> Signed-off-by: Arnd Bergmann 
> Fixes: 3ebee0adbfe7 ("ARM: shmobile: r8a7792: basic SoC support")
> ---
>  drivers/clk/renesas/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
> index ead8bb843524..3cdb9aaf8717 100644
> --- a/drivers/clk/renesas/Makefile
> +++ b/drivers/clk/renesas/Makefile
> @@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_R8A7778)  += clk-r8a7778.o
>  obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o
>  obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o clk-div6.o
>  obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o clk-div6.o
> +obj-$(CONFIG_ARCH_R8A7792) += clk-rcar-gen2.o
>  obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o clk-div6.o
>  obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o clk-div6.o
>  obj-$(CONFIG_ARCH_R8A7795) += r8a7795-cpg-mssr.o

There's already a similar patch in my clk-renesas-for-v4.8 branch.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] clk: renesas: build clk-rcar-gen2.o for R8A7792

2016-06-20 Thread Geert Uytterhoeven
Hi Arnd,

On Mon, Jun 20, 2016 at 5:43 PM, Arnd Bergmann  wrote:
> The newly added support for R8A7792 causes build failures
> because we try to call rcar_gen2_clocks_init but that is not
> built into the kernel:
>
> arch/arm/mach-shmobile/built-in.o: In function `rcar_gen2_timer_init':
> :(.init.text+0x3b0): undefined reference to `rcar_gen2_clocks_init'
>
> This changes the clk Makefile to match the other platforms, though
> I guess it would be better to find another way to do this, e.g.
> by not requiring the external function call by relying on
> CLK_OF_DECLARE(), or by making the ARCH_RCAR_GEN2 also control
> the compilation of the clk driver.
>
> Signed-off-by: Arnd Bergmann 
> Fixes: 3ebee0adbfe7 ("ARM: shmobile: r8a7792: basic SoC support")
> ---
>  drivers/clk/renesas/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
> index ead8bb843524..3cdb9aaf8717 100644
> --- a/drivers/clk/renesas/Makefile
> +++ b/drivers/clk/renesas/Makefile
> @@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_R8A7778)  += clk-r8a7778.o
>  obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o
>  obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o clk-div6.o
>  obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o clk-div6.o
> +obj-$(CONFIG_ARCH_R8A7792) += clk-rcar-gen2.o
>  obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o clk-div6.o
>  obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o clk-div6.o
>  obj-$(CONFIG_ARCH_R8A7795) += r8a7795-cpg-mssr.o

There's already a similar patch in my clk-renesas-for-v4.8 branch.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v2 1/3] coccinelle: also catch kzfree() issues

2016-06-20 Thread Julia Lawall


On Mon, 20 Jun 2016, Michal Marek wrote:

> On 2016-05-23 17:18, Julia Lawall wrote:
> > 
> > 
> > On Mon, 23 May 2016, Yann Droneaud wrote:
> > 
> >> Since commit 3ef0e5ba4673 ('slab: introduce kzfree()'),
> >> kfree() is no more the only function to be considered:
> >> kzfree() should be recognized too.
> >>
> >> In particular, kzfree() must not be called on memory
> >> allocated through devm_*() functions.
> >>
> >> Cc: Johannes Weiner 
> >> Signed-off-by: Yann Droneaud 
> > 
> > Acked-by: Julia Lawall 
> 
> Hi Julia,
> 
> does your ACK apply to the other two patches as well?

Sorry, I seem to have missed the other two.  I have reviewed them now, and 
the ack applies to all three.  Thanks for checking on it.

julia


Re: [PATCH v2 1/3] coccinelle: also catch kzfree() issues

2016-06-20 Thread Julia Lawall


On Mon, 20 Jun 2016, Michal Marek wrote:

> On 2016-05-23 17:18, Julia Lawall wrote:
> > 
> > 
> > On Mon, 23 May 2016, Yann Droneaud wrote:
> > 
> >> Since commit 3ef0e5ba4673 ('slab: introduce kzfree()'),
> >> kfree() is no more the only function to be considered:
> >> kzfree() should be recognized too.
> >>
> >> In particular, kzfree() must not be called on memory
> >> allocated through devm_*() functions.
> >>
> >> Cc: Johannes Weiner 
> >> Signed-off-by: Yann Droneaud 
> > 
> > Acked-by: Julia Lawall 
> 
> Hi Julia,
> 
> does your ACK apply to the other two patches as well?

Sorry, I seem to have missed the other two.  I have reviewed them now, and 
the ack applies to all three.  Thanks for checking on it.

julia


[PATCH] crypto : async implementation for sha1-mb

2016-06-20 Thread Megha Dey
From: Megha Dey 

Herbert wants the sha1-mb algorithm to have an async implementation:
https://lkml.org/lkml/2016/4/5/286.
Currently, sha1-mb uses an async interface for the outer algorithm
and a sync interface for the inner algorithm. This patch introduces
a async interface for even the inner algorithm.

Signed-off-by: Megha Dey 
Signed-off-by: Tim Chen 
---
 arch/x86/crypto/sha-mb/sha1_mb.c | 182 ++-
 crypto/mcryptd.c | 124 --
 include/crypto/internal/hash.h   |  12 +--
 include/crypto/mcryptd.h |   8 +-
 4 files changed, 163 insertions(+), 163 deletions(-)

diff --git a/arch/x86/crypto/sha-mb/sha1_mb.c b/arch/x86/crypto/sha-mb/sha1_mb.c
index 0a46491..ec2e76e 100644
--- a/arch/x86/crypto/sha-mb/sha1_mb.c
+++ b/arch/x86/crypto/sha-mb/sha1_mb.c
@@ -80,10 +80,10 @@ struct sha1_mb_ctx {
 static inline struct mcryptd_hash_request_ctx
*cast_hash_to_mcryptd_ctx(struct sha1_hash_ctx *hash_ctx)
 {
-   struct shash_desc *desc;
+   struct ahash_request *areq;
 
-   desc = container_of((void *) hash_ctx, struct shash_desc, __ctx);
-   return container_of(desc, struct mcryptd_hash_request_ctx, desc);
+   areq = container_of((void *) hash_ctx, struct ahash_request, __ctx);
+   return container_of(areq, struct mcryptd_hash_request_ctx, areq);
 }
 
 static inline struct ahash_request
@@ -93,7 +93,7 @@ static inline struct ahash_request
 }
 
 static void req_ctx_init(struct mcryptd_hash_request_ctx *rctx,
-   struct shash_desc *desc)
+   struct ahash_request *areq)
 {
rctx->flag = HASH_UPDATE;
 }
@@ -375,9 +375,9 @@ static struct sha1_hash_ctx *sha1_ctx_mgr_flush(struct 
sha1_ctx_mgr *mgr)
}
 }
 
-static int sha1_mb_init(struct shash_desc *desc)
+static int sha1_mb_init(struct ahash_request *areq)
 {
-   struct sha1_hash_ctx *sctx = shash_desc_ctx(desc);
+   struct sha1_hash_ctx *sctx = ahash_request_ctx(areq);
 
hash_ctx_init(sctx);
sctx->job.result_digest[0] = SHA1_H0;
@@ -395,7 +395,7 @@ static int sha1_mb_init(struct shash_desc *desc)
 static int sha1_mb_set_results(struct mcryptd_hash_request_ctx *rctx)
 {
int i;
-   struct  sha1_hash_ctx *sctx = shash_desc_ctx(>desc);
+   struct  sha1_hash_ctx *sctx = ahash_request_ctx(>areq);
__be32  *dst = (__be32 *) rctx->out;
 
for (i = 0; i < 5; ++i)
@@ -427,7 +427,7 @@ static int sha_finish_walk(struct mcryptd_hash_request_ctx 
**ret_rctx,
 
}
sha_ctx = (struct sha1_hash_ctx *)
-   shash_desc_ctx(>desc);
+   ahash_request_ctx(>areq);
kernel_fpu_begin();
sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx,
rctx->walk.data, nbytes, flag);
@@ -519,11 +519,10 @@ static void sha1_mb_add_list(struct 
mcryptd_hash_request_ctx *rctx,
mcryptd_arm_flusher(cstate, delay);
 }
 
-static int sha1_mb_update(struct shash_desc *desc, const u8 *data,
- unsigned int len)
+static int sha1_mb_update(struct ahash_request *areq)
 {
struct mcryptd_hash_request_ctx *rctx =
-   container_of(desc, struct mcryptd_hash_request_ctx, desc);
+   container_of(areq, struct mcryptd_hash_request_ctx, areq);
struct mcryptd_alg_cstate *cstate =
this_cpu_ptr(sha1_mb_alg_state.alg_cstate);
 
@@ -539,7 +538,7 @@ static int sha1_mb_update(struct shash_desc *desc, const u8 
*data,
}
 
/* need to init context */
-   req_ctx_init(rctx, desc);
+   req_ctx_init(rctx, areq);
 
nbytes = crypto_ahash_walk_first(req, >walk);
 
@@ -552,7 +551,7 @@ static int sha1_mb_update(struct shash_desc *desc, const u8 
*data,
rctx->flag |= HASH_DONE;
 
/* submit */
-   sha_ctx = (struct sha1_hash_ctx *) shash_desc_ctx(desc);
+   sha_ctx = (struct sha1_hash_ctx *) ahash_request_ctx(areq);
sha1_mb_add_list(rctx, cstate);
kernel_fpu_begin();
sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx, rctx->walk.data,
@@ -579,11 +578,10 @@ done:
return ret;
 }
 
-static int sha1_mb_finup(struct shash_desc *desc, const u8 *data,
-unsigned int len, u8 *out)
+static int sha1_mb_finup(struct ahash_request *areq)
 {
struct mcryptd_hash_request_ctx *rctx =
-   container_of(desc, struct mcryptd_hash_request_ctx, desc);
+   container_of(areq, struct mcryptd_hash_request_ctx, areq);
struct mcryptd_alg_cstate *cstate =
this_cpu_ptr(sha1_mb_alg_state.alg_cstate);
 
@@ -598,7 +596,7 @@ static int sha1_mb_finup(struct shash_desc *desc, 

Re: [PATCH 2/2] x86/entry: Inline enter_from_user_mode

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> This matches what is already done for prepare_exit_to_usermode,
> and saves about 60 clock cycles (4% speedup) with the benchmark
> in the previous commit message.
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 

Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 2/2] x86/entry: Inline enter_from_user_mode

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> This matches what is already done for prepare_exit_to_usermode,
> and saves about 60 clock cycles (4% speedup) with the benchmark
> in the previous commit message.
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 

Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


[PATCH] crypto : async implementation for sha1-mb

2016-06-20 Thread Megha Dey
From: Megha Dey 

Herbert wants the sha1-mb algorithm to have an async implementation:
https://lkml.org/lkml/2016/4/5/286.
Currently, sha1-mb uses an async interface for the outer algorithm
and a sync interface for the inner algorithm. This patch introduces
a async interface for even the inner algorithm.

Signed-off-by: Megha Dey 
Signed-off-by: Tim Chen 
---
 arch/x86/crypto/sha-mb/sha1_mb.c | 182 ++-
 crypto/mcryptd.c | 124 --
 include/crypto/internal/hash.h   |  12 +--
 include/crypto/mcryptd.h |   8 +-
 4 files changed, 163 insertions(+), 163 deletions(-)

diff --git a/arch/x86/crypto/sha-mb/sha1_mb.c b/arch/x86/crypto/sha-mb/sha1_mb.c
index 0a46491..ec2e76e 100644
--- a/arch/x86/crypto/sha-mb/sha1_mb.c
+++ b/arch/x86/crypto/sha-mb/sha1_mb.c
@@ -80,10 +80,10 @@ struct sha1_mb_ctx {
 static inline struct mcryptd_hash_request_ctx
*cast_hash_to_mcryptd_ctx(struct sha1_hash_ctx *hash_ctx)
 {
-   struct shash_desc *desc;
+   struct ahash_request *areq;
 
-   desc = container_of((void *) hash_ctx, struct shash_desc, __ctx);
-   return container_of(desc, struct mcryptd_hash_request_ctx, desc);
+   areq = container_of((void *) hash_ctx, struct ahash_request, __ctx);
+   return container_of(areq, struct mcryptd_hash_request_ctx, areq);
 }
 
 static inline struct ahash_request
@@ -93,7 +93,7 @@ static inline struct ahash_request
 }
 
 static void req_ctx_init(struct mcryptd_hash_request_ctx *rctx,
-   struct shash_desc *desc)
+   struct ahash_request *areq)
 {
rctx->flag = HASH_UPDATE;
 }
@@ -375,9 +375,9 @@ static struct sha1_hash_ctx *sha1_ctx_mgr_flush(struct 
sha1_ctx_mgr *mgr)
}
 }
 
-static int sha1_mb_init(struct shash_desc *desc)
+static int sha1_mb_init(struct ahash_request *areq)
 {
-   struct sha1_hash_ctx *sctx = shash_desc_ctx(desc);
+   struct sha1_hash_ctx *sctx = ahash_request_ctx(areq);
 
hash_ctx_init(sctx);
sctx->job.result_digest[0] = SHA1_H0;
@@ -395,7 +395,7 @@ static int sha1_mb_init(struct shash_desc *desc)
 static int sha1_mb_set_results(struct mcryptd_hash_request_ctx *rctx)
 {
int i;
-   struct  sha1_hash_ctx *sctx = shash_desc_ctx(>desc);
+   struct  sha1_hash_ctx *sctx = ahash_request_ctx(>areq);
__be32  *dst = (__be32 *) rctx->out;
 
for (i = 0; i < 5; ++i)
@@ -427,7 +427,7 @@ static int sha_finish_walk(struct mcryptd_hash_request_ctx 
**ret_rctx,
 
}
sha_ctx = (struct sha1_hash_ctx *)
-   shash_desc_ctx(>desc);
+   ahash_request_ctx(>areq);
kernel_fpu_begin();
sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx,
rctx->walk.data, nbytes, flag);
@@ -519,11 +519,10 @@ static void sha1_mb_add_list(struct 
mcryptd_hash_request_ctx *rctx,
mcryptd_arm_flusher(cstate, delay);
 }
 
-static int sha1_mb_update(struct shash_desc *desc, const u8 *data,
- unsigned int len)
+static int sha1_mb_update(struct ahash_request *areq)
 {
struct mcryptd_hash_request_ctx *rctx =
-   container_of(desc, struct mcryptd_hash_request_ctx, desc);
+   container_of(areq, struct mcryptd_hash_request_ctx, areq);
struct mcryptd_alg_cstate *cstate =
this_cpu_ptr(sha1_mb_alg_state.alg_cstate);
 
@@ -539,7 +538,7 @@ static int sha1_mb_update(struct shash_desc *desc, const u8 
*data,
}
 
/* need to init context */
-   req_ctx_init(rctx, desc);
+   req_ctx_init(rctx, areq);
 
nbytes = crypto_ahash_walk_first(req, >walk);
 
@@ -552,7 +551,7 @@ static int sha1_mb_update(struct shash_desc *desc, const u8 
*data,
rctx->flag |= HASH_DONE;
 
/* submit */
-   sha_ctx = (struct sha1_hash_ctx *) shash_desc_ctx(desc);
+   sha_ctx = (struct sha1_hash_ctx *) ahash_request_ctx(areq);
sha1_mb_add_list(rctx, cstate);
kernel_fpu_begin();
sha_ctx = sha1_ctx_mgr_submit(cstate->mgr, sha_ctx, rctx->walk.data,
@@ -579,11 +578,10 @@ done:
return ret;
 }
 
-static int sha1_mb_finup(struct shash_desc *desc, const u8 *data,
-unsigned int len, u8 *out)
+static int sha1_mb_finup(struct ahash_request *areq)
 {
struct mcryptd_hash_request_ctx *rctx =
-   container_of(desc, struct mcryptd_hash_request_ctx, desc);
+   container_of(areq, struct mcryptd_hash_request_ctx, areq);
struct mcryptd_alg_cstate *cstate =
this_cpu_ptr(sha1_mb_alg_state.alg_cstate);
 
@@ -598,7 +596,7 @@ static int sha1_mb_finup(struct shash_desc *desc, const u8 
*data,
}
 
/* need to init context */
-   

Re: [PATCH 3/2] context_tracking: move rcu_virt_note_context_switch out of kvm_host.h

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> Make kvm_guest_{enter,exit} and __kvm_guest_{enter,exit} trivial
> wrappers
> around the code in context_tracking.h.  Name the context_tracking.h
> functions
> consistently with what those for kernel<->user switch.
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 

Yay. I remember being confused by this when going
through the context tracking code last year.

Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 4/2] KVM: remove kvm_guest_enter/exit wrappers

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> Use the functions from context_tracking.h directly.
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 
Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 4/2] KVM: remove kvm_guest_enter/exit wrappers

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> Use the functions from context_tracking.h directly.
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 
Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 3/2] context_tracking: move rcu_virt_note_context_switch out of kvm_host.h

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> Make kvm_guest_{enter,exit} and __kvm_guest_{enter,exit} trivial
> wrappers
> around the code in context_tracking.h.  Name the context_tracking.h
> functions
> consistently with what those for kernel<->user switch.
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 

Yay. I remember being confused by this when going
through the context tracking code last year.

Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 1/2] x86/entry: Avoid interrupt flag save and restore

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> Thanks to all the work that was done by Andy Lutomirski and others,
> enter_from_user_mode and prepare_exit_to_usermode are now called only
> with
> interrupts disabled.  Let's provide them a version of
> user_enter/user_exit
> that skips saving and restoring the interrupt flag.
> 
> On an AMD-based machine I tested this patch on, with force-enabled
> context tracking, the speed-up in system calls was 90 clock cycles or
> 6%,
> measured with the following simple benchmark:
> 
> #include 
> #include 
> #include 
> #include 
> 
> unsigned long rdtsc()
> {
> unsigned long result;
> asm volatile("rdtsc; shl $32, %%rdx; mov %%eax, %%eax\n"
>  "or %%rdx, %%rax" : "=a" (result) : : "rdx");
> return result;
> }
> 
> int main()
> {
> unsigned long tsc1, tsc2;
> int pid = getpid();
> int i;
> 
> tsc1 = rdtsc();
> for (i = 0; i < 1; i++)
> kill(pid, SIGWINCH);
> tsc2 = rdtsc();
> 
> printf("%ld\n", tsc2 - tsc1);
> }
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 
Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


Re: [PATCH 1/2] x86/entry: Avoid interrupt flag save and restore

2016-06-20 Thread Rik van Riel
On Mon, 2016-06-20 at 16:58 +0200, Paolo Bonzini wrote:
> Thanks to all the work that was done by Andy Lutomirski and others,
> enter_from_user_mode and prepare_exit_to_usermode are now called only
> with
> interrupts disabled.  Let's provide them a version of
> user_enter/user_exit
> that skips saving and restoring the interrupt flag.
> 
> On an AMD-based machine I tested this patch on, with force-enabled
> context tracking, the speed-up in system calls was 90 clock cycles or
> 6%,
> measured with the following simple benchmark:
> 
> #include 
> #include 
> #include 
> #include 
> 
> unsigned long rdtsc()
> {
> unsigned long result;
> asm volatile("rdtsc; shl $32, %%rdx; mov %%eax, %%eax\n"
>  "or %%rdx, %%rax" : "=a" (result) : : "rdx");
> return result;
> }
> 
> int main()
> {
> unsigned long tsc1, tsc2;
> int pid = getpid();
> int i;
> 
> tsc1 = rdtsc();
> for (i = 0; i < 1; i++)
> kill(pid, SIGWINCH);
> tsc2 = rdtsc();
> 
> printf("%ld\n", tsc2 - tsc1);
> }
> 
> Cc: Andy Lutomirski 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: H. Peter Anvin 
> Cc: Ingo Molnar 
> Cc: Thomas Gleixner 
> Signed-off-by: Paolo Bonzini 
> 
Reviewed-by: Rik van Riel 

-- 
All Rights Reversed.



signature.asc
Description: This is a digitally signed message part


Re: [PATCH v9 09/12] kthread: Initial support for delayed kthread work

2016-06-20 Thread Tejun Heo
Hello,

On Thu, Jun 16, 2016 at 01:17:28PM +0200, Petr Mladek wrote:
> +/**
> + * kthread_delayed_work_timer_fn - callback that queues the associated 
> kthread
> + *   delayed work when the timer expires.
> + * @__data: pointer to the data associated with the timer
> + *
> + * The format of the function is defined by struct timer_list.
> + * It should have been called from irqsafe timer with irq already off.
> + */
> +void kthread_delayed_work_timer_fn(unsigned long __data)
> +{
> + struct kthread_delayed_work *dwork =
> + (struct kthread_delayed_work *)__data;
> + struct kthread_work *work = >work;
> + struct kthread_worker *worker = work->worker;
> +
> + /*
> +  * This might happen when a pending work is reinitialized.
> +  * It means that it is used a wrong way.
> +  */
> + if (WARN_ON_ONCE(!worker))
> + return;
> +
> + spin_lock(>lock);
> + /* Work must not be used with more workers, see kthread_queue_work(). */
 ^
 ditto, this reads weird

Other than that,

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH v9 09/12] kthread: Initial support for delayed kthread work

2016-06-20 Thread Tejun Heo
Hello,

On Thu, Jun 16, 2016 at 01:17:28PM +0200, Petr Mladek wrote:
> +/**
> + * kthread_delayed_work_timer_fn - callback that queues the associated 
> kthread
> + *   delayed work when the timer expires.
> + * @__data: pointer to the data associated with the timer
> + *
> + * The format of the function is defined by struct timer_list.
> + * It should have been called from irqsafe timer with irq already off.
> + */
> +void kthread_delayed_work_timer_fn(unsigned long __data)
> +{
> + struct kthread_delayed_work *dwork =
> + (struct kthread_delayed_work *)__data;
> + struct kthread_work *work = >work;
> + struct kthread_worker *worker = work->worker;
> +
> + /*
> +  * This might happen when a pending work is reinitialized.
> +  * It means that it is used a wrong way.
> +  */
> + if (WARN_ON_ONCE(!worker))
> + return;
> +
> + spin_lock(>lock);
> + /* Work must not be used with more workers, see kthread_queue_work(). */
 ^
 ditto, this reads weird

Other than that,

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH v2 4/5] ASoC: tpa6130a2: Add DAPM support

2016-06-20 Thread Helen Koike



On 20-06-2016 16:44, Lars-Peter Clausen wrote:

+   /* before widget power up */
+   if (SND_SOC_DAPM_EVENT_ON(event)) {
+   /* Turn on the chip */
+   tpa6130a2_power(data, true);
+   /* Sync the registers */
+   ret = regcache_sync(data->regmap);
+   if (ret < 0) {
+   dev_err(c->dev, "Failed to initialize chip\n");
+   tpa6130a2_power(data, false);
+   return ret;
+   }
+   /* after widget power down */
+   } else
+   tpa6130a2_power(data, false);


checkpatch.pl should complain about this. Kernel code style is if one branch
has branches the other has to have it as well.



Weird, checkpatch.pl doesn't complain. I'll add the braces in v3, thank 
you for reviewing


Re: [PATCH v2 4/5] ASoC: tpa6130a2: Add DAPM support

2016-06-20 Thread Helen Koike



On 20-06-2016 16:44, Lars-Peter Clausen wrote:

+   /* before widget power up */
+   if (SND_SOC_DAPM_EVENT_ON(event)) {
+   /* Turn on the chip */
+   tpa6130a2_power(data, true);
+   /* Sync the registers */
+   ret = regcache_sync(data->regmap);
+   if (ret < 0) {
+   dev_err(c->dev, "Failed to initialize chip\n");
+   tpa6130a2_power(data, false);
+   return ret;
+   }
+   /* after widget power down */
+   } else
+   tpa6130a2_power(data, false);


checkpatch.pl should complain about this. Kernel code style is if one branch
has branches the other has to have it as well.



Weird, checkpatch.pl doesn't complain. I'll add the braces in v3, thank 
you for reviewing


Re: [PATCH v9 08/12] kthread: Detect when a kthread work is used by more workers

2016-06-20 Thread Tejun Heo
Hello,

On Thu, Jun 16, 2016 at 01:17:27PM +0200, Petr Mladek wrote:
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 567ec49b4872..8e9548649c86 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -574,6 +574,9 @@ EXPORT_SYMBOL_GPL(__kthread_init_worker);
>   * The works are not allowed to keep any locks, disable preemption or 
> interrupts
>   * when they finish. There is defined a safe point for freezing when one work
>   * finishes and before a new one is started.
> + *
> + * Also the works must not be handled by more workers at the same time, see 
> also
^
than one
> + * kthread_queue_work().
>   */
>  int kthread_worker_fn(void *worker_ptr)
>  {
> @@ -710,12 +713,21 @@ kthread_create_worker_on_cpu(int cpu, const char 
> namefmt[], ...)
>  }
>  EXPORT_SYMBOL(kthread_create_worker_on_cpu);
>  
> +static void kthread_insert_work_sanity_check(struct kthread_worker *worker,
> +  struct kthread_work *work)
> +{
> + lockdep_assert_held(>lock);
> + WARN_ON_ONCE(!list_empty(>node));
> + /* Do not use a work with more workers, see kthread_queue_work() */
  ^
  ditto, maybe just say ">1 workers"?

Looks good otherwise.

Thanks.

-- 
tejun


Re: [PATCH v9 08/12] kthread: Detect when a kthread work is used by more workers

2016-06-20 Thread Tejun Heo
Hello,

On Thu, Jun 16, 2016 at 01:17:27PM +0200, Petr Mladek wrote:
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 567ec49b4872..8e9548649c86 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -574,6 +574,9 @@ EXPORT_SYMBOL_GPL(__kthread_init_worker);
>   * The works are not allowed to keep any locks, disable preemption or 
> interrupts
>   * when they finish. There is defined a safe point for freezing when one work
>   * finishes and before a new one is started.
> + *
> + * Also the works must not be handled by more workers at the same time, see 
> also
^
than one
> + * kthread_queue_work().
>   */
>  int kthread_worker_fn(void *worker_ptr)
>  {
> @@ -710,12 +713,21 @@ kthread_create_worker_on_cpu(int cpu, const char 
> namefmt[], ...)
>  }
>  EXPORT_SYMBOL(kthread_create_worker_on_cpu);
>  
> +static void kthread_insert_work_sanity_check(struct kthread_worker *worker,
> +  struct kthread_work *work)
> +{
> + lockdep_assert_held(>lock);
> + WARN_ON_ONCE(!list_empty(>node));
> + /* Do not use a work with more workers, see kthread_queue_work() */
  ^
  ditto, maybe just say ">1 workers"?

Looks good otherwise.

Thanks.

-- 
tejun


Re: [PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error

2016-06-20 Thread Daniel Lezcano

On 06/20/2016 07:50 PM, Ray Jui wrote:

[ ... ]


-CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init);


Looks good to me!

Acked-by: Ray Jui 


Can you have a quick look at the patch [63/63] for the kona part where 
CLOCKSOURCE_OF_DECLARE_RET is renamed back to CLOCKSOURCE_OF_DECLARE ?


Thanks !

  -- Daniel


--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog



Re: [PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error

2016-06-20 Thread Daniel Lezcano

On 06/20/2016 07:50 PM, Ray Jui wrote:

[ ... ]


-CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init);


Looks good to me!

Acked-by: Ray Jui 


Can you have a quick look at the patch [63/63] for the kona part where 
CLOCKSOURCE_OF_DECLARE_RET is renamed back to CLOCKSOURCE_OF_DECLARE ?


Thanks !

  -- Daniel


--
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog



[PATCH 8/8] arm64: dts: db820c: add support to external sd card.

2016-06-20 Thread Srinivas Kandagatla
This patch adds support to external sd card.

Signed-off-by: Srinivas Kandagatla 
---
 arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi | 39 +++
 arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi  | 10 ++
 2 files changed, 49 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi

diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi 
b/arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi
new file mode 100644
index 000..24552f1
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+ {
+   sdc2_cd_on: sdc2_cd_on {
+   mux {
+   pins = "gpio38";
+   function = "gpio";
+   };
+
+   config {
+   pins = "gpio38";
+   bias-pull-up;   /* pull up */
+   drive-strength = <16>;  /* 16 MA */
+   };
+   };
+
+   sdc2_cd_off: sdc2_cd_off {
+   mux {
+   pins = "gpio38";
+   function = "gpio";
+   };
+
+   config {
+   pins = "gpio38";
+   bias-pull-up;   /* pull up */
+   drive-strength = <2>;   /* 2 MA */
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi 
b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
index 08b063d..3fbd23e 100644
--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
@@ -12,6 +12,7 @@
  */
 
 #include "msm8996.dtsi"
+#include "apq8096-db820c-pins.dtsi"
 
 / {
aliases {
@@ -74,5 +75,14 @@
label = "HS-SPI1";
status = "okay";
};
+
+   sdhci@74A4900 {
+   /* External SD card */
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_clk_on _cmd_on _data_on 
_cd_on>;
+   pinctrl-1 = <_clk_off _cmd_off _data_off 
_cd_off>;
+   cd-gpios = < 38 0x1>;
+   status = "okay";
+   };
};
 };
-- 
2.7.4



[PATCH 8/8] arm64: dts: db820c: add support to external sd card.

2016-06-20 Thread Srinivas Kandagatla
This patch adds support to external sd card.

Signed-off-by: Srinivas Kandagatla 
---
 arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi | 39 +++
 arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi  | 10 ++
 2 files changed, 49 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi

diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi 
b/arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi
new file mode 100644
index 000..24552f1
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+ {
+   sdc2_cd_on: sdc2_cd_on {
+   mux {
+   pins = "gpio38";
+   function = "gpio";
+   };
+
+   config {
+   pins = "gpio38";
+   bias-pull-up;   /* pull up */
+   drive-strength = <16>;  /* 16 MA */
+   };
+   };
+
+   sdc2_cd_off: sdc2_cd_off {
+   mux {
+   pins = "gpio38";
+   function = "gpio";
+   };
+
+   config {
+   pins = "gpio38";
+   bias-pull-up;   /* pull up */
+   drive-strength = <2>;   /* 2 MA */
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi 
b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
index 08b063d..3fbd23e 100644
--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
@@ -12,6 +12,7 @@
  */
 
 #include "msm8996.dtsi"
+#include "apq8096-db820c-pins.dtsi"
 
 / {
aliases {
@@ -74,5 +75,14 @@
label = "HS-SPI1";
status = "okay";
};
+
+   sdhci@74A4900 {
+   /* External SD card */
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_clk_on _cmd_on _data_on 
_cd_on>;
+   pinctrl-1 = <_clk_off _cmd_off _data_off 
_cd_off>;
+   cd-gpios = < 38 0x1>;
+   status = "okay";
+   };
};
 };
-- 
2.7.4



<    2   3   4   5   6   7   8   9   10   11   >