Whamcloud - gitweb
Landing of b_recovery (at last).
[fs/lustre-release.git] / lustre / llite / symlink.c
index d522485..742e430 100644 (file)
@@ -32,13 +32,11 @@ static int ll_readlink_internal(struct inode *inode,
 {
         struct ll_inode_info *lli = ll_i2info(inode);
         struct ll_sb_info *sbi = ll_i2sbi(inode);
-        int rc, len = inode->i_size + 1;
+        int rc, symlen = inode->i_size + 1;
         ENTRY;
 
         *request = NULL;
 
-        CHECK_MOUNT_EPOCH(inode);
-
         if (lli->lli_symlink_name) {
                 *symname = lli->lli_symlink_name;
                 CDEBUG(D_INODE, "using cached symlink %s\n", *symname);
@@ -46,7 +44,7 @@ static int ll_readlink_internal(struct inode *inode,
         }
 
         rc = mdc_getattr(&sbi->ll_mdc_conn, inode->i_ino, S_IFLNK,
-                         OBD_MD_LINKNAME, len, request);
+                         OBD_MD_LINKNAME, symlen, request);
         if (rc) {
                 CERROR("inode "LPD64": rc = %d\n", inode->i_ino, rc);
                 RETURN(rc);
@@ -54,10 +52,10 @@ static int ll_readlink_internal(struct inode *inode,
 
         *symname = lustre_msg_buf((*request)->rq_repmsg, 1);
 
-        OBD_ALLOC(lli->lli_symlink_name, len);
+        OBD_ALLOC(lli->lli_symlink_name, symlen);
         /* do not return an error if we cannot cache the symlink locally */
         if (lli->lli_symlink_name)
-                memcpy(lli->lli_symlink_name, *symname, len);
+                memcpy(lli->lli_symlink_name, *symname, symlen);
 
         RETURN(0);
 }
@@ -71,8 +69,6 @@ static int ll_readlink(struct dentry *dentry, char *buffer, int buflen)
         int rc;
         ENTRY;
 
-        CHECK_MOUNT_EPOCH(inode);
-
         /* on symlinks lli_open_sem protects lli_symlink_name allocation/data */
         down(&lli->lli_open_sem);
         rc = ll_readlink_internal(inode, &request, &symname);
@@ -87,7 +83,8 @@ static int ll_readlink(struct dentry *dentry, char *buffer, int buflen)
         RETURN(rc);
 }
 
-static int ll_follow_link(struct dentry *dentry, struct nameidata *nd)
+static int ll_follow_link(struct dentry *dentry, struct nameidata *nd,
+                          struct lookup_intent *it)
 {
         struct inode *inode = dentry->d_inode;
         struct ll_inode_info *lli = ll_i2info(inode);
@@ -96,14 +93,21 @@ static int ll_follow_link(struct dentry *dentry, struct nameidata *nd)
         int rc;
         ENTRY;
 
-        CHECK_MOUNT_EPOCH(inode);
+        /* we got here from a lookup up to the symlink that we hit */
+        if (it->it_lock_mode) {
+                struct lustre_handle *handle =
+                        (struct lustre_handle *)it->it_lock_handle;
+                ldlm_lock_decref(handle, it->it_lock_mode);
+                it->it_lock_mode = 0;
+                memset(handle, 0, sizeof(*handle));
+        }
 
         down(&lli->lli_open_sem);
         rc = ll_readlink_internal(inode, &request, &symname);
         if (rc)
                 GOTO(out, rc);
 
-       rc = vfs_follow_link(nd, symname);
+        rc = vfs_follow_link_it(nd, symname, it);
  out:
         up(&lli->lli_open_sem);
         ptlrpc_req_finished(request);
@@ -115,5 +119,5 @@ extern int ll_setattr(struct dentry *de, struct iattr *attr);
 struct inode_operations ll_fast_symlink_inode_operations = {
         readlink:       ll_readlink,
         setattr:        ll_setattr,
-        follow_link:    ll_follow_link
+        follow_link2:    ll_follow_link
 };