mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Alexander Boyko <alexander.boyko@seagate.com>,
	James Simmons <jsimmons@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Subject: [PATCH review for 3.18 10/12] staging: lustre: ptlrpc: skip lock if export failed
Date: Sat, 7 Oct 2017 22:38:01 +0000	[thread overview]
Message-ID: <20171007223752.25085-10-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171007223752.25085-1-alexander.levin@verizon.com>

From: Alexander Boyko <alexander.boyko@seagate.com>

[ Upstream commit 4c43c27ddc461d8473cedd70f2549614641dfbc7 ]

This patch resolves IO vs eviction race.
After eviction failed export stayed at stale list,
a client had IO processing and reconnected during it.
A client sent brw rpc with last lock cookie and new connection.
The lock with failed export was found and assert was happened.
 (ost_handler.c:1812:ost_prolong_lock_one())
  ASSERTION( lock->l_export == opd->opd_exp ) failed:

 1. Skip the lock at ldlm_handle2lock if lock export failed.
 2. Validation of lock for IO was added at hpreq_check(). The lock
    searching is based on granted interval tree. If server doesn`t
    have a valid lock, it reply to client with ESTALE.

Signed-off-by: Alexander Boyko <alexander.boyko@seagate.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7702
Seagate-bug-id: MRP-2787
Reviewed-on: http://review.whamcloud.com/18120
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |  7 +++++++
 drivers/staging/lustre/lustre/ptlrpc/service.c | 21 ++++++++-------------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index 6140130b6056..23ce4a9d09f4 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -573,6 +573,13 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle,
 	if (lock == NULL)
 		return NULL;
 
+	if (lock->l_export && lock->l_export->exp_failed) {
+		CDEBUG(D_INFO, "lock export failed: lock %p, exp %p\n",
+		       lock, lock->l_export);
+		LDLM_LOCK_PUT(lock);
+		return NULL;
+	}
+
 	/* It's unlikely but possible that someone marked the lock as
 	 * destroyed after we did handle2object on it */
 	if (flags == 0 && ((lock->l_flags & LDLM_FL_DESTROYED)== 0)) {
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
index a8df8a792333..7ca8d24464f6 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -1506,20 +1506,15 @@ static int ptlrpc_server_hpreq_init(struct ptlrpc_service_part *svcpt,
 		 * it may hit swab race at LU-1044. */
 		if (req->rq_ops->hpreq_check) {
 			rc = req->rq_ops->hpreq_check(req);
-			/**
-			 * XXX: Out of all current
-			 * ptlrpc_hpreq_ops::hpreq_check(), only
-			 * ldlm_cancel_hpreq_check() can return an error code;
-			 * other functions assert in similar places, which seems
-			 * odd. What also does not seem right is that handlers
-			 * for those RPCs do not assert on the same checks, but
-			 * rather handle the error cases. e.g. see
-			 * ost_rw_hpreq_check(), and ost_brw_read(),
-			 * ost_brw_write().
+			if (rc == -ESTALE) {
+				req->rq_status = rc;
+				ptlrpc_error(req);
+			}
+			/** can only return error,
+			 * 0 for normal request,
+			 *  or 1 for high priority request
 			 */
-			if (rc < 0)
-				return rc;
-			LASSERT(rc == 0 || rc == 1);
+			LASSERT(rc <= 1);
 		}
 
 		spin_lock_bh(&req->rq_export->exp_rpc_lock);
-- 
2.11.0

  parent reply	other threads:[~2017-10-07 22:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-07 22:37 [PATCH review for 3.18 01/12] mmc: s3cmci: include linux/interrupt.h for tasklet_struct Levin, Alexander (Sasha Levin)
2017-10-07 22:37 ` [PATCH review for 3.18 02/12] staging: rtl8712u: Fix endian settings for structs describing network packets Levin, Alexander (Sasha Levin)
2017-10-07 22:37 ` [PATCH review for 3.18 03/12] ext4: fix stripe-unaligned allocations Levin, Alexander (Sasha Levin)
2017-10-07 22:37 ` [PATCH review for 3.18 04/12] ext4: do not use stripe_width if it is not set Levin, Alexander (Sasha Levin)
2017-10-07 22:38 ` [PATCH review for 3.18 05/12] i2c: riic: correctly finish transfers Levin, Alexander (Sasha Levin)
2017-10-07 22:38 ` [PATCH review for 3.18 06/12] [media] cx231xx: Fix I2C on Internal Master 3 Bus Levin, Alexander (Sasha Levin)
2017-10-07 22:38 ` [PATCH review for 3.18 07/12] xen/manage: correct return value check on xenbus_scanf() Levin, Alexander (Sasha Levin)
2017-10-07 22:38 ` [PATCH review for 3.18 08/12] platform/x86: intel_mid_thermal: Fix module autoload Levin, Alexander (Sasha Levin)
2017-10-07 22:38 ` [PATCH review for 3.18 11/12] s390/dasd: check for device error pointer within state change interrupts Levin, Alexander (Sasha Levin)
2017-10-07 22:38 ` Levin, Alexander (Sasha Levin) [this message]
2017-10-07 22:38 ` [PATCH review for 3.18 12/12] [media] bt8xx: fix memory leak Levin, Alexander (Sasha Levin)
2017-10-07 22:38 ` [PATCH review for 3.18 09/12] staging: lustre: hsm: stack overrun in hai_dump_data_field Levin, Alexander (Sasha Levin)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171007223752.25085-10-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=alexander.boyko@seagate.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®