Whamcloud - gitweb
merge tiny patch from HP for lfsck
authorphil <phil>
Sat, 12 Jun 2004 14:33:47 +0000 (14:33 +0000)
committerphil <phil>
Sat, 12 Jun 2004 14:33:47 +0000 (14:33 +0000)
lustre/include/lustre/lustre_user.h
lustre/llite/file.c
lustre/lov/lov_obd.c
lustre/obdfilter/filter.c
lustre/osc/osc_create.c

index 804c163..2ad7215 100644 (file)
@@ -92,6 +92,8 @@ extern int get_file_stripe(char *path, struct lov_user_md *lum);
 struct ll_recreate_obj {
         __u64 lrc_id;
         __u32 lrc_ost_idx;
+        __u32 lrc_padding;
+        __u64 lrc_group;
 };
 
 struct obd_uuid {
index 84b8f2f..a1793cf 100644 (file)
@@ -882,7 +882,8 @@ static int ll_lov_recreate_obj(struct inode *inode, struct file *file,
 
         oa->o_id = ucreatp.lrc_id; 
         oa->o_nlink = ucreatp.lrc_ost_idx;
-        oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS;
+        oa->o_gr = ucreatp.lrc_group;
+        oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLFLAGS;
         oa->o_flags |= OBD_FL_RECREATE_OBJS;
         obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
                                    OBD_MD_FLMTIME | OBD_MD_FLCTIME);
index 1f23936..494661a 100644 (file)
@@ -609,8 +609,8 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa,
                 RETURN(-EIO);
 
         /* Recreate a specific object id at the given OST index */
-        if (src_oa->o_valid & OBD_MD_FLFLAGS && src_oa->o_flags &
-                                                OBD_FL_RECREATE_OBJS) {
+        if ((src_oa->o_valid & OBD_MD_FLFLAGS) &&
+            (src_oa->o_flags & OBD_FL_RECREATE_OBJS)) {
                  struct lov_stripe_md obj_md;
                  struct lov_stripe_md *obj_mdp = &obj_md;
 
@@ -622,8 +622,10 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa,
                          RETURN(-EINVAL);
                  for (i = 0; i < lsm->lsm_stripe_count; i++) {
                          if (lsm->lsm_oinfo[i].loi_ost_idx == ost_idx) {
-                                 if (lsm->lsm_oinfo[i].loi_id != src_oa->o_id)
+                                 if (lsm->lsm_oinfo[i].loi_id != src_oa->o_id ||
+                                     lsm->lsm_oinfo[i].loi_gr != src_oa->o_gr) {
                                          RETURN(-EINVAL);
+                                 }
                                  break;
                          }
                  }
index 27f847e..2d4360b 100644 (file)
@@ -2205,9 +2205,8 @@ static int filter_create(struct obd_export *exp, struct obdo *oa,
         struct lvfs_run_ctxt saved;
         struct lov_stripe_md *lsm = NULL;
         struct filter_export_data *fed;
-        int group = oa->o_gr;
         char str[PTL_NALFMT_SIZE];
-        int rc = 0, diff;
+        int group = oa->o_gr, rc = 0, diff, recreate_objs = 0;
         ENTRY;
 
         if (!(oa->o_valid & OBD_MD_FLGROUP) || group == 0) {
@@ -2218,11 +2217,17 @@ static int filter_create(struct obd_export *exp, struct obdo *oa,
                 RETURN(-EINVAL);
         }
 
+        if ((oa->o_valid & OBD_MD_FLFLAGS) &&
+            (oa->o_flags & OBD_FL_RECREATE_OBJS)) {
+                recreate_objs = 1;
+        }
+
         obd = exp->exp_obd;
         fed = &exp->exp_filter_data;
         filter = &obd->u.filter;
 
-        if (fed->fed_group != group && !(oa->o_valid & OBD_MD_REINT)) {
+        if (fed->fed_group != group && !recreate_objs &&
+            !(oa->o_valid & OBD_MD_REINT)) {
                 portals_nid2str(exp->exp_connection->c_peer.peer_ni->pni_number,
                                 exp->exp_connection->c_peer.peer_nid, str);
                 CERROR("!!! This export (nid "LPX64"/%s) used object group %d "
@@ -2250,8 +2255,7 @@ static int filter_create(struct obd_export *exp, struct obdo *oa,
         if (oa->o_valid & OBD_MD_REINT) {
                 int num = *((int*)oa->o_inline);  
                 rc = filter_precreate(obd, oa, oa->o_gr, &num);
-        } else if ((oa->o_valid & OBD_MD_FLFLAGS) &&
-                   (oa->o_flags & OBD_FL_RECREATE_OBJS)) {
+        } else if (recreate_objs) {
                 if (oa->o_id > filter_last_id(&obd->u.filter, group)) {
                         CERROR("recreate objid "LPU64" > last id "LPU64"\n",
                                oa->o_id, filter_last_id(&obd->u.filter, group));
index a3ebcc5..a6d3619 100644 (file)
@@ -217,17 +217,21 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
         LASSERT(oa->o_valid & OBD_MD_FLGROUP);
         LASSERT(oa->o_gr > 0);
 
+        if ((oa->o_valid & OBD_MD_FLFLAGS) &&
+            oa->o_flags == OBD_FL_RECREATE_OBJS) {
+                /* Exceptional case where we are trying to repair missing
+                 * objects for various groups.  We have already validated that
+                 * this is a valid group for the file.  Don't set oscc->oscc_gr.
+                 */
+                RETURN(osc_real_create(exp, oa, ea, oti));
+        }
+
         LASSERT(oscc->oscc_gr == 0 || oscc->oscc_gr == oa->o_gr);
         oscc->oscc_gr = oa->o_gr;
 
         if (oa->o_gr == FILTER_GROUP_LLOG || oa->o_gr == FILTER_GROUP_ECHO)
                 RETURN(osc_real_create(exp, oa, ea, oti));
 
-        if ((oa->o_valid & OBD_MD_FLFLAGS) &&
-            oa->o_flags == OBD_FL_RECREATE_OBJS) { 
-                RETURN(osc_real_create(exp, oa, ea, oti));
-        }
-
         lsm = *ea;
         if (lsm == NULL) {
                 rc = obd_alloc_memmd(exp, &lsm);