Whamcloud - gitweb
1)do precreate record in obdfilter
authorwangdi <wangdi>
Tue, 8 Jun 2004 09:17:39 +0000 (09:17 +0000)
committerwangdi <wangdi>
Tue, 8 Jun 2004 09:17:39 +0000 (09:17 +0000)
2)fix bugs in fsfilt_commit in smfs, sometime inode will be null sometime

17 files changed:
lustre/include/linux/lustre_fsfilt.h
lustre/include/linux/lustre_smfs.h
lustre/lvfs/fsfilt_ext3.c
lustre/lvfs/fsfilt_smfs.c
lustre/mds/handler.c
lustre/mds/mds_fs.c
lustre/mds/mds_lmv.c
lustre/mds/mds_lov.c
lustre/mds/mds_open.c
lustre/mds/mds_reint.c
lustre/mds/mds_unlink_open.c
lustre/obdfilter/filter.c
lustre/smfs/cache_space.c
lustre/smfs/journal.c
lustre/smfs/kml.c
lustre/smfs/ost_kml.c
lustre/smfs/smfs_internal.h

index 7360b24..43c3123 100644 (file)
@@ -48,7 +48,8 @@ struct fsfilt_operations {
         void   *(* fs_brw_start)(int objcount, struct fsfilt_objinfo *fso,
                                  int niocount, struct niobuf_local *nb,
                                  void *desc_private, int logs);
-        int     (* fs_commit)(struct inode *inode, void *handle,int force_sync);
+        int     (* fs_commit)(struct super_block *sb, struct inode *inode, 
+                              void *handle,int force_sync);
         int     (* fs_commit_async)(struct inode *inode, void *handle,
                                         void **wait_handle);
         int     (* fs_commit_wait)(struct inode *inode, void *handle);
@@ -95,9 +96,11 @@ struct fsfilt_operations {
         int     (* fs_get_reint_log_ctxt)(struct super_block *sb, 
                                           struct llog_ctxt **ctxt);
         int     (* fs_set_kml_flags)(struct inode *inode);
+        int     (* fs_clear_kml_flags)(struct inode *inode);
         int     (* fs_set_ost_flags)(struct super_block *sb);
         int     (* fs_set_mds_flags)(struct super_block *sb);
-
+        int     (* fs_precreate_rec)(struct dentry *dentry, int *num, 
+                                     struct obdo *oa);
         int     (* fs_set_xattr)(struct inode *inode, void *handle, char *name,
                                  void *buffer, int buffer_size);
         int     (* fs_get_xattr)(struct inode *inode, char *name,
@@ -217,11 +220,11 @@ llog_fsfilt_start(struct llog_ctxt *ctxt, struct inode *inode,
 }
 
 static inline int
-fsfilt_commit_ops(struct fsfilt_operations *ops, struct inode *inode,
-                  void *handle, int force_sync)
+fsfilt_commit_ops(struct fsfilt_operations *ops, struct super_block *sb,
+                  struct inode *inode, void *handle, int force_sync)
 {
         unsigned long now = jiffies;
-        int rc = ops->fs_commit(inode, handle, force_sync);
+        int rc = ops->fs_commit(sb, inode, handle, force_sync);
         CDEBUG(D_HA, "committing handle %p\n", handle);
 
         if (time_after(jiffies, now + 15 * HZ))
@@ -231,17 +234,18 @@ fsfilt_commit_ops(struct fsfilt_operations *ops, struct inode *inode,
 }
 
 static inline int
-fsfilt_commit(struct obd_device *obd, struct inode *inode,
-              void *handle, int force_sync)
+fsfilt_commit(struct obd_device *obd, struct super_block *sb, 
+              struct inode *inode, void *handle, int force_sync)
 {
-        return fsfilt_commit_ops(obd->obd_fsops, inode, handle, force_sync);
+        return fsfilt_commit_ops(obd->obd_fsops, sb, inode, handle, force_sync);
 }
 
 static inline int
 llog_fsfilt_commit(struct llog_ctxt *ctxt, struct inode *inode,
                    void *handle, int force_sync)
 {
-        return fsfilt_commit_ops(ctxt->loc_fsops, inode, handle, force_sync);
+        return fsfilt_commit_ops(ctxt->loc_fsops, inode->i_sb, inode, handle, 
+                                 force_sync);
 }
 
 static inline void *
@@ -518,6 +522,22 @@ fsfilt_set_kml_flags(struct obd_device *obd, struct inode *inode)
 }
 
 static inline int 
+fsfilt_clear_kml_flags(struct obd_device *obd, struct inode *inode)
+{
+        if (obd->obd_fsops->fs_clear_kml_flags)
+                return obd->obd_fsops->fs_clear_kml_flags(inode);
+        return 0;
+}
+static inline int 
+fsfilt_precreate_rec(struct obd_device *obd, struct dentry *dentry,
+                     int *num, struct obdo *oa)
+{
+        if (obd->obd_fsops->fs_precreate_rec)
+                return obd->obd_fsops->fs_precreate_rec(dentry, num, oa);
+        return 0;
+}
+
+static inline int 
 fsfilt_post_setup(struct obd_device *obd)
 {
         if (obd->obd_fsops->fs_post_setup)
index 444622e..ba33548 100644 (file)
@@ -392,6 +392,7 @@ extern int smfs_write_extents(struct inode *dir, struct dentry *dentry,
                               unsigned long from, unsigned long num);
 extern int smfs_rec_setattr(struct inode *dir, struct dentry *dentry,
                             struct iattr *attr);
+extern int smfs_rec_precreate(struct dentry *dentry, int *num, struct obdo *oa);
 extern int smfs_rec_md(struct inode *inode, void * lmm, int lmm_size);
 extern int smfs_rec_unpack(struct smfs_proc_args *args, char *record,
                            char **pbuf, int *opcode);
index e78a153..1c44847 100644 (file)
@@ -310,7 +310,8 @@ static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso,
         RETURN(handle);
 }
 
-static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
+static int fsfilt_ext3_commit(struct super_block *sb, struct inode *inode, 
+                              void *h, int force_sync)
 {
         int rc;
         handle_t *handle = h;
index 646c21c..31b6b95 100644 (file)
@@ -96,13 +96,16 @@ exit:
    mds_open() behavior. It passes NULL inode to mds_finish_transno()
    sometimes. Probably we should have spare way to get cache fsfilt
    operations. */
-static int fsfilt_smfs_commit(struct inode *inode, void *h, int force_sync)
+static int fsfilt_smfs_commit(struct super_block *sb, struct inode *inode, 
+                              void *h, int force_sync)
 {
-        struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+        struct fsfilt_operations *cache_fsfilt = S2SMI(sb)->sm_cache_fsfilt;
+        struct super_block *csb = S2CSB(sb); 
         struct inode *cache_inode = NULL;
         int    rc = -EIO;
 
-        cache_inode = I2CI(inode);
+        if (inode)
+                cache_inode = I2CI(inode);
 
         if (cache_fsfilt == NULL)
                 RETURN(rc);
@@ -110,7 +113,7 @@ static int fsfilt_smfs_commit(struct inode *inode, void *h, int force_sync)
         if (!cache_fsfilt->fs_commit)
                 RETURN(-ENOSYS);
 
-        rc = cache_fsfilt->fs_commit(cache_inode, h, force_sync);
+        rc = cache_fsfilt->fs_commit(csb, cache_inode, h, force_sync);
 
         RETURN(rc);
 }
@@ -621,6 +624,14 @@ static int fsfilt_smfs_set_kml_flags(struct inode *inode)
         RETURN(rc);
 }
 
+static int fsfilt_smfs_clear_kml_flags(struct inode *inode)
+{
+        int rc = 0;
+        if (SMFS_DO_REC(S2SMI(inode->i_sb)))
+                SMFS_CLEAN_INODE_REC(inode);
+        RETURN(rc);
+}
+
 static int fsfilt_smfs_set_ost_flags(struct super_block *sb)
 {
         int rc = 0;
@@ -787,6 +798,7 @@ static int fsfilt_smfs_free_extents(struct super_block *sb, ino_t ino,
         OBD_FREE(pbuf, size * (sizeof(struct ldlm_extent)));
         return 0;
 }
+
 static int fsfilt_smfs_write_extents(struct dentry *dentry,
                                      unsigned long from, unsigned long num)
 {
@@ -798,6 +810,17 @@ static int fsfilt_smfs_write_extents(struct dentry *dentry,
         return rc;
 }
 
+static int fsfilt_smfs_precreate_rec(struct dentry *dentry, int *count, 
+                                     struct obdo *oa)
+{
+        int rc = 0;
+
+        if (SMFS_DO_REC(S2SMI(dentry->d_inode->i_sb)))
+                rc = smfs_rec_precreate(dentry, count, oa);
+
+        return rc;
+}
+
 static int fsfilt_smfs_get_ino_write_extents(struct super_block *sb, ino_t ino,
                                              char **pbuf, int *size)
 {
@@ -901,8 +924,10 @@ static struct fsfilt_operations fsfilt_smfs_ops = {
         .fs_post_setup          = fsfilt_smfs_post_setup,
         .fs_post_cleanup        = fsfilt_smfs_post_cleanup,
         .fs_set_kml_flags       = fsfilt_smfs_set_kml_flags,
+        .fs_clear_kml_flags     = fsfilt_smfs_clear_kml_flags,
         .fs_set_ost_flags       = fsfilt_smfs_set_ost_flags,
         .fs_set_mds_flags       = fsfilt_smfs_set_mds_flags,
+        .fs_precreate_rec       = fsfilt_smfs_precreate_rec,
         .fs_get_reint_log_ctxt  = fsfilt_smfs_get_reint_log_ctxt,
         .fs_send_bio            = fsfilt_smfs_send_bio,
         .fs_set_xattr           = fsfilt_smfs_set_xattr,
index d69ce24..97ea846 100644 (file)
@@ -1369,7 +1369,7 @@ repeat:
         if (IS_ERR(new)) {
                 CERROR("%s: can't lookup new inode (%s) for mkdir: %d\n",
                        obd->obd_name, fidname, (int) PTR_ERR(new));
-                fsfilt_commit(obd, new->d_inode, handle, 0);
+                fsfilt_commit(obd, mds->mds_sb, new->d_inode, handle, 0);
                 up(&parent_inode->i_sem);
                 RETURN(PTR_ERR(new));
         } else if (new->d_inode) {
index db3a11b..7194c3b 100644 (file)
@@ -653,8 +653,8 @@ int mds_obd_create(struct obd_export *exp, struct obdo *oa,
                 CERROR("error renaming new object "LPU64":%u: rc %d\n",
                        oa->o_id, oa->o_generation, rc);
 
-        err = fsfilt_commit(exp->exp_obd, mds->mds_objects_dir->d_inode,
-                            handle, 0);
+        err = fsfilt_commit(exp->exp_obd, mds->mds_sb, 
+                            mds->mds_objects_dir->d_inode, handle, 0);
         if (!err) {
                 oa->o_gr = FILTER_GROUP_FIRST_MDS + mds->mds_num;
                 oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGENER | OBD_MD_FLGROUP;
@@ -714,7 +714,8 @@ int mds_obd_destroy(struct obd_export *exp, struct obdo *oa,
                 CERROR("error destroying object "LPU64":%u: rc %d\n",
                        oa->o_id, oa->o_generation, rc);
         
-        err = fsfilt_commit(obd, mds->mds_objects_dir->d_inode, handle, 0);
+        err = fsfilt_commit(obd, mds->mds_sb, mds->mds_objects_dir->d_inode, 
+                            handle, 0);
         if (err && !rc)
                 rc = err;
 out_dput:
index 54134df..e1f09b8 100644 (file)
@@ -516,7 +516,7 @@ int mds_try_to_split_dir(struct obd_device *obd,
         LASSERT(!IS_ERR(handle));
        rc = fsfilt_set_md(obd, dir, handle, *mea, mea_size);
         LASSERT(rc == 0);
-        fsfilt_commit(obd, dir, handle, 0);
+        fsfilt_commit(obd, mds->mds_sb, dir, handle, 0);
         LASSERT(rc == 0);
        up(&dir->i_sem);
        obdo_free(oa);
index 82e1b05..c9e0c21 100644 (file)
@@ -439,7 +439,7 @@ int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
                 handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL);
                 LASSERT(handle);
-                rc = fsfilt_commit(obd, inode, handle, 1);
+                rc = fsfilt_commit(obd, obd->u.mds.mds_sb, inode, handle, 1);
 
                 dev_set_rdonly(ll_sbdev(obd->u.mds.mds_sb), 2);
                 RETURN(0);
@@ -649,7 +649,7 @@ int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode,
 
         rc = fsfilt_set_md(obd, inode, handle, lmm, lmm_size);
 
-        err = fsfilt_commit(obd, inode, handle, 0);
+        err = fsfilt_commit(obd, obd->u.mds.mds_sb, inode, handle, 0);
         if (!rc)
                 rc = err ? err : lmm_size;
         GOTO(conv_free, rc);
index 3ff867b..2f3e7d0 100644 (file)
@@ -1321,7 +1321,7 @@ out:
         if (req != NULL && reply_body != NULL) {
                 rc = mds_finish_transno(mds, pending_dir, handle, req, rc, 0);
         } else if (handle) {
-                int err = fsfilt_commit(obd, pending_dir, handle, 0);
+                int err = fsfilt_commit(obd, mds->mds_sb, pending_dir, handle, 0);
                 if (err) {
                         CERROR("error committing close: %d\n", err);
                         if (!rc)
index fe82cf2..8c1269d 100644 (file)
@@ -174,7 +174,7 @@ int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle,
         CDEBUG(log_pri, "wrote objids: err = %d\n", err);
 
 commit:
-        err = fsfilt_commit(obd, inode, handle, 0);
+        err = fsfilt_commit(obd, mds->mds_sb, inode, handle, 0);
         if (err) {
                 CERROR("error committing transaction: %d\n", err);
                 if (!rc)
@@ -1395,7 +1395,7 @@ int mds_create_local_dentry(struct mds_update_record *rec,
                 }
                 mark_inode_dirty(child->d_inode);
         }
-        fsfilt_commit(obd, fids_dir, handle, 0);
+        fsfilt_commit(obd, mds->mds_sb, fids_dir, handle, 0);
 
         rec->ur_fid1->id = fids_dir->i_ino;
         rec->ur_fid1->generation = fids_dir->i_generation;
index 951c09f..2c1092a 100644 (file)
@@ -228,7 +228,7 @@ static int mds_unlink_orphan(struct obd_device *obd, struct dentry *dchild,
                                            mds->mds_max_cookiesize) > 0)
                         log_unlink = 1;
         }
-        err = fsfilt_commit(obd, pending_dir, handle, 0);
+        err = fsfilt_commit(obd, mds->mds_sb, pending_dir, handle, 0);
         if (err) {
                 CERROR("error committing orphan unlink: %d\n", err);
                 if (!rc)
index e2a55dd..644b735 100644 (file)
@@ -207,7 +207,7 @@ static int filter_client_add(struct obd_device *obd, struct filter_obd *filter,
                                                   fed->fed_fcd,
                                                   sizeof(*fed->fed_fcd),
                                                   &off, 1);
-                        fsfilt_commit(obd,
+                        fsfilt_commit(obd, filter->fo_sb,
                                       filter->fo_rcvd_filp->f_dentry->d_inode,
                                       handle, 1);
                 }
@@ -1867,7 +1867,7 @@ static int filter_setattr(struct obd_export *exp, struct obdo *oa,
         else
                 rc = fsfilt_setattr(exp->exp_obd, dentry, handle, &iattr, 1);
         rc = filter_finish_transno(exp, oti, rc);
-        rc2 = fsfilt_commit(exp->exp_obd, dentry->d_inode, handle, 0);
+        rc2 = fsfilt_commit(exp->exp_obd, filter->fo_sb, dentry->d_inode, handle, 0);
         if (rc2) {
                 CERROR("error on commit, err = %d\n", rc2);
                 if (!rc)
@@ -2043,7 +2043,16 @@ static int filter_should_precreate(struct obd_export *exp, struct obdo *oa,
                 RETURN(diff);
         }
 }
-
+static int filter_precreate_rec(struct obd_device *obd, struct dentry *dentry, 
+                                int *number, struct obdo *oa)
+{
+        int    rc = 0;
+        ENTRY;       
+         
+        rc = fsfilt_precreate_rec(obd, dentry, number, oa);
+  
+        RETURN(rc);
+}
 /* We rely on the fact that only one thread will be creating files in a given
  * group at a time, which is why we don't need an atomic filter_get_new_id.
  * Even if we had that atomic function, the following race would exist:
@@ -2104,6 +2113,9 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa,
                         GOTO(cleanup, rc = PTR_ERR(dparent));
                 cleanup_phase = 1;
 
+                /*only do precreate rec record. so clean kml flags here*/
+                fsfilt_clear_kml_flags(obd, dparent->d_inode);
+                
                 dchild = filter_fid2dentry(obd, dparent, group, next_id);
                 if (IS_ERR(dchild))
                         GOTO(cleanup, rc = PTR_ERR(dchild));
@@ -2149,11 +2161,12 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa,
                                 CERROR("unable to write lastobjid "
                                        "but file created\n");
                 }
-
+                fsfilt_set_kml_flags(obd, dparent->d_inode);
+        
         cleanup:
                 switch(cleanup_phase) {
                 case 3:
-                        err = fsfilt_commit(obd, dparent->d_inode, handle, 0);
+                        err = fsfilt_commit(obd, filter->fo_sb, dparent->d_inode, handle, 0);
                         if (err) {
                                 CERROR("error on commit, err = %d\n", err);
                                 if (!rc)
@@ -2172,8 +2185,10 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa,
         }
         *num = i;
 
+        rc = filter_precreate_rec(obd, dparent, num, oa);
+        
         up(&filter->fo_create_lock);
-
+        
         CDEBUG(D_HA, "%s: server last_objid for group "LPU64": "LPU64"\n",
                obd->obd_name, group, filter->fo_last_objids[group]);
 
@@ -2232,8 +2247,11 @@ static int filter_create(struct obd_export *exp, struct obdo *oa,
         obd = exp->exp_obd;
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        if ((oa->o_valid & OBD_MD_FLFLAGS) &&
-            (oa->o_flags & OBD_FL_RECREATE_OBJS)) {
+        if (oa->o_valid & OBD_MD_REINT) {
+                int num = *((int*)oa->o_inline);  
+                rc = filter_precreate(obd, oa, oa->o_gr, &num);
+        } else if ((oa->o_valid & OBD_MD_FLFLAGS) &&
+                   (oa->o_flags & OBD_FL_RECREATE_OBJS)) {
                 if (oa->o_id > filter_last_id(&obd->u.filter, group)) {
                         CERROR("recreate objid "LPU64" > last id "LPU64"\n",
                                oa->o_id, filter_last_id(&obd->u.filter, group));
@@ -2356,7 +2374,8 @@ cleanup:
                                                       fcc);
                 }
                 rc = filter_finish_transno(exp, oti, rc);
-                rc2 = fsfilt_commit(obd, dparent->d_inode, handle, 0);
+                rc2 = fsfilt_commit(obd, filter->fo_sb, dparent->d_inode, 
+                                    handle, 0);
                 if (rc2) {
                         CERROR("error on commit, err = %d\n", rc2);
                         if (!rc)
@@ -2674,7 +2693,7 @@ int filter_iocontrol(unsigned int cmd, struct obd_export *exp,
 
                 handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL);
                 LASSERT(handle);
-                (void)fsfilt_commit(obd, inode, handle, 1);
+                (void)fsfilt_commit(obd, sb, inode, handle, 1);
 
                 dev_set_rdonly(ll_sbdev(obd->u.filter.fo_sb), 2);
                 RETURN(0);
index 36bf95b..a5bd94b 100644 (file)
@@ -334,7 +334,7 @@ insert:
 
         if (op & CACHE_SPACE_COMMIT) {
                 if (handle) {
-                        err = fsops->fs_commit(inode, handle, 0);
+                        err = fsops->fs_commit(inode->i_sb, inode, handle, 0);
                         if (err) {
                                 CERROR("error committing transaction: %d\n", err);
                                 if (!rc)
index 8a43df7..838440a 100644 (file)
@@ -75,7 +75,7 @@ void smfs_trans_commit(struct inode *inode, void *handle, int force_sync)
         CDEBUG(D_INFO, "trans commit %p\n", fsfilt->fs_commit);
 
         if (fsfilt->fs_commit)
-                fsfilt->fs_commit(inode, handle, force_sync);
+                fsfilt->fs_commit(inode->i_sb, inode, handle, force_sync);
 }
 
 /*smfs_path is gotten from intermezzo*/
@@ -159,10 +159,8 @@ static int smfs_pack_rec (char *buffer, struct dentry *dentry,
         return rc;
 }
 
-static int smfs_post_rec_create(struct inode *dir, 
-                                struct dentry *dentry,
-                                 void   *data1,
-                                void   *data2)
+int smfs_post_rec_create(struct inode *dir, struct dentry *dentry,
+                         void   *data1, void   *data2)
 {
         struct smfs_super_info *sinfo;
         char   *buffer = NULL, *pbuf;
index 78e8f56..dd7b28d 100644 (file)
@@ -241,6 +241,12 @@ int smfs_rec_md(struct inode *inode, void * lmm, int lmm_size)
 }
 EXPORT_SYMBOL(smfs_rec_md);
 
+int smfs_rec_precreate(struct dentry *dentry, int *num, struct obdo *oa)
+{
+       return smfs_post_rec_create(dentry->d_inode, dentry, num, oa);
+}
+EXPORT_SYMBOL(smfs_rec_precreate);
+
 int smfs_process_rec(struct super_block *sb,
                      int count, char *dir, int flags)
 {
index 01d9ccd..3e8d817 100644 (file)
@@ -80,27 +80,35 @@ static int ost_rec_create_pack(char *buffer, struct dentry *dentry,
 {
         struct obdo *oa = NULL;
         int    rc = 0;
-
+       
         PACK_KML_REC_INIT(buffer, OST_CREATE);
         oa = (struct obdo*)buffer;
-        oa->o_uid = 0; /* must have 0 uid / gid on OST */
-        oa->o_gid = 0;
-        oa->o_valid = OBD_MD_FLID | OBD_MD_FLGENER | OBD_MD_FLTYPE |
-                OBD_MD_FLMODE | OBD_MD_FLUID | OBD_MD_FLGID;
-        oa->o_size = 0;
-        obdo_from_inode(oa, dentry->d_inode, OBD_MD_FLTYPE|OBD_MD_FLATIME|
-                        OBD_MD_FLMTIME| OBD_MD_FLCTIME);
-        rc = smfs_ost_get_id(&oa->o_id, (char*)dentry->d_name.name,
-                             dentry->d_name.len);
-        if (rc) {
-                CERROR("Can not find id of node %lu\n", dentry->d_inode->i_ino);
-                GOTO(out, rc = -ENOMEM);
-        }
-        
-        rc = smfs_ost_get_group(dentry, oa);
-        if (rc) {
-                CERROR("Can not find group node %lu\n", dentry->d_inode->i_ino);
-                GOTO(out, rc = -ENOMEM); 
+        if (data1 && data2) {
+                struct obdo *create_oa = (struct obdo *)data2;  
+                int    num = *((int *)data1);
+                
+                memcpy(oa, create_oa, sizeof(*oa));
+                memcpy(oa->o_inline, &num, sizeof(int));
+                oa->o_valid |= OBD_MD_REINT; 
+        } else { 
+                oa->o_uid = 0; /* must have 0 uid / gid on OST */
+                oa->o_gid = 0;
+                oa->o_valid = OBD_MD_FLID | OBD_MD_FLGENER | OBD_MD_FLTYPE |
+                        OBD_MD_FLMODE | OBD_MD_FLUID | OBD_MD_FLGID;
+                oa->o_size = 0;
+                obdo_from_inode(oa, dentry->d_inode, OBD_MD_FLTYPE|OBD_MD_FLATIME|
+                                OBD_MD_FLMTIME| OBD_MD_FLCTIME);
+                rc = smfs_ost_get_id(&oa->o_id, (char*)dentry->d_name.name,
+                                     dentry->d_name.len);
+                if (rc) {
+                        CERROR("Can not find id of node %lu\n", dentry->d_inode->i_ino);
+                        GOTO(out, rc = -ENOMEM);
+                }
+                rc = smfs_ost_get_group(dentry, oa);
+                if (rc) {
+                        CERROR("Can not find group node %lu\n", dentry->d_inode->i_ino);
+                        GOTO(out, rc = -ENOMEM); 
+                }
         } 
         rc = sizeof(*oa) + sizeof(int);
 out:
@@ -133,11 +141,12 @@ static int ost_rec_setattr_pack(char *buffer, struct dentry *dentry,
 out:
         RETURN(rc);
 }
+
 static int ost_rec_write_pack(char *buffer, struct dentry *dentry,
                               struct inode *dir, void *data1, void *data2)
 {
         struct obdo *oa = NULL;
-         int        rc = 0;
+        int          rc = 0;
 
         PACK_KML_REC_INIT(buffer, OST_WRITE);
         oa = (struct obdo*)buffer;
index 32e84ee..7da1b7e 100644 (file)
@@ -171,6 +171,8 @@ extern int smfs_post_rec_write(struct inode *dir, struct dentry *dentry,
                                void   *data1, void *data2);
 extern int smfs_post_rec_setattr(struct inode *dir, struct dentry *dentry,
                                  void   *data1, void *data2);
+extern int smfs_post_rec_create(struct inode *dir, struct dentry *dentry,
+                                void   *data1, void   *data2);
 /*kml.c*/
 extern int smfs_kml_init(struct super_block *sb);
 extern int smfs_do_rec(struct inode *inode);