Whamcloud - gitweb
Merge b_md to HEAD for 0.5.19 release.
[fs/lustre-release.git] / lustre / llite / symlink.c
index 8042589..5be4717 100644 (file)
@@ -32,7 +32,7 @@ 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;
@@ -44,18 +44,18 @@ 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);
+                CERROR("inode %lu: rc = %d\n", inode->i_ino, rc);
                 RETURN(rc);
         }
 
         *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);
 }
@@ -89,24 +89,28 @@ static int ll_follow_link(struct dentry *dentry, struct nameidata *nd,
         struct inode *inode = dentry->d_inode;
         struct ll_inode_info *lli = ll_i2info(inode);
         struct ptlrpc_request *request;
+        int op = 0, mode = 0, rc;
         char *symname;
-        int rc;
         ENTRY;
 
-        /* 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));
+        if (it != NULL) {
+                op = it->it_op;
+                mode = it->it_mode;
+
+                ll_intent_release(dentry, it);
         }
 
         down(&lli->lli_open_sem);
+
         rc = ll_readlink_internal(inode, &request, &symname);
         if (rc)
                 GOTO(out, rc);
 
+        if (it != NULL) {
+                it->it_op = op;
+                it->it_mode = mode;
+        }
+
         rc = vfs_follow_link_it(nd, symname, it);
  out:
         up(&lli->lli_open_sem);