#define AUDIT_DIR (AUDIT_MAX + 1)
#define AUDIT_FS (AUDIT_MAX + 2)
#define AUDIT_SYNC (AUDIT_MAX + 3)
+#define AUDIT_NULL (AUDIT_MAX + 4)
#define AUD_BIT(a) (1 << a)
sbi->ll_audit_mask = arg;
exp = ll_i2dtexp(inode);
rc = obd_set_info(exp, 5, "audit", sizeof(msg), &msg);
- } else if (IS_AUDIT_OP(arg, AUDIT_SYNC)) {
+ } else if (IS_AUDIT_OP(arg, AUDIT_SYNC) ||
+ IS_AUDIT_OP(arg, AUDIT_NULL)) {
exp = ll_i2dtexp(inode);
rc = obd_set_info(exp, 5, "audit", sizeof(msg), &msg);
} else {
LASSERT(mds < lmv->desc.ld_tgt_count);
if (IS_AUDIT_OP(msg->attr, AUDIT_FS) ||
+ IS_AUDIT_OP(msg->attr, AUDIT_NULL) ||
IS_AUDIT_OP(msg->attr, AUDIT_SYNC)) {
//FS audit, send message to all mds
for (i = 0; i < lmv->desc.ld_tgt_count;i++) {
struct fsfilt_operations * fsfilt = S2SMI(sb)->sm_fsfilt;
struct smfs_inode_info *smi = NULL;
int rc = 0;
+ struct audit_priv *priv;
+
+ priv = smfs_get_plg_priv(S2SMI(sb), SMFS_PLG_AUDIT);
ENTRY;
priv = smfs_get_plg_priv(S2SMI(sb), SMFS_PLG_AUDIT);
if (priv)
- audit_notify(priv->audit_ctxt->loc_handle, NULL);
+ audit_notify(priv->audit_ctxt->loc_handle, NULL, 1);
//to wait for flush
- return audit_notify(NULL, NULL);
- }
+ return audit_notify(NULL, NULL, 1);
+ }
+
+ if (IS_AUDIT_OP((*mask), AUDIT_NULL)) {
+ if (priv)
+ priv->audit_null ^= 1;
+ return 0;
+ }
+
if (IS_AUDIT_OP((*mask), AUDIT_FS))
return smfs_set_fs_audit(sb, mask);
rc= -EINVAL;
/* delay notify for create op */
} else if (!(code == HOOK_CREATE && ret == 0)) {
- audit_notify(priv->audit_ctxt->loc_handle, priv->au_id2name);
+ audit_notify(priv->audit_ctxt->loc_handle, priv->au_id2name,
+ priv->audit_null);
}
OBD_FREE(buffer, PAGE_SIZE);
}
//read fs audit settings if any
audit_p->a_mask = AUDIT_OFF;
+ audit_p->audit_null = 0;
f = filp_open(AUDIT_ATTR_FILE, O_RDONLY, 0644);
if (!IS_ERR(f)) {
CERROR("Error adding audit client record: %d\n", rc);
rc= -EINVAL;
} else {
- audit_notify(ll_handle, priv->au_id2name);
+ audit_notify(ll_handle, priv->au_id2name, priv->audit_null);
}
OBD_FREE(buffer, PAGE_SIZE);
#include <linux/lustre_log.h>
#include "smfs_internal.h"
+struct tr_priv {
+ void *id2name;
+ int null;
+};
+
struct transfer_item {
struct llog_handle *ti_llh;
struct list_head ti_link;
- void * id2name;
+ struct tr_priv priv;
};
#define TRANSFERD_STOP 0
RETURN(rc);
}
-int audit_notify(struct llog_handle *llh, void * arg)
+int audit_notify(struct llog_handle *llh, void * arg, int null)
{
struct transfer_item *ti;
ENTRY;
INIT_LIST_HEAD(&ti->ti_link);
ti->ti_llh = llh;
- ti->id2name = arg;
+ ti->priv.id2name = arg;
+ ti->priv.null = null;
spin_lock(&transferd_tc.tc_lock);
list_add_tail(&ti->ti_link, &transferd_tc.tc_list);
struct audit_id_record *id_rec =
(struct audit_id_record *)(rec + 1);
struct audit_name_record *name_rec = NULL;
- int (*audit_id2name)(struct obd_device *obd, char **name,
- int *namelen, struct lustre_id *id) = data;
-
+ struct tr_priv * trp = data;
+ int (*audit_id2name)(struct obd_device *obd, char **name, int *namelen,
+ struct lustre_id *id) = trp->id2name;
+
int n, rc = 0;
ENTRY;
CDEBUG(D_INFO, "%s\n", buf);
- printk("%s\n", buf);
+ if (!trp->null)
+ printk("%s\n", buf);
RETURN(0);
}
if (!llh)
RETURN(0);
- rc = llog_cat_process(llh, (llog_cb_t)&transfer_cb, ti->id2name);
+ rc = llog_cat_process(llh, (llog_cb_t)&transfer_cb, &ti->priv);
if (rc)
CERROR("process catalog log failed: rc(%d)\n", rc);
void * audit_get_record;
void * au_id2name;
int result;
+ int audit_null; //to prevent output to syslog. just for testing overhead
__u64 a_mask;
};
+
typedef int (*audit_get_op)(struct inode *, void *, struct audit_priv *,
char *, __u32*);
/*smfs_cow.c */
/* audit_transfer.c */
-int audit_notify(struct llog_handle *llh, void*);
+int audit_notify(struct llog_handle *llh, void*, int);
int audit_start_transferd(void);
int audit_stop_transferd(void);