int objcount, struct obd_ioobj *obj,
int niocount, struct niobuf_remote *nb,
struct niobuf_local *res,
- struct obd_trans_info *oti)
+ struct obd_trans_info *oti,
+ struct lustre_capa *capa)
{
struct obd_device *obd = exp->exp_obd;
struct lvfs_run_ctxt saved;
inode = dentry->d_inode;
+ if (inode) {
+ rc = filter_verify_fid(exp, inode, capa);
+ if (rc)
+ GOTO(cleanup, rc);
+ }
+
fsfilt_check_slow(now, obd_timeout, "preprw_read setup");
for (i = 0, lnb = res, rnb = nb; i < obj->ioo_bufcnt;
for (i = 0; i < fso[obj].fso_bufcnt; i++, n++) {
int tmp, bytes;
- /* FIXME: this is calculated with PAGE_SIZE on client */
+ /* XXX: this is calculated with PAGE_SIZE on client */
bytes = rnb[n].len;
bytes += rnb[n].offset & (blocksize - 1);
tmp = (rnb[n].offset + rnb[n].len) & (blocksize - 1);
}
exp->exp_obd->u.filter.fo_tot_dirty -= used;
fed->fed_dirty -= used;
-
return rc;
}
int objcount, struct obd_ioobj *obj,
int niocount, struct niobuf_remote *nb,
struct niobuf_local *res,
- struct obd_trans_info *oti)
+ struct obd_trans_info *oti,
+ struct lustre_capa *capa)
{
int rc = 0, i, tot_bytes = 0, cleanup_phase = 0;
+ struct obd_device *obd = exp->exp_obd;
struct niobuf_local *lnb = res;
struct dentry *dentry = NULL;
unsigned long now = jiffies;
struct lvfs_run_ctxt saved;
struct niobuf_remote *rnb;
struct fsfilt_objinfo fso;
- struct obd_device *obd;
obd_size left;
void *iobuf;
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
/* make sure that object is already allocated */
- dentry = filter_crow_object(obd, obj->ioo_gr,
- obj->ioo_id);
-
+ dentry = filter_crow_object(obd, oa);
if (IS_ERR(dentry))
GOTO(cleanup, rc = PTR_ERR(dentry));
+ rc = filter_verify_fid(exp, dentry->d_inode, capa);
+ if (rc)
+ GOTO(cleanup, rc);
+
cleanup_phase = 2;
- /*
- * setting attrs passed along with write requests (owner/group). We
- * goind it here as object should not exist with wrong owner/group as
- * this may break quotas. --umka
- */
- rc = filter_setattr_internal(exp, dentry, oa, NULL);
- if (rc) {
- CERROR("cannot set attrs on write, err %d\n",
- rc);
- GOTO(cleanup, rc);
- }
-
fso.fso_dentry = dentry;
fso.fso_bufcnt = obj->ioo_bufcnt;
int filter_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj, int niocount,
struct niobuf_remote *nb, struct niobuf_local *res,
- struct obd_trans_info *oti)
+ struct obd_trans_info *oti, struct lustre_capa *capa)
{
+ int rc;
+
+ rc = filter_verify_capa(cmd, exp, capa);
+ if (rc)
+ return rc;
+
if (cmd == OBD_BRW_WRITE)
return filter_preprw_write(cmd, exp, oa, objcount, obj,
- niocount, nb, res, oti);
+ niocount, nb, res, oti, capa);
if (cmd == OBD_BRW_READ)
return filter_preprw_read(cmd, exp, oa, objcount, obj,
- niocount, nb, res, oti);
+ niocount, nb, res, oti, capa);
LBUG();
return -EPROTO;
}
flags = fsfilt_get_fs_flags(exp->exp_obd, dentry);
- if (!(flags & SM_DO_COW)) {
+ if (!(flags & SM_DO_COW))
GOTO(cleanup, rc);
- }
+
OBD_ALLOC(extents, obj->ioo_bufcnt * sizeof(struct write_extents));
if (!extents) {
CERROR("No Memory\n");
RETURN(rc);
}
+
int filter_write_extents(struct obd_export *exp, struct obd_ioobj *obj, int nobj,
int niocount, struct niobuf_local *local, int rc)
{
}
flags = fsfilt_get_fs_flags(exp->exp_obd, dentry);
- if (!(flags & SM_DO_REC)) {
+ if (!(flags & SM_DO_REC))
GOTO(cleanup, rc);
- }
for (i = 0, lnb = local; i < obj->ioo_bufcnt; i++, lnb++) {
if (len == 0) {
int filter_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj, int niocount,
- struct niobuf_local *res, struct obd_trans_info *oti,int rc)
+ struct niobuf_local *res, struct obd_trans_info *oti,int ret)
{
- if (cmd == OBD_BRW_WRITE)
- return filter_commitrw_write(exp, oa, objcount, obj, niocount,
- res, oti, rc);
- if (cmd == OBD_BRW_READ)
- return filter_commitrw_read(exp, oa, objcount, obj, niocount,
- res, oti, rc);
- LBUG();
- return -EPROTO;
+ int rc = -EPROTO;
+ /* remove that audit handlers due to fsfilt_inode_map_pages hooks
+ //struct lustre_id *id = obdo_id(oa);
+ //__u32 len = sizeof(*id);
+ //struct inode * inode = res->dentry->d_inode;
+ //struct super_block * sb = res->dentry->d_sb;
+ //struct obd_device *obd = class_exp2obd(exp);
+ */
+ current->user->nid = oti->oti_nid;
+
+ if (cmd == OBD_BRW_WRITE) {
+ rc = filter_commitrw_write(exp, oa, objcount, obj, niocount,
+ res, oti, ret);
+ /* fsfilt_set_info(obd, sb, inode, 10, "file_write", len, (void*)id); */
+ }
+ else if (cmd == OBD_BRW_READ) {
+ rc = filter_commitrw_read(exp, oa, objcount, obj, niocount,
+ res, oti, ret);
+ /* fsfilt_set_info(obd, sb, inode, 9, "file_read", len, (void*)id); */
+ }
+ else
+ LBUG();
+
+ return rc;
}
int filter_brw(int cmd, struct obd_export *exp, struct obdo *oa,
obdo_to_ioobj(oa, &ioo);
ioo.ioo_bufcnt = oa_bufs;
- ret = filter_preprw(cmd, exp, oa, 1, &ioo, oa_bufs, rnb, lnb, oti);
+ ret = filter_preprw(cmd, exp, oa, 1, &ioo, oa_bufs, rnb,
+ lnb, oti, NULL);
if (ret != 0)
GOTO(out, ret);