From 3c85479e7383f23bf393ae45669107c940ef06de Mon Sep 17 00:00:00 2001 From: tappro <tappro> Date: Mon, 8 Aug 2005 13:52:44 +0000 Subject: [PATCH] - root fid is 2 not 1 - remove unneeded debug --- lustre/lvfs/llog_cat.c | 2 +- lustre/mds/mds_audit_path.c | 2 +- lustre/smfs/audit.c | 4 ++-- lustre/smfs/audit_transfer.c | 26 ++++++++++++-------------- lustre/smfs/fsfilt.c | 2 +- lustre/tests/lsmfs.sh | 2 +- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lustre/lvfs/llog_cat.c b/lustre/lvfs/llog_cat.c index b7a5c8fc34..deadb3d2e2 100644 --- a/lustre/lvfs/llog_cat.c +++ b/lustre/lvfs/llog_cat.c @@ -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); diff --git a/lustre/mds/mds_audit_path.c b/lustre/mds/mds_audit_path.c index 0de8d14fc9..54b5c9d5fb 100644 --- a/lustre/mds/mds_audit_path.c +++ b/lustre/mds/mds_audit_path.c @@ -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]; diff --git a/lustre/smfs/audit.c b/lustre/smfs/audit.c index 0e7dd0c9cb..a709f91e7f 100644 --- a/lustre/smfs/audit.c +++ b/lustre/smfs/audit.c @@ -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); } diff --git a/lustre/smfs/audit_transfer.c b/lustre/smfs/audit_transfer.c index 92a293febb..c9c70d0814 100644 --- a/lustre/smfs/audit_transfer.c +++ b/lustre/smfs/audit_transfer.c @@ -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); } diff --git a/lustre/smfs/fsfilt.c b/lustre/smfs/fsfilt.c index 752085e678..3d24664d92 100644 --- a/lustre/smfs/fsfilt.c +++ b/lustre/smfs/fsfilt.c @@ -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); diff --git a/lustre/tests/lsmfs.sh b/lustre/tests/lsmfs.sh index a3dc87c098..6524459110 100755 --- a/lustre/tests/lsmfs.sh +++ b/lustre/tests/lsmfs.sh @@ -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 -- GitLab