Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6bef9db
)
add null_audit command to lctl which will make audit silent. For testing purposes.
author
tappro
<tappro>
Fri, 16 Sep 2005 15:48:53 +0000
(15:48 +0000)
committer
tappro
<tappro>
Fri, 16 Sep 2005 15:48:53 +0000
(15:48 +0000)
lustre/include/linux/lustre_audit.h
patch
|
blob
|
history
lustre/llite/llite_audit.c
patch
|
blob
|
history
lustre/lmv/lmv_obd.c
patch
|
blob
|
history
lustre/smfs/audit.c
patch
|
blob
|
history
lustre/smfs/audit_transfer.c
patch
|
blob
|
history
lustre/smfs/smfs_api.h
patch
|
blob
|
history
lustre/smfs/smfs_internal.h
patch
|
blob
|
history
diff --git
a/lustre/include/linux/lustre_audit.h
b/lustre/include/linux/lustre_audit.h
index
bb545d1
..
136fb29
100644
(file)
--- a/
lustre/include/linux/lustre_audit.h
+++ b/
lustre/include/linux/lustre_audit.h
@@
-55,6
+55,7
@@
typedef enum {
#define AUDIT_DIR (AUDIT_MAX + 1)
#define AUDIT_FS (AUDIT_MAX + 2)
#define AUDIT_SYNC (AUDIT_MAX + 3)
#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)
#define AUD_BIT(a) (1 << a)
diff --git
a/lustre/llite/llite_audit.c
b/lustre/llite/llite_audit.c
index
e5e3f4c
..
dc14ad6
100644
(file)
--- a/
lustre/llite/llite_audit.c
+++ b/
lustre/llite/llite_audit.c
@@
-54,7
+54,8
@@
int ll_set_audit(struct inode * inode, __u64 arg)
sbi->ll_audit_mask = arg;
exp = ll_i2dtexp(inode);
rc = obd_set_info(exp, 5, "audit", sizeof(msg), &msg);
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 {
exp = ll_i2dtexp(inode);
rc = obd_set_info(exp, 5, "audit", sizeof(msg), &msg);
} else {
diff --git
a/lustre/lmv/lmv_obd.c
b/lustre/lmv/lmv_obd.c
index
6532ec7
..
2960ee6
100644
(file)
--- a/
lustre/lmv/lmv_obd.c
+++ b/
lustre/lmv/lmv_obd.c
@@
-2129,6
+2129,7
@@
int lmv_set_info(struct obd_export *exp, obd_count keylen,
LASSERT(mds < lmv->desc.ld_tgt_count);
if (IS_AUDIT_OP(msg->attr, AUDIT_FS) ||
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++) {
IS_AUDIT_OP(msg->attr, AUDIT_SYNC)) {
//FS audit, send message to all mds
for (i = 0; i < lmv->desc.ld_tgt_count;i++) {
diff --git
a/lustre/smfs/audit.c
b/lustre/smfs/audit.c
index
ed70b73
..
fd83c0c
100644
(file)
--- a/
lustre/smfs/audit.c
+++ b/
lustre/smfs/audit.c
@@
-280,6
+280,9
@@
int smfs_set_audit(struct super_block * sb, struct inode * inode,
struct fsfilt_operations * fsfilt = S2SMI(sb)->sm_fsfilt;
struct smfs_inode_info *smi = NULL;
int rc = 0;
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;
ENTRY;
@@
-288,10
+291,17
@@
int smfs_set_audit(struct super_block * sb, struct inode * inode,
priv = smfs_get_plg_priv(S2SMI(sb), SMFS_PLG_AUDIT);
if (priv)
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
//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);
if (IS_AUDIT_OP((*mask), AUDIT_FS))
return smfs_set_fs_audit(sb, mask);
@@
-369,7
+379,8
@@
static int smfs_audit_post_op(hook_op code, struct inode * inode, void * msg,
rc= -EINVAL;
/* delay notify for create op */
} else if (!(code == HOOK_CREATE && ret == 0)) {
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);
}
OBD_FREE(buffer, PAGE_SIZE);
@@
-427,6
+438,7
@@
static int smfs_start_audit(struct super_block *sb, void *arg,
}
//read fs audit settings if any
audit_p->a_mask = AUDIT_OFF;
}
//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)) {
f = filp_open(AUDIT_ATTR_FILE, O_RDONLY, 0644);
if (!IS_ERR(f)) {
@@
-622,7
+634,7
@@
int audit_client_log(struct super_block * sb, struct audit_msg * msg)
CERROR("Error adding audit client record: %d\n", rc);
rc= -EINVAL;
} else {
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);
}
OBD_FREE(buffer, PAGE_SIZE);
diff --git
a/lustre/smfs/audit_transfer.c
b/lustre/smfs/audit_transfer.c
index
9e6b7b1
..
301d59e
100644
(file)
--- a/
lustre/smfs/audit_transfer.c
+++ b/
lustre/smfs/audit_transfer.c
@@
-38,10
+38,15
@@
#include <linux/lustre_log.h>
#include "smfs_internal.h"
#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;
struct transfer_item {
struct llog_handle *ti_llh;
struct list_head ti_link;
-
void * id2name
;
+
struct tr_priv priv
;
};
#define TRANSFERD_STOP 0
};
#define TRANSFERD_STOP 0
@@
-75,7
+80,7
@@
static int transferd_check(struct transferd_ctl *tc)
RETURN(rc);
}
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;
{
struct transfer_item *ti;
ENTRY;
@@
-98,7
+103,8
@@
int audit_notify(struct llog_handle *llh, void * arg)
INIT_LIST_HEAD(&ti->ti_link);
ti->ti_llh = llh;
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);
spin_lock(&transferd_tc.tc_lock);
list_add_tail(&ti->ti_link, &transferd_tc.tc_list);
@@
-152,9
+158,10
@@
transfer_record(struct obd_device *obd, struct audit_record *rec, int type, void
struct audit_id_record *id_rec =
(struct audit_id_record *)(rec + 1);
struct audit_name_record *name_rec = NULL;
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;
int n, rc = 0;
ENTRY;
@@
-214,7
+221,8
@@
transfer_record(struct obd_device *obd, struct audit_record *rec, int type, void
CDEBUG(D_INFO, "%s\n", buf);
CDEBUG(D_INFO, "%s\n", buf);
- printk("%s\n", buf);
+ if (!trp->null)
+ printk("%s\n", buf);
RETURN(0);
}
RETURN(0);
}
@@
-261,7
+269,7
@@
static int audit_transfer(struct transfer_item *ti)
if (!llh)
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);
if (rc)
CERROR("process catalog log failed: rc(%d)\n", rc);
diff --git
a/lustre/smfs/smfs_api.h
b/lustre/smfs/smfs_api.h
index
b81b21d
..
320591a
100644
(file)
--- a/
lustre/smfs/smfs_api.h
+++ b/
lustre/smfs/smfs_api.h
@@
-98,8
+98,10
@@
struct audit_priv {
void * audit_get_record;
void * au_id2name;
int result;
void * audit_get_record;
void * au_id2name;
int result;
+ int audit_null; //to prevent output to syslog. just for testing overhead
__u64 a_mask;
};
__u64 a_mask;
};
+
typedef int (*audit_get_op)(struct inode *, void *, struct audit_priv *,
char *, __u32*);
typedef int (*audit_get_op)(struct inode *, void *, struct audit_priv *,
char *, __u32*);
diff --git
a/lustre/smfs/smfs_internal.h
b/lustre/smfs/smfs_internal.h
index
2c12316
..
59d5720
100644
(file)
--- a/
lustre/smfs/smfs_internal.h
+++ b/
lustre/smfs/smfs_internal.h
@@
-165,7
+165,7
@@
extern void smfs_cleanup_psdev(void);
/*smfs_cow.c */
/* audit_transfer.c */
/*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);
int audit_start_transferd(void);
int audit_stop_transferd(void);