Whamcloud - gitweb
LU-9311 pfl: shouldn't reprocess no-op layout change resent 30/26730/3
authorBobi Jam <bobijam.xu@intel.com>
Wed, 19 Apr 2017 03:52:18 +0000 (11:52 +0800)
committerJinshan Xiong <jinshan.xiong@intel.com>
Fri, 28 Apr 2017 17:43:06 +0000 (17:43 +0000)
There is another layout change resent case: the client's job has been
done by another client, referring lod_declare_layout_change -EALREADY
case, and it became a operation w/o transaction, so we should not do
the layout change, otherwise mdt_layout_change() will try to cancel
the granted server CR lock whose remote counterpart is still in hold
on the client, and a deadlock ensues.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: I1a63fcd56f13790c4c7ccb1087b82acba81e88d6
Reviewed-on: https://review.whamcloud.com/26730
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/mdt/mdt_handler.c

index 2f323a0..af731ea 100644 (file)
@@ -3572,6 +3572,19 @@ static int mdt_intent_layout(enum mdt_it_code opcode,
                if (rc)
                        GOTO(out_obj, rc = rc < 0 ? rc : 0);
 
+               /**
+                * There is another resent case: the client's job has been
+                * done by another client, referring lod_declare_layout_change
+                * -EALREADY case, and it became a operation w/o transaction,
+                * so we should not do the layout change, otherwise
+                * mdt_layout_change() will try to cancel the granted server
+                * CR lock whose remote counterpart is still in hold on the
+                * client, and a deadlock ensues.
+                */
+               rc = mdt_check_resent_lock(info, obj, lhc);
+               if (rc <= 0)
+                       GOTO(out_obj, rc);
+
                buf->lb_buf = NULL;
                buf->lb_len = 0;
                if (unlikely(req_is_replay(mdt_info_req(info)))) {