Whamcloud - gitweb
LU-11835 mdt: return DOM size on open resend 44/34044/5
authorMikhail Pershin <mpershin@whamcloud.com>
Wed, 16 Jan 2019 13:24:58 +0000 (16:24 +0300)
committerOleg Drokin <green@whamcloud.com>
Thu, 21 Mar 2019 03:42:33 +0000 (03:42 +0000)
DOM size is returned along with DOM lock always, but it is
not true with open resend.

Patch fixes that issue and adds test case.

Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I73d43933f781f192e9aa8c6ee388a043dab5bde9
Reviewed-on: https://review.whamcloud.com/34044
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdc/mdc_locks.c
lustre/mdt/mdt_open.c
lustre/tests/recovery-small.sh

index 66694f5..accea01 100644 (file)
@@ -746,7 +746,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 
                body = req_capsule_server_get(pill, &RMF_MDT_BODY);
                if (!(body->mbo_valid & OBD_MD_DOM_SIZE)) {
 
                body = req_capsule_server_get(pill, &RMF_MDT_BODY);
                if (!(body->mbo_valid & OBD_MD_DOM_SIZE)) {
-                       LDLM_ERROR(lock, "%s: DoM lock without size.\n",
+                       LDLM_ERROR(lock, "%s: DoM lock without size.",
                                   exp->exp_obd->obd_name);
                        GOTO(out_lock, rc = -EPROTO);
                }
                                   exp->exp_obd->obd_name);
                        GOTO(out_lock, rc = -EPROTO);
                }
index 8555c72..602bc6a 100644 (file)
@@ -704,41 +704,35 @@ void mdt_reconstruct_open(struct mdt_thread_info *info,
                }
 
                if (unlikely(mdt_object_remote(child))) {
                }
 
                if (unlikely(mdt_object_remote(child))) {
+                       mdt_object_put(env, parent);
+                       mdt_object_put(env, child);
                        /* the child object was created on remote server */
                        /* the child object was created on remote server */
-                       if (!mdt_is_dne_client(exp)) {
+                       if (!mdt_is_dne_client(exp))
                                /* Return -EIO for old client */
                                /* Return -EIO for old client */
-                               mdt_object_put(env, parent);
-                               mdt_object_put(env, child);
                                GOTO(out, rc = -EIO);
                                GOTO(out, rc = -EIO);
-                       }
                        repbody->mbo_fid1 = *rr->rr_fid2;
                        repbody->mbo_valid |= (OBD_MD_FLID | OBD_MD_MDS);
                        repbody->mbo_fid1 = *rr->rr_fid2;
                        repbody->mbo_valid |= (OBD_MD_FLID | OBD_MD_MDS);
-                       rc = 0;
-               } else {
-                       if (mdt_object_exists(child)) {
-                               mdt_prep_ma_buf_from_rep(info, child, ma);
-                               rc = mdt_attr_get_complex(info, child, ma);
-                               if (rc == 0)
-                                       rc = mdt_finish_open(info, parent,
-                                                            child, open_flags,
-                                                            1, ldlm_rep);
-                       } else {
-                               /* the child does not exist, we should do
-                                * regular open */
-                               mdt_object_put(env, parent);
-                               mdt_object_put(env, child);
-                               GOTO(regular_open, 0);
-                       }
+                       GOTO(out, rc = 0);
                }
                }
+               if (mdt_object_exists(child)) {
+                       mdt_prep_ma_buf_from_rep(info, child, ma);
+                       rc = mdt_attr_get_complex(info, child, ma);
+                       if (!rc)
+                               rc = mdt_finish_open(info, parent, child,
+                                                    open_flags, 1, ldlm_rep);
+                       mdt_object_put(env, parent);
+                       mdt_object_put(env, child);
+                       if (!rc)
+                               mdt_pack_size2body(info, rr->rr_fid2,
+                                                  &lhc->mlh_reg_lh);
+                       GOTO(out, rc);
+               }
+               /* the child does not exist, we should do regular open */
                mdt_object_put(env, parent);
                mdt_object_put(env, child);
                mdt_object_put(env, parent);
                mdt_object_put(env, child);
-               GOTO(out, rc);
-       } else {
-regular_open:
-               /* We did not try to create, so we are a pure open */
-               rc = mdt_reint_open(info, lhc);
        }
        }
-
+       /* We did not try to create, so we are a pure open */
+       rc = mdt_reint_open(info, lhc);
        EXIT;
 out:
        req->rq_status = rc;
        EXIT;
 out:
        req->rq_status = rc;
index 02fc696..87f9986 100755 (executable)
@@ -2739,6 +2739,21 @@ test_134() {
 }
 run_test 134 "race between failover and search for reply data free slot"
 
 }
 run_test 134 "race between failover and search for reply data free slot"
 
+test_135() {
+       [ $MDS1_VERSION -lt $(version_code 2.12.51) ] &&
+               skip "Need MDS version at least 2.12.51"
+
+       mkdir -p $DIR/$tdir
+       $LFS setstripe -E 1M -L mdt $DIR/$tdir
+       # to have parent dir write lock before open/resend
+       touch $DIR/$tdir/$tfile
+       #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
+       do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param fail_loc=0x80000157
+       openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tdir/$tfile ||
+               error "Failed to open DOM file"
+}
+run_test 135 "DOM: open/create resend to return size"
+
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status