Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128909
b: refs/heads/master
c: f2322b1
h: refs/heads/master
i:
  128907: ace8b9e
v: v3
  • Loading branch information
David Woodhouse authored and Chris Mason committed Sep 25, 2008
1 parent 97f0f98 commit c31598c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 49593bfa575b7e3fda073b6d1033ee273bdaf97c
refs/heads/master: f2322b1c652add8bcd64b10843d76b0211ab1fc6
11 changes: 7 additions & 4 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,7 @@ struct nfshack_dirent {
struct nfshack_readdir {
char *dirent;
size_t used;
int full;
};


Expand All @@ -2052,8 +2053,10 @@ static int btrfs_nfshack_filldir(void *__buf, const char *name, int namlen,
unsigned int reclen;

reclen = ALIGN(sizeof(struct nfshack_dirent) + namlen, sizeof(u64));
if (buf->used + reclen > PAGE_SIZE)
if (buf->used + reclen > PAGE_SIZE) {
buf->full = 1;
return -EINVAL;
}

de->namlen = namlen;
de->offset = offset;
Expand All @@ -2080,11 +2083,11 @@ static int btrfs_nfshack_readdir(struct file *file, void *dirent,

offset = file->f_pos;

while (1) {
do {
unsigned int reclen;

buf.used = 0;

buf.full = 0;
err = btrfs_real_readdir(file, &buf, btrfs_nfshack_filldir);
if (err)
break;
Expand All @@ -2108,7 +2111,7 @@ static int btrfs_nfshack_readdir(struct file *file, void *dirent,
size -= reclen;
de = (struct nfshack_dirent *)((char *)de + reclen);
}
}
} while (buf.full);

done:
free_page((unsigned long)buf.dirent);
Expand Down

0 comments on commit c31598c

Please sign in to comment.