Whamcloud - gitweb
b=7312
authoralex <alex>
Sun, 14 Aug 2005 11:32:29 +0000 (11:32 +0000)
committeralex <alex>
Sun, 14 Aug 2005 11:32:29 +0000 (11:32 +0000)
 - open file by fid in REPLAY|RESENT case because parent can disapper by
   that time

lustre/mds/mds_open.c
lustre/tests/replay-single.sh

index 90fbf58..7b435b6 100644 (file)
@@ -581,7 +581,13 @@ static void reconstruct_open(struct mds_update_record *rec, int offset,
                 return; /* error looking up parent or child */
         }
 
-        if (rec->ur_namelen == 1) {
+        /* first, we try to open the file by fid. by the time of this
+         * request, inode can be an orphan and parent can disappear */
+        if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
+                CDEBUG(D_HA, "OPEN by fid "DLID4" (RESENT|REPLAY)\n",
+                       OLID4(rec->ur_id2));
+                dchild = mds_id2dentry(obd, rec->ur_id2, NULL);
+        } else if (rec->ur_namelen == 1) {
                 CDEBUG(D_HA, "OPEN by fid "DLID4" (RESENT)\n",
                        OLID4(rec->ur_id1));
                 dchild = mds_id2dentry(obd, rec->ur_id1, NULL);
index ccfbf75..742c114 100755 (executable)
@@ -40,12 +40,9 @@ gen_config() {
        MDS=lmv1
     else
         add_mds $SINGLEMDS --dev $MDSDEV --size $MDSSIZE
-        if [ ! -z "$$SINGLEMDSfailover_HOST" ]; then
-            add_mdsfailover $SINGLEMDS --dev $MDSDEV --size $MDSSIZE
-        fi
        add_lov lov1 $SINGLEMDS --stripe_sz $STRIPE_BYTES \
            --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
-       MDS=$SINGLEMDS_svc
+       MDS=$SINGLEMDS
     fi
     
     add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
@@ -1297,6 +1294,25 @@ test_56() {
 }
 run_test 56 "let MDS_CHECK_RESENT return the original return code instead of 0"
 
+#b7312 LASSERT(!IS_ERR(parent)) in reconstruct_open()
+test_57() {
+    mkdir $DIR/$tdir || return 1
+    touch $DIR/$tdir/$tfile || return 2
+    multiop $DIR/$tdir/$tfile o_ &
+    MULTIPID=$!
+    sleep 1
+    rm -f $DIR/$tdir/$tfile || return 3
+    rm -rf $DIR/$tdir || return 4
+    # drop first reint reply
+    sysctl -w lustre.fail_loc=0x0000030c
+    facet_failover $SINGLEMDS
+    df $MOUNT || return 1
+    kill -USR1 $MULTIPID || return 5
+    wait $MULTIPID || return 6
+    sysctl -w lustre.fail_loc=0
+}
+run_test 57 "open orphan in reconstruct_open()"
+
 equals_msg test complete, cleaning up
 $CLEANUP