int rc = 0;
struct ptlrpc_request *request;
struct lustre_handle lockh;
+ struct mds_body *body;
struct lookup_intent it = {IT_READDIR};
ENTRY;
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);
rc = mdc_readpage(&sbi->ll_mdc_conn, inode->i_ino,
S_IFDIR, offset, buf, &request);
kunmap(page);
+ body = lustre_msg_buf(request->rq_repmsg, 0);
+ if (!body)
+ rc = -EINVAL;
+ if (body)
+ inode->i_size = body->size;
ptlrpc_free_req(request);
EXIT;
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;
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;
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);
ext2_dirent *de;
struct page *page = ext2_get_page(inode, n);
+ /* size might have been updated by mdc_readpage */
+ npages = dir_pages(inode);
+
if (IS_ERR(page))
continue;
kaddr = page_address(page);
filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
filp->f_version = inode->i_version;
UPDATE_ATIME(inode);
- return 0;
+ RETURN(0);
}
/*