Whamcloud - gitweb
- generate capability in open resend case
authoralex <alex>
Wed, 21 Sep 2005 21:14:26 +0000 (21:14 +0000)
committeralex <alex>
Wed, 21 Sep 2005 21:14:26 +0000 (21:14 +0000)
- regression test for the case

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

index f00cac4..4790488 100644 (file)
@@ -622,6 +622,15 @@ static void reconstruct_open(struct mds_update_record *rec, int offset,
         /* get lock (write for O_CREAT, read otherwise) */
         mds_pack_inode2body(obd, body, dchild->d_inode, 1);
         if (S_ISREG(dchild->d_inode->i_mode)) {
+                struct lustre_capa capa = {
+                        .lc_uid   = rec->ur_uc.luc_uid,
+                        .lc_op    = capa_op(rec->ur_flags),
+                        .lc_ino   = dchild->d_inode->i_ino,
+                        .lc_igen  = dchild->d_inode->i_generation,
+                        .lc_mdsid = mds->mds_num,
+                };
+                int off = 7; /* capa offset */
+
                 rc = mds_pack_md(obd, req->rq_repmsg, 2, body,
                                  dchild->d_inode, 1, 0);
 
@@ -632,7 +641,7 @@ static void reconstruct_open(struct mds_update_record *rec, int offset,
                 if (!(body->valid & OBD_MD_FLEASIZE))
                         body->valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
                                         OBD_MD_FLATIME | OBD_MD_FLMTIME);
-                DEBUG_REQ(D_ERROR, req, "no capa for "DLID4, OLID4(&body->id1));
+                rc = mds_pack_capa(obd, med, NULL, &capa, req, &off, body);
         }
         
         /* If we have -EEXIST as the status, and we were asked to create
index 742c114..06e2ab6 100755 (executable)
@@ -1313,6 +1313,19 @@ test_57() {
 }
 run_test 57 "open orphan in reconstruct_open()"
 
+test_58() {
+       capa=`cat /proc/fs/lustre/mds/mds*/capa`
+       if [ "$capa" == "0" ]; then
+               echo "skip testing - no capa enabled"
+               return 0
+       fi
+       sysctl -w lustre.fail_loc=0x0000030c
+       rc=multiop $DIR/$tfile Ow
+       sysctl -w lustre.fail_loc=0
+       return rc
+}
+run_test 58 "open+create resent should return capa"
+
 equals_msg test complete, cleaning up
 $CLEANUP