Whamcloud - gitweb
Branch b1_4
[fs/lustre-release.git] / lustre / smfs / symlink.c
index 99e839f..6daf3e3 100644 (file)
@@ -42,51 +42,59 @@ static int smfs_readlink(struct dentry *dentry, char *buffer, int buflen)
 {
         struct inode *cache_inode = I2CI(dentry->d_inode);
         struct dentry *cache_dentry;
-        int rc = 0;
+        int rc = -ENOMEM;
+        struct hook_symlink_msg msg = {
+                .dentry = dentry,
+        };
+        
         ENTRY;
 
-        if (!cache_inode)
+        if (!cache_inode || !cache_inode->i_op->readlink)
                 RETURN(-ENOENT);
-
+        
         cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
-        if (!cache_dentry)
-                GOTO(exit, rc = -ENOMEM);
-        if (cache_inode->i_op && cache_inode->i_op->readlink)
-                rc = cache_inode->i_op->readlink(cache_dentry, buffer, buflen);
-        GOTO(exit, rc);
+        if (!cache_dentry) {
+                rc = -ENOMEM;
+                goto exit;
+        }
+
+        SMFS_PRE_HOOK(dentry->d_inode, HOOK_READLINK, &msg);
+        
+        rc = cache_inode->i_op->readlink(cache_dentry, buffer, buflen);
+
+        SMFS_POST_HOOK(dentry->d_inode, HOOK_READLINK, &msg, rc); 
+       
 exit:
         post_smfs_dentry(cache_dentry);
-        return rc;
+        RETURN(rc);
 }
 
 static int smfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
         struct inode *cache_inode = I2CI(dentry->d_inode);
         struct dentry *cache_dentry;
-        int rc = 0;
+        int rc = -ENOMEM;
         ENTRY;
 
-        if (!cache_inode)
+        if (!cache_inode || !cache_inode->i_op->follow_link)
                 RETURN(-ENOENT);
 
         cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
-        if (!cache_dentry)
-                GOTO(exit, rc = -ENOMEM);
-
-        if (cache_inode->i_op && cache_inode->i_op->follow_link)
+        if (cache_dentry)
                 rc = cache_inode->i_op->follow_link(cache_dentry, nd);
-exit:
+
         post_smfs_dentry(cache_dentry);
-        return rc;
+        RETURN(rc);
 }
 
 struct inode_operations smfs_sym_iops = {
-        readlink:        smfs_readlink,
-        follow_link:        smfs_follow_link,
-        setxattr:       smfs_setxattr,          /* BKL held */
-        getxattr:       smfs_getxattr,          /* BKL held */
-        listxattr:      smfs_listxattr,         /* BKL held */
-        removexattr:    smfs_removexattr,       /* BKL held */
+        .readlink        = smfs_readlink,
+        .follow_link     = smfs_follow_link,
+        .setxattr        = smfs_setxattr,
+        .getxattr        = smfs_getxattr,
+        .listxattr       = smfs_listxattr,
+        .removexattr     = smfs_removexattr,
+        .permission      = smfs_permission,
 };
 
 struct file_operations smfs_sym_fops = {