Whamcloud - gitweb
Added scripts to parse output per Peter Braam
[fs/lustre-release.git] / lustre / obdfilter / filter_io.c
index bb2d61a..75c4b51 100644 (file)
@@ -264,7 +264,8 @@ static int filter_preprw_read(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)
 {
         struct obd_device *obd = exp->exp_obd;
         struct lvfs_run_ctxt saved;
@@ -303,6 +304,12 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa,
 
         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;
@@ -399,7 +406,7 @@ static int filter_grant_check(struct obd_export *exp, int objcount,
                 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);
@@ -477,7 +484,6 @@ static int filter_grant_check(struct obd_export *exp, int objcount,
         }
         exp->exp_obd->u.filter.fo_tot_dirty -= used;
         fed->fed_dirty -= used;
-
         return rc;
 }
 
@@ -495,7 +501,8 @@ static int filter_preprw_write(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 = 0, i, tot_bytes = 0, cleanup_phase = 0;
         struct obd_device *obd = exp->exp_obd;
@@ -506,8 +513,6 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         struct niobuf_remote *rnb;
         struct fsfilt_objinfo fso;
         obd_size left;
-        obd_uid uid;
-        obd_gid gid;
         void *iobuf; 
         
         ENTRY;
@@ -524,14 +529,15 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         obd = exp->exp_obd;
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        uid = oa->o_valid & OBD_MD_FLUID ? oa->o_uid : 0;
-        gid = oa->o_valid & OBD_MD_FLGID ? oa->o_gid : 0;
-        
         /* make sure that object is already allocated */
         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;
 
         fso.fso_dentry = dentry;
@@ -647,11 +653,11 @@ int filter_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
 
         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;