Whamcloud - gitweb
file export-do_kern_mount.patch was initially added on branch b1_5.
[fs/lustre-release.git] / lustre / smfs / fsfilt.c
index 64bfcaf..a4cf04c 100644 (file)
@@ -47,16 +47,22 @@ static void *fsfilt_smfs_start(struct inode *inode, int op,
         void *handle;
         struct inode *cache_inode = I2CI(inode);
         struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
-
+        int extra = 0;
+        int opcode = op;
+        
         if (cache_fsfilt == NULL)
                 return NULL;
 
-        //SMFS_TRANS_OP(inode, op);
-
         if (!cache_fsfilt->fs_start)
                 return ERR_PTR(-ENOSYS);
+        
+        //opcode can be changed here. 
+        //For example, unlink is rename in nature for undo plugin 
+        extra = SMFS_PLG_HELP(inode->i_sb, PLG_TRANS_SIZE, &opcode);
+
+        handle = cache_fsfilt->fs_start(cache_inode, op, desc_private,
+                                        logs + extra);
 
-        handle = cache_fsfilt->fs_start(cache_inode, op, desc_private, logs);
         return handle;
 }
 
@@ -161,41 +167,6 @@ static int fsfilt_smfs_commit_wait(struct inode *inode, void *h)
         RETURN(rc);
 }
 
-static int fsfilt_smfs_setattr(struct dentry *dentry, void *handle,
-                               struct iattr *iattr, int do_trunc)
-{
-        struct fsfilt_operations *cache_fsfilt = I2FOPS(dentry->d_inode);
-        struct dentry *cache_dentry = NULL;
-        struct inode *cache_inode = I2CI(dentry->d_inode);
-        struct hook_setattr_msg msg = {
-                .dentry = dentry,
-                .attr = iattr
-        };
-        int    rc = -EIO;
-
-        if (!cache_fsfilt)
-                RETURN(rc);
-
-        if (!cache_fsfilt->fs_setattr)
-                RETURN(-ENOSYS);
-
-        cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
-        if (!cache_dentry)
-                RETURN(-ENOMEM);
-
-        pre_smfs_inode(dentry->d_inode, cache_inode);
-
-        SMFS_PRE_HOOK(dentry->d_inode, HOOK_F_SETATTR, &msg);
-        
-        rc = cache_fsfilt->fs_setattr(cache_dentry, handle, iattr, do_trunc);
-
-        SMFS_POST_HOOK(dentry->d_inode, HOOK_F_SETATTR, &msg, rc);
-        post_smfs_inode(dentry->d_inode, cache_inode);
-
-        post_smfs_dentry(cache_dentry);
-        RETURN(rc);
-}
-
 static int fsfilt_smfs_iocontrol(struct inode *inode, struct file *file,
                                  unsigned int cmd, unsigned long arg)
 {
@@ -224,60 +195,6 @@ static int fsfilt_smfs_iocontrol(struct inode *inode, struct file *file,
         
         rc = cache_fsfilt->fs_iocontrol(cache_inode, cache_file, cmd, arg);
 
-#if 0
-        /* FIXME-UMKA: Should this be in duplicate_inode()? */
-        if (rc == 0 && cmd == EXT3_IOC_SETFLAGS)
-                inode->i_flags = cache_inode->i_flags;
-#endif
-        post_smfs_inode(inode, cache_inode);
-
-        RETURN(rc);
-}
-
-static int fsfilt_smfs_set_md(struct inode *inode, void *handle,
-                              void *lmm, int lmm_size, enum ea_type type)
-{
-        struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
-        struct inode *cache_inode = I2CI(inode);
-        int    rc = -EIO;
-      
-        if (!cache_fsfilt)
-                RETURN(-EINVAL);
-
-        if (!cache_inode)
-                RETURN(-ENOENT);
-        /*TODO: HOOK is needed here */
-        pre_smfs_inode(inode, cache_inode);
-
-        down(&cache_inode->i_sem);
-        rc = cache_fsfilt->fs_set_md(cache_inode, handle, lmm,
-                                     lmm_size, type);
-        up(&cache_inode->i_sem);
-
-        post_smfs_inode(inode, cache_inode);
-               
-        RETURN(rc);
-}
-
-static int fsfilt_smfs_get_md(struct inode *inode, void *lmm,
-                              int lmm_size, enum ea_type type)
-{
-        struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
-        struct inode *cache_inode = I2CI(inode);
-        int    rc = -EIO;
-
-        if (!cache_fsfilt)
-                RETURN(-EINVAL);
-
-        if (!cache_inode)
-                RETURN(-ENOENT);
-
-        pre_smfs_inode(inode, cache_inode);
-
-        down(&cache_inode->i_sem);
-        rc = cache_fsfilt->fs_get_md(cache_inode, lmm, lmm_size, type);
-        up(&cache_inode->i_sem);
-
         post_smfs_inode(inode, cache_inode);
 
         RETURN(rc);
@@ -349,9 +266,11 @@ static ssize_t fsfilt_smfs_readpage(struct file *file, char *buf,
         struct fsfilt_operations *cache_fsfilt;
         struct smfs_file_info *sfi;
         struct inode *cache_inode;
-        loff_t tmp_ppos;
         loff_t *cache_ppos;
         ssize_t rc = -EIO;
+        struct hook_msg msg = {
+                .dentry = file->f_dentry,
+        };
 
         ENTRY;
 
@@ -367,13 +286,9 @@ static ssize_t fsfilt_smfs_readpage(struct file *file, char *buf,
         if (sfi->magic != SMFS_FILE_MAGIC)
                 BUG();
 
-        if (off != &(file->f_pos))
-                cache_ppos = &tmp_ppos;
-        else
-                cache_ppos = &sfi->c_file->f_pos;
-        *cache_ppos = *off;
+        pre_smfs_file(file, off, &cache_ppos);
+        SMFS_PRE_HOOK(file->f_dentry->d_inode, HOOK_READDIR, &msg);
 
-        pre_smfs_inode(file->f_dentry->d_inode, cache_inode);
 #if CONFIG_SNAPFS
         /*readdir page*/
         if (smfs_dotsnap_inode(file->f_dentry->d_inode)) {
@@ -395,10 +310,9 @@ static ssize_t fsfilt_smfs_readpage(struct file *file, char *buf,
                                                cache_ppos);
 
 #endif
-        *off = *cache_ppos;
-        post_smfs_inode(file->f_dentry->d_inode, cache_inode);
-        duplicate_file(file, sfi->c_file);
-
+        SMFS_POST_HOOK(file->f_dentry->d_inode, HOOK_READDIR, &msg, rc);
+        post_smfs_file(file);
+        
         RETURN(rc);
 }
 
@@ -464,9 +378,13 @@ int fsfilt_smfs_map_inode_pages(struct inode *inode, struct page **page,
         struct  fsfilt_operations *cache_fsfilt = I2FOPS(inode);
         struct  inode *cache_inode = NULL;
         int     rc = -EIO;
-        
+        struct hook_rw_msg  msg = {
+                .write = create,
+        };
+        hook_op hook = create ? HOOK_WRITE : HOOK_READ;
         ENTRY;
         
+        
         if (!cache_fsfilt)
                 RETURN(-EINVAL);
 
@@ -478,11 +396,13 @@ int fsfilt_smfs_map_inode_pages(struct inode *inode, struct page **page,
         if (!cache_fsfilt->fs_map_inode_pages)
                 RETURN(-ENOSYS);
 
+        SMFS_PRE_HOOK(inode, hook, &msg);
         down(&cache_inode->i_sem);
 
         rc = cache_fsfilt->fs_map_inode_pages(cache_inode, page, pages, blocks,
                                               created, create, sem);
         up(&cache_inode->i_sem);
+        SMFS_POST_HOOK(inode, hook, &msg, rc);
 
         RETURN(rc);
 }
@@ -519,7 +439,6 @@ static int fsfilt_smfs_read_record(struct file * file, void *buf,
         struct  fsfilt_operations *cache_fsfilt;
         struct  inode *cache_inode;
         struct  smfs_file_info *sfi;
-        loff_t  tmp_ppos;
         loff_t  *cache_ppos;
         ssize_t rc;
 
@@ -529,29 +448,18 @@ static int fsfilt_smfs_read_record(struct file * file, void *buf,
                 RETURN(-EINVAL);
 
         cache_inode = I2CI(file->f_dentry->d_inode);
-
         if (!cache_inode)
                 RETURN(-EINVAL);
 
         sfi = F2SMFI(file);
-        if (sfi->magic != SMFS_FILE_MAGIC) BUG();
-
-        if (offs != &(file->f_pos))
-                cache_ppos = &tmp_ppos;
-        else
-                cache_ppos = &sfi->c_file->f_pos;
-        *cache_ppos = *offs;
-
-        pre_smfs_inode(file->f_dentry->d_inode, cache_inode);
+        LASSERT(sfi->magic == SMFS_FILE_MAGIC);
 
         if (!cache_fsfilt->fs_read_record)
                 RETURN(-ENOSYS);
 
+        pre_smfs_file(file, offs, &cache_ppos);
         rc = cache_fsfilt->fs_read_record(sfi->c_file, buf, size, cache_ppos);
-
-        *offs = *cache_ppos;
-        post_smfs_inode(file->f_dentry->d_inode, cache_inode);
-        duplicate_file(file, sfi->c_file);
+        post_smfs_file(file);
 
         RETURN(rc);
 }
@@ -562,7 +470,6 @@ static int fsfilt_smfs_write_record(struct file *file, void *buf, int bufsize,
         struct  fsfilt_operations *cache_fsfilt;
         struct  inode *cache_inode;
         struct  smfs_file_info *sfi;
-        loff_t  tmp_ppos;
         loff_t  *cache_ppos;
         ssize_t rc = -EIO;
 
@@ -573,36 +480,26 @@ static int fsfilt_smfs_write_record(struct file *file, void *buf, int bufsize,
                 RETURN(-EINVAL);
 
         cache_inode = I2CI(file->f_dentry->d_inode);
-
         if (!cache_inode)
                 RETURN(-EINVAL);
 
         sfi = F2SMFI(file);
-        if (sfi->magic != SMFS_FILE_MAGIC)
-                BUG();
-
-        if (offs != &(file->f_pos))
-                cache_ppos = &tmp_ppos;
-        else
-                cache_ppos = &sfi->c_file->f_pos;
-        *cache_ppos = *offs;
-
-        pre_smfs_inode(file->f_dentry->d_inode, cache_inode);
+        LASSERT(sfi->magic == SMFS_FILE_MAGIC);
 
         if (!cache_fsfilt->fs_write_record)
                 RETURN(-ENOSYS);
-
+        
+        pre_smfs_file(file, offs, &cache_ppos);
         rc = cache_fsfilt->fs_write_record(sfi->c_file, buf,
                                            bufsize, cache_ppos, force_sync);
-        *offs = *cache_ppos;
-        post_smfs_inode(file->f_dentry->d_inode, cache_inode);
-        duplicate_file(file, sfi->c_file);
+
+        post_smfs_file(file);
 
         RETURN(rc);
 }
 
 static int fsfilt_smfs_post_setup(struct obd_device *obd, struct vfsmount *mnt,
-                                  struct dentry *root_dentry)
+                                  struct dentry *root_dentry)//, void *data)
 {
         struct super_block *sb = NULL;
         int rc = 0;
@@ -612,18 +509,12 @@ static int fsfilt_smfs_post_setup(struct obd_device *obd, struct vfsmount *mnt,
         if (mnt) {
                 sb = mnt->mnt_sb;
                 
-                if (obd)
-                        S2SMI(sb)->smsi_exp = obd->obd_self_export;
-                
-                rc = smfs_post_setup(sb, mnt);
-                if (!rc) {
-                        if (obd)
-                                obd->obd_llog_ctxt[LLOG_REINT_ORIG_CTXT] =
-                                                S2SMI(sb)->smsi_kml_log;
-                }
-                else {
-                        CERROR("can not do post setup in obd %p rc=%d",
-                               obd, rc);
+                LASSERT(obd);
+                S2SMI(sb)->smsi_exp = obd->obd_self_export;
+               
+                rc = smfs_post_setup(obd, mnt, root_dentry);//, data);
+                if (rc) {
+                        CERROR("post_setup fails in obd %p rc=%d", obd, rc);
                 }
         }
         
@@ -650,13 +541,12 @@ static int fsfilt_smfs_set_fs_flags(struct inode *inode, int flags)
         int rc = 0;
         ENTRY;
 
-        if (flags & SM_DO_REC)
-                SMFS_SET(I2SMI(inode)->smi_flags, SMFS_PLG_KML);
-
-        //if (SMFS_DO_REC(S2SMI(inode->i_sb)) && (flags & SM_DO_REC))
-        //        SMFS_SET_INODE_REC(inode);
+        if (flags & SM_ALL_PLG) /* enable all plugins */
+                SMFS_SET(I2SMI(inode)->smi_flags, SMFS_PLG_ALL);
+#if 0
         if (SMFS_DO_COW(S2SMI(inode->i_sb)) && (flags & SM_DO_COW))
                 SMFS_SET_INODE_COW(inode);
+#endif
         RETURN(rc);
 }
 
@@ -664,11 +554,14 @@ static int fsfilt_smfs_clear_fs_flags(struct inode *inode, int flags)
 {
         int rc = 0;
         ENTRY;
-        
+        /*
         if (SMFS_DO_REC(S2SMI(inode->i_sb)) && (flags & SM_DO_REC))
                 SMFS_CLEAN_INODE_REC(inode);
         if (SMFS_DO_COW(S2SMI(inode->i_sb)) && (flags & SM_DO_COW))
                 SMFS_CLEAN_INODE_COW(inode);
+        */
+        if(flags & SM_ALL_PLG) /* disable all plugins */
+                SMFS_CLEAR(I2SMI(inode)->smi_flags, SMFS_PLG_ALL);
         RETURN(rc);
 }
 
@@ -679,28 +572,23 @@ static int fsfilt_smfs_get_fs_flags(struct dentry *de)
         ENTRY;
 
         LASSERT(inode);
-
-        if (SMFS_DO_REC(S2SMI(inode->i_sb)) && SMFS_DO_INODE_REC(inode))
-                flags |= SM_DO_REC;
-        if (SMFS_DO_COW(S2SMI(inode->i_sb)) && SMFS_DO_INODE_COW(inode))
-                flags |= SM_DO_COW;
+        
+        flags = I2SMI(inode)->smi_flags & S2SMI(inode->i_sb)->plg_flags;
        
         RETURN(flags); 
 }
+
 static int fsfilt_smfs_set_ost_flags(struct super_block *sb)
 {
-        int rc = 0;
-        SET_REC_PACK_TYPE_INDEX(S2SMI(sb)->smsi_flags, PACK_OST);
-        RETURN(rc);
+        return 0;
 }
 
 static int fsfilt_smfs_set_mds_flags(struct super_block *sb)
 {
-        int rc = 0;
-        SET_REC_PACK_TYPE_INDEX(S2SMI(sb)->smsi_flags, PACK_MDS);
-        RETURN(rc);
+        return 0;
 }
 
+#if 0
 static int fsfilt_smfs_get_reint_log_ctxt(struct super_block *sb,
                                           struct llog_ctxt **ctxt)
 {
@@ -710,6 +598,7 @@ static int fsfilt_smfs_get_reint_log_ctxt(struct super_block *sb,
         *ctxt = smfs_info->smsi_kml_log;
         RETURN(rc);
 }
+#endif
 
 static int fsfilt_smfs_setup(struct obd_device *obd, struct super_block *sb)
 {
@@ -736,27 +625,78 @@ static int fsfilt_smfs_setup(struct obd_device *obd, struct super_block *sb)
         RETURN(rc);
 }
 
+static int fsfilt_smfs_setattr(struct dentry *dentry, void *handle,
+                               struct iattr *iattr, int do_trunc)
+{
+        struct fsfilt_operations *cache_fsfilt = I2FOPS(dentry->d_inode);
+        struct dentry *cache_dentry = NULL;
+        struct inode *cache_inode = I2CI(dentry->d_inode);
+        struct smfs_super_info *sbi = S2SMI(dentry->d_inode->i_sb);
+        struct hook_attr_msg msg = {
+                .dentry = dentry,
+                .attr = iattr
+        };
+        int    rc = -EIO;
+
+        if (!cache_fsfilt)
+                RETURN(rc);
+
+        if (!cache_fsfilt->fs_setattr)
+                RETURN(-ENOSYS);
+
+        cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
+        if (!cache_dentry)
+                RETURN(-ENOMEM);
+
+        pre_smfs_inode(dentry->d_inode, cache_inode);
+
+        SMFS_PRE_HOOK(dentry->d_inode, HOOK_F_SETATTR, &msg);
+        
+        if (SMFS_DO_HND_IBLOCKS(sbi)) {
+                /* size-on-mds changes i_blocks directly to reflect
+                 * aggregated i_blocks from all OSTs -bzzz */
+                cache_inode->i_blocks = dentry->d_inode->i_blocks;
+        }
+
+        rc = cache_fsfilt->fs_setattr(cache_dentry, handle, iattr, do_trunc);
+
+        SMFS_POST_HOOK(dentry->d_inode, HOOK_F_SETATTR, &msg, rc);
+        post_smfs_inode(dentry->d_inode, cache_inode);
+
+        post_smfs_dentry(cache_dentry);
+        RETURN(rc);
+}
+
 static int fsfilt_smfs_set_xattr(struct inode *inode, void *handle, char *name,
                                  void *buffer, int buffer_size)
 {
-        struct  fsfilt_operations *cache_fsfilt = I2FOPS(inode);
-        struct  inode *cache_inode = NULL;
-        int     rc = -EIO;
-
+        struct fsfilt_operations *cache_fsfilt = I2FOPS(inode);
+        struct inode *cache_inode = NULL;
+        struct hook_xattr_msg msg = {
+                .name = name,
+                .buffer = buffer,
+                .buffer_size = buffer_size
+        };
+        int    rc = -EIO;
+        int    lov = 0;
+        
         ENTRY;
         
         if (!cache_fsfilt)
-                RETURN(rc);
+                RETURN(-EIO);
 
         cache_inode = I2CI(inode);
         if (!cache_inode)
                 RETURN(rc);
-
+        
+        lov = (!strcmp(name, XATTR_LUSTRE_MDS_LOV_EA));
         pre_smfs_inode(inode, cache_inode);
-
+        SMFS_PRE_HOOK(inode, HOOK_F_SETXATTR, &msg);
         if (cache_fsfilt->fs_set_xattr)
                 rc = cache_fsfilt->fs_set_xattr(cache_inode, handle, name,
                                                 buffer, buffer_size);
+         
+        SMFS_POST_HOOK(inode, HOOK_F_SETXATTR, &msg, rc);
         post_smfs_inode(inode, cache_inode);
 
         RETURN(rc);
@@ -777,15 +717,89 @@ static int fsfilt_smfs_get_xattr(struct inode *inode, char *name,
                 RETURN(rc);
 
         pre_smfs_inode(inode, cache_inode);
-
         if (cache_fsfilt->fs_get_xattr)
                 rc = cache_fsfilt->fs_get_xattr(cache_inode, name,
                                                 buffer, buffer_size);
         post_smfs_inode(inode, cache_inode);
-
         RETURN(rc);
 }
 
+static int fsfilt_smfs_set_md(struct inode *inode, void *handle,
+                              void *lmm, int lmm_size, enum ea_type type)
+{
+        int rc;
+        
+        switch(type) {
+        case EA_LOV:
+                rc = fsfilt_smfs_set_xattr(inode, handle,
+                                           XATTR_LUSTRE_MDS_LOV_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_MEA:
+                rc = fsfilt_smfs_set_xattr(inode, handle,
+                                           XATTR_LUSTRE_MDS_MEA_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_SID:
+                rc = fsfilt_smfs_set_xattr(inode, handle,
+                                           XATTR_LUSTRE_MDS_SID_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_PID:
+                rc = fsfilt_smfs_set_xattr(inode, handle,
+                                           XATTR_LUSTRE_MDS_PID_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_KEY:
+                rc = fsfilt_smfs_set_xattr(inode, handle,
+                                           XATTR_LUSTRE_MDS_KEY_EA,
+                                           lmm, lmm_size);
+                break;
+        default:
+                rc = -EINVAL;
+        }
+
+        return rc;
+}
+
+static int fsfilt_smfs_get_md(struct inode *inode, void *lmm,
+                              int lmm_size, enum ea_type type)
+{
+        int rc;
+        
+        switch (type) {
+        case EA_LOV:
+                rc = fsfilt_smfs_get_xattr(inode,
+                                           XATTR_LUSTRE_MDS_LOV_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_MEA:
+                rc = fsfilt_smfs_get_xattr(inode,
+                                           XATTR_LUSTRE_MDS_MEA_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_SID:
+                rc = fsfilt_smfs_get_xattr(inode,
+                                           XATTR_LUSTRE_MDS_SID_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_PID:
+                rc = fsfilt_smfs_get_xattr(inode,
+                                           XATTR_LUSTRE_MDS_PID_EA,
+                                           lmm, lmm_size);
+                break;
+        case EA_KEY:
+                rc = fsfilt_smfs_get_xattr(inode,
+                                           XATTR_LUSTRE_MDS_KEY_EA,
+                                           lmm, lmm_size);
+                break;
+        default:
+                rc = -EINVAL;
+        }
+        
+        return rc;
+}
+
 static int fsfilt_smfs_insert_extents_ea(struct inode *inode,
                                          unsigned long from, unsigned long num)
 {
@@ -865,35 +879,56 @@ static int fsfilt_smfs_free_extents(struct super_block *sb, ino_t ino,
 static int fsfilt_smfs_write_extents(struct dentry *dentry,
                                      unsigned long from, unsigned long num)
 {
+        /* TODO: fix this later */
+#if 0
         int rc = 0;
-        ENTRY;
-        if (SMFS_DO_REC(S2SMI(dentry->d_inode->i_sb)))
-                rc = smfs_write_extents(dentry->d_inode, dentry, from, num);
+        struct inode * cache_inode = I2CI(dentry->d_inode);
+        struct hook_write_msg msg = {
+                .dentry = dentry,
+                .count = num,
+                .pos = from
+        };
 
-        return rc;
+        ENTRY;
+        
+        pre_smfs_inode(dentry->d_inode, cache_inode);
+        SMFS_PRE_HOOK(dentry->d_inode, HOOK_WRITE, &msg);
+        
+        rc = smfs_write_extents(dentry->d_inode, dentry, from, num);
+        SMFS_POST_HOOK(dentry->d_inode, HOOK_WRITE, &msg, rc);
+        post_smfs_inode(dentry->d_inode, cache_inode);
+        
+        RETURN(rc);
+#endif
+        ENTRY;
+        RETURN(0);
 }
 
 static int fsfilt_smfs_precreate_rec(struct dentry *dentry, int *count, 
                                      struct obdo *oa)
 {
         int rc = 0;
-
+        /* Why to log precreate?? MDS will do this in any case
         if (SMFS_DO_REC(S2SMI(dentry->d_inode->i_sb)))
                 rc = smfs_rec_precreate(dentry, count, oa);
-
+        */
         return rc;
 }
 
+// should be rewrote when needed
 static int fsfilt_smfs_get_ino_write_extents(struct super_block *sb, ino_t ino,
                                              char **pbuf, int *size)
 {
+        int rc = 0;
+#if 0
         struct fs_extent *fs_extents;
         struct ldlm_extent *extents = NULL;
         struct inode *inode;
         struct inode *cache_inode;
         struct fsfilt_operations *cache_fsfilt = NULL;
         struct lvfs_run_ctxt saved;
-        int    rc = 0, fs_ex_size, ex_num, flags;
+        int    fs_ex_size, ex_num, flags;
         char   *buf = NULL, *ex_buf = NULL;
         ENTRY;
 
@@ -960,6 +995,7 @@ out:
         if (rc && extents)
                 OBD_FREE(ex_buf, (*size) * (sizeof(struct ldlm_extent)));
         pop_ctxt(&saved, S2SMI(sb)->smsi_ctxt, NULL);
+#endif
         return rc;
 }
 
@@ -1089,11 +1125,15 @@ static int fsfilt_smfs_del_dir_entry(struct obd_device * obd,
         
         rc = cache_fsfilt->fs_del_dir_entry(obd, cache_dentry);
 
-        if (!rc)
+        if (!rc) {
                 d_drop(dentry);
-
-        post_smfs_inode(dentry->d_inode, cache_inode);
-        post_smfs_inode(dentry->d_parent->d_inode, cache_dir);
+                if (cache_inode) {
+                        post_smfs_inode(dentry->d_inode, cache_inode);
+                        if (S_ISDIR(dentry->d_inode->i_mode))
+                                dentry->d_parent->d_inode->i_nlink--;
+                }
+                post_smfs_inode(dentry->d_parent->d_inode, cache_dir);                        
+        }
 exit:
         post_smfs_dentry(cache_dentry);
         post_smfs_dentry(cache_parent);
@@ -1101,6 +1141,81 @@ exit:
         
 }
 
+static int fsfilt_smfs_set_info (struct super_block *sb, struct inode * inode,
+                                 __u32 keylen, void *key,
+                                 __u32 valsize, void *val)
+{
+        int rc = 0;
+        struct plg_info_msg msg = {
+                .key = key,
+                .val = val,
+        };       
+        ENTRY;
+        
+        if (keylen >= 9 && memcmp(key, "file_read", 9) == 0) {
+                /* 
+                 * this key used to inform smfs on OST about incoming r/w
+                 */
+                struct lustre_id * id = val;
+                struct hook_rw_msg msg = {
+                        .write = 0,
+                        .id = id,
+                };
+                if (inode)
+                        SMFS_POST_HOOK(inode, HOOK_SI_READ, &msg, rc);
+        }
+        else if (keylen >= 10 && memcmp(key, "file_write", 10) == 0) {
+                /* 
+                 * this key used to inform smfs on OST about incoming r/w
+                 */
+                struct lustre_id * id = val;
+                struct hook_rw_msg msg = {
+                        .write = 1,
+                        .id = id,
+                };
+                if (inode)
+                        SMFS_POST_HOOK(inode, HOOK_SI_WRITE, &msg, rc);
+        }
+        else if (keylen >= 10 && memcmp(key, "audit_info", 10) == 0) {
+                /* this key used to pass audit data on MDS */
+                struct audit_info * info = val;
+                                
+                SMFS_POST_HOOK(inode, HOOK_SPECIAL, info, info->m.result);
+        }
+        else if (keylen >= 8 && memcmp(key, "auditlog", 8) == 0) {
+                /* 
+                 * this key used to inform smfs on OST about client audit data
+                 */
+
+                audit_client_log(sb, val);
+        }
+        else if (keylen == 5 && memcmp(key, "audit", 5) == 0) {
+                smfs_set_audit(sb, inode, (__u64 *)val);
+        }   
+        else if (keylen == 7 && memcmp(key, "id2name", 7) == 0) {
+                rc = SMFS_PLG_HELP(sb, PLG_SET_INFO, &msg);
+        }
+        else
+                rc = -ENOENT;
+                
+        RETURN(rc);
+}
+
+static int fsfilt_smfs_get_info (struct super_block *sb, struct inode * inode,
+                                 __u32 keylen, void *key,
+                                 __u32 *valsize, void *val)
+{
+        int rc = -ENOENT;
+        
+        ENTRY;
+        
+        if (keylen == 5 && strcmp(key, "audit") == 0) {
+                __u64 * mask = val;
+                rc = smfs_get_audit(sb, inode, NULL, mask);
+        }
+                        
+        RETURN(rc);
+}
 
 static struct fsfilt_operations fsfilt_smfs_ops = {
         .fs_type                = "smfs",
@@ -1146,10 +1261,11 @@ static struct fsfilt_operations fsfilt_smfs_ops = {
         .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_set_info            = fsfilt_smfs_set_info,
+        .fs_get_info            = fsfilt_smfs_get_info,
         .fs_set_snap_item       = fsfilt_smfs_set_snap_item,
         .fs_do_write_cow        = fsfilt_smfs_do_write_cow,
- };
+};
 
 struct fsfilt_operations *get_smfs_fs_ops(void)
 {