Whamcloud - gitweb
The variable, not the literal. Thanks mjmac.
[fs/lustre-release.git] / lustre / mds / mds_audit_path.c
index b47676f..637aeea 100644 (file)
@@ -299,7 +299,7 @@ static int parse_id(struct obd_device *obd, struct parseid_pkg *pkg)
                         RETURN(rc);
 
                 exp = lmv->tgts[mds_num].ltd_exp;
-                LASSERT(exp);
+                LASSERTF(exp, "No export for MDS #%i\n", mds_num);
 
                 req = ptlrpc_prep_req(class_exp2cliimp(exp), 
                                       LUSTRE_MDS_VERSION, MDS_PARSE_ID, 1, 
@@ -399,21 +399,20 @@ scan_audit_log_cb(struct llog_handle *llh, struct llog_rec_hdr *rec, void *data)
                 CERROR("log is not plain\n");
                 RETURN(-EINVAL);
         }
-
+        
         if (rec->lrh_type != SMFS_AUDIT_NAME_REC)
                 RETURN(0);
-
+        
         ad_rec = (struct audit_record *)(rec + 1);
-
-        if (ad_rec->result || 
-            ad_rec->opcode != AUDIT_UNLINK ||
-            ad_rec->opcode != AUDIT_RENAME)
+        if (ad_rec->result ||
+            (ad_rec->opcode != AUDIT_UNLINK &&
+             ad_rec->opcode != AUDIT_RENAME))
                 RETURN(0);
 
         cid_rec = (struct audit_id_record *)(ad_rec + 1);
         pid_rec = cid_rec + 1;
         nm_rec = (struct audit_name_record *)(pid_rec + 1);
-        
+                
         if (cid_rec->au_num == id_ino(&pkg->pp_id1) &&
             cid_rec->au_gen == id_gen(&pkg->pp_id1)) {
                 LASSERT(pid_rec->au_fid);
@@ -426,7 +425,6 @@ scan_audit_log_cb(struct llog_handle *llh, struct llog_rec_hdr *rec, void *data)
                 /* get name */
                 memcpy(pkg->pp_name, nm_rec->name, 
                        le32_to_cpu(nm_rec->name_len));
-
                 RETURN(LLOG_PROC_BREAK);
         }
         RETURN(0);
@@ -452,6 +450,8 @@ local_scan_audit_log(struct obd_device *obd, struct parseid_pkg *pkg)
         if (rc != LLOG_PROC_BREAK) {
                 CWARN("process catalog log failed: rc(%d)\n", rc);
                 rc = -ENOENT;
+        } else {
+                rc = 0;
         }
 out:
         pkg->pp_rc = rc;
@@ -490,7 +490,7 @@ scan_audit_log(struct obd_device *obd, struct lustre_id *cur_id,
                         RETURN(rc);
 
                 exp = lmv->tgts[mds_num].ltd_exp;
-                LASSERT(exp);
+                LASSERTF(exp, "No export for MDS #%i\n", mds_num);
 
                 req = ptlrpc_prep_req(class_exp2cliimp(exp), 
                                       LUSTRE_MDS_VERSION, MDS_PARSE_ID, 1, 
@@ -551,7 +551,7 @@ mds_audit_id2name(struct obd_device *obd, char **name, int *namelen,
         INIT_LIST_HEAD(&list);
 
         cur_id = *id;
-        if (!id_fid(&cur_id)) {
+        if (!id_ino(&cur_id)) {
                 CERROR("Invalid id!\n");
                 RETURN(-EINVAL);
         }
@@ -563,7 +563,6 @@ next:
         rc = mds_id2name(obd, &cur_id, &list, &parent_id);
         if (rc == -ENOENT) {
                 /* can't reconstruct name from id, turn to audit log */
-                LASSERT(id_fid(&parent_id));
                 cur_id = parent_id;
                 memset(&parent_id, 0, sizeof(parent_id));
 
@@ -601,7 +600,8 @@ out:
                 }
                 list_del_init(&item->link);
                 OBD_FREE(item, sizeof(*item));
-                LASSERT(strlen(*name) < *namelen);
+                if (*name)
+                        LASSERT(strlen(*name) < *namelen);
         }
         RETURN(rc);
 }