Whamcloud - gitweb
Fix eric's extremely well-spotted locking bug. It's not clear that we even
[fs/lustre-release.git] / lustre / llite / dir.c
index 84aa5ae..df7a290 100644 (file)
@@ -77,11 +77,13 @@ static int ll_dir_readpage(struct file *file, struct page *page)
         rc = ll_lock(inode, NULL, &it, &lockh);
         request = (struct ptlrpc_request *)it.it_data;
         ptlrpc_free_req(request);
-        if (rc != ELDLM_OK)
+        if (rc != ELDLM_OK) {
                 CERROR("lock enqueue: err: %d\n", rc);
+                UnlockPage(page);
+                RETURN(rc);
+        }
         ldlm_lock_dump((void *)(unsigned long)lockh.addr);
 
-
         if (Page_Uptodate(page)) {
                 CERROR("Explain this please?\n");
                 GOTO(readpage_out, rc);
@@ -186,6 +188,8 @@ static void ext2_check_page(struct page *page)
                 for (offs = limit; offs<PAGE_CACHE_SIZE; offs += chunk_size) {
                         ext2_dirent *p = (ext2_dirent*)(kaddr + offs);
                         p->rec_len = cpu_to_le16(chunk_size);
+                        p->name_len = 0;
+                        p->inode = 0;
                 }
                 if (!limit)
                         goto out;
@@ -347,8 +351,7 @@ static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode)
         de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
 }
 
-int
-ll_readdir (struct file * filp, void * dirent, filldir_t filldir)
+int ll_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
         loff_t pos = filp->f_pos;
         struct inode *inode = filp->f_dentry->d_inode;
@@ -359,6 +362,7 @@ ll_readdir (struct file * filp, void * dirent, filldir_t filldir)
         unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
         unsigned char *types = NULL;
         int need_revalidate = (filp->f_version != inode->i_version);
+        ENTRY;
 
         if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
                 GOTO(done, 0);
@@ -470,9 +474,9 @@ struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
         return de;
 }
 
-ino_t ll_inode_by_name(struct inode * dir, struct dentry *dentry, int *type)
+obd_id ll_inode_by_name(struct inode * dir, struct dentry *dentry, int *type)
 {
-        ino_t res = 0;
+        obd_id res = 0;
         struct ext2_dir_entry_2 * de;
         struct page *page;