Whamcloud - gitweb
- root fid is 2 not 1
authortappro <tappro>
Mon, 8 Aug 2005 13:52:44 +0000 (13:52 +0000)
committertappro <tappro>
Mon, 8 Aug 2005 13:52:44 +0000 (13:52 +0000)
- remove unneeded debug

lustre/lvfs/llog_cat.c
lustre/mds/mds_audit_path.c
lustre/smfs/audit.c
lustre/smfs/audit_transfer.c
lustre/smfs/fsfilt.c
lustre/tests/lsmfs.sh

index b7a5c8f..deadb3d 100644 (file)
@@ -371,7 +371,7 @@ static int llog_cat_process_cb(struct llog_handle *cat_llh,
                 CERROR("invalid record in catalog\n");
                 RETURN(-EINVAL);
         }
-        CWARN("processing log "LPX64":%x at index %u of catalog "LPX64"\n",
+        CDEBUG(D_INFO, "processing log "LPX64":%x at index %u of catalog "LPX64"\n",
                lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen,
                le32_to_cpu(rec->lrh_index), cat_llh->lgh_id.lgl_oid);
 
index 0de8d14..54b5c9d 100644 (file)
@@ -311,7 +311,7 @@ out:
         RETURN(rc);
 }
 
-#define ROOT_FID        1
+#define ROOT_FID        2
 struct name_item {
         struct list_head link;
         char             name[NAME_MAX + 1];
index 0e7dd0c..a709f91 100644 (file)
@@ -196,7 +196,7 @@ int smfs_audit_check(struct inode * parent, hook_op hook, int ret,
         if (rc < 0)
                 RETURN(0);
         //should only failures be audited?
-        if (!ret && IS_AUDIT_OP(mask, AUDIT_FAIL))
+        if (ret >= 0 && IS_AUDIT_OP(mask, AUDIT_FAIL))
                 RETURN(0); 
 
         //check audit mask
@@ -218,7 +218,7 @@ static int smfs_set_fs_audit (struct super_block * sb, __u64 *mask)
         
         priv = smfs_get_plg_priv(smb, SMFS_PLG_AUDIT);
         if(!priv) {
-                CERROR("error updating audit setting: rc = %d\n", rc);
+                CERROR("Audit is not initialized, use mountoptions 'audit'\n");
                 RETURN(-EINVAL);
         }
         
index 92a293f..c9c70d0 100644 (file)
@@ -111,11 +111,11 @@ const char *opstr[AUDIT_MAX] = {
         [AUDIT_READDIR]  "readdir",
 };
 
-#define construct_header(buf, size, rec)                                \
-        snprintf(buf, size,                                             \
-        "AUDIT [%u] [nid: "LPU64" uid: %u gid: %u rc: %d] [%s] ",       \
-        rec->time, rec->nid, rec->uid, rec->gid, (__s16)rec->result,      \
-        opstr[rec->opcode]);
+#define construct_header(buf, size, rec, id_rec)                        \
+        snprintf(buf, size, "AUDIT:"LPU64":%u/%u:%s:%d:"DLID4":",       \
+        rec->nid, rec->uid, rec->gid, opstr[rec->opcode], (__s16)rec->result,\
+        (unsigned long)id_rec->au_fid, (unsigned long)id_rec->au_mds, \
+        (unsigned long)id_rec->au_num, (unsigned long)id_rec->au_gen);
 
 #define REC2ID(rec, id) {                                       \
         id_ino(id) = rec->au_num;                               \
@@ -140,10 +140,10 @@ transfer_record(struct obd_device *obd, struct audit_record *rec, int type, void
         CDEBUG(D_INFO, "transfer %s\n", opstr[rec->opcode]);
 
         memset(buf, 0, PAGE_SIZE);
-        n = construct_header(buf, PAGE_SIZE, rec);
+        n = construct_header(buf, PAGE_SIZE, rec, id_rec);
         if (n < 0)
                 RETURN(n);
-                
+        
         switch (rec->opcode)
         {
                 case AUDIT_UNLINK:
@@ -155,7 +155,7 @@ transfer_record(struct obd_device *obd, struct audit_record *rec, int type, void
                 default:
                         break;
         }
-        
+                
         if (audit_id2name) {
                 char *name = NULL;
                 struct lustre_id id;
@@ -188,7 +188,7 @@ transfer_record(struct obd_device *obd, struct audit_record *rec, int type, void
 
         printk("%s\n", buf);
 
-        RETURN(rc);
+        RETURN(0);
 }
 
 static int transfer_cb(struct llog_handle *llh, struct llog_rec_hdr *rec,
@@ -196,7 +196,7 @@ static int transfer_cb(struct llog_handle *llh, struct llog_rec_hdr *rec,
 {
         struct obd_device *obd = llh->lgh_ctxt->loc_obd;
         struct audit_record *ad_rec;
-        int rc = 0;
+        
         ENTRY;
         
         if (!(le32_to_cpu(llh->lgh_hdr->llh_flags) & LLOG_F_IS_PLAIN)) {
@@ -213,10 +213,8 @@ static int transfer_cb(struct llog_handle *llh, struct llog_rec_hdr *rec,
         
         LASSERT(ad_rec->opcode < AUDIT_MAX);
 
-        rc = transfer_record(obd, ad_rec, rec->lrh_type, data);
-        if (rc)
-                CERROR("transfer record failed! rc:%d\n", rc);
-
+        transfer_record(obd, ad_rec, rec->lrh_type, data);
+        
         RETURN(LLOG_DEL_RECORD);
 }
 
index 752085e..3d24664 100644 (file)
@@ -1237,7 +1237,7 @@ static int fsfilt_smfs_set_info (struct super_block *sb, struct inode * inode,
                 audit_client_log(sb, val);
         }
         else if (keylen == 5 && memcmp(key, "audit", 5) == 0) {
-                rc = smfs_set_audit(sb, inode, (__u64 *)val);
+                smfs_set_audit(sb, inode, (__u64 *)val);
         }   
         else if (keylen == 7 && memcmp(key, "id2name", 7) == 0) {
                 rc = SMFS_PLG_HELP(sb, PLG_SET_INFO, &msg);
index a3dc87c..6524459 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
 # this is framework that sets env for SMFS before exec scripts
-FSTYPE=smfs MDS_MOUNT_OPTS="" OST_MOUNT_OPTS="" \
+FSTYPE=smfs MDS_MOUNT_OPTS="audit" OST_MOUNT_OPTS="audit" \
 MDS_BACKFSTYPE=ldiskfs OST_BACKFSTYPE=ldiskfs \
 MDSDEV=/tmp/mds1-$(hostname) OSTDEV=/tmp/ost1-$(hostname) sh $1