diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-25 22:57:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-25 22:57:30 -0400 |
commit | 23cf24c0c83a5a6eb39b9fa4d3843a8b9414db40 (patch) | |
tree | 6abea5b36ce69113032466903db452d955dce4bb | |
parent | 4403b406d4369a275d483ece6ddee0088cc0d592 (diff) | |
parent | 3c37fc86d20fe35be656f070997d62f75c2e4874 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: Fix duplicate entries returned from getdents() system call
ext3: Fix duplicate entries returned from getdents() system call
-rw-r--r-- | fs/ext3/dir.c | 20 | ||||
-rw-r--r-- | fs/ext4/dir.c | 20 |
2 files changed, 16 insertions, 24 deletions
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 4c82531ea0a8..5853f4440af4 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -456,17 +456,8 @@ static int ext3_dx_readdir(struct file * filp, | |||
456 | if (info->extra_fname) { | 456 | if (info->extra_fname) { |
457 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) | 457 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) |
458 | goto finished; | 458 | goto finished; |
459 | |||
460 | info->extra_fname = NULL; | 459 | info->extra_fname = NULL; |
461 | info->curr_node = rb_next(info->curr_node); | 460 | goto next_node; |
462 | if (!info->curr_node) { | ||
463 | if (info->next_hash == ~0) { | ||
464 | filp->f_pos = EXT3_HTREE_EOF; | ||
465 | goto finished; | ||
466 | } | ||
467 | info->curr_hash = info->next_hash; | ||
468 | info->curr_minor_hash = 0; | ||
469 | } | ||
470 | } else if (!info->curr_node) | 461 | } else if (!info->curr_node) |
471 | info->curr_node = rb_first(&info->root); | 462 | info->curr_node = rb_first(&info->root); |
472 | 463 | ||
@@ -498,9 +489,14 @@ static int ext3_dx_readdir(struct file * filp, | |||
498 | info->curr_minor_hash = fname->minor_hash; | 489 | info->curr_minor_hash = fname->minor_hash; |
499 | if (call_filldir(filp, dirent, filldir, fname)) | 490 | if (call_filldir(filp, dirent, filldir, fname)) |
500 | break; | 491 | break; |
501 | 492 | next_node: | |
502 | info->curr_node = rb_next(info->curr_node); | 493 | info->curr_node = rb_next(info->curr_node); |
503 | if (!info->curr_node) { | 494 | if (info->curr_node) { |
495 | fname = rb_entry(info->curr_node, struct fname, | ||
496 | rb_hash); | ||
497 | info->curr_hash = fname->hash; | ||
498 | info->curr_minor_hash = fname->minor_hash; | ||
499 | } else { | ||
504 | if (info->next_hash == ~0) { | 500 | if (info->next_hash == ~0) { |
505 | filp->f_pos = EXT3_HTREE_EOF; | 501 | filp->f_pos = EXT3_HTREE_EOF; |
506 | break; | 502 | break; |
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 3ca6a2b7632d..fed5b610df5a 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -459,17 +459,8 @@ static int ext4_dx_readdir(struct file *filp, | |||
459 | if (info->extra_fname) { | 459 | if (info->extra_fname) { |
460 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) | 460 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) |
461 | goto finished; | 461 | goto finished; |
462 | |||
463 | info->extra_fname = NULL; | 462 | info->extra_fname = NULL; |
464 | info->curr_node = rb_next(info->curr_node); | 463 | goto next_node; |
465 | if (!info->curr_node) { | ||
466 | if (info->next_hash == ~0) { | ||
467 | filp->f_pos = EXT4_HTREE_EOF; | ||
468 | goto finished; | ||
469 | } | ||
470 | info->curr_hash = info->next_hash; | ||
471 | info->curr_minor_hash = 0; | ||
472 | } | ||
473 | } else if (!info->curr_node) | 464 | } else if (!info->curr_node) |
474 | info->curr_node = rb_first(&info->root); | 465 | info->curr_node = rb_first(&info->root); |
475 | 466 | ||
@@ -501,9 +492,14 @@ static int ext4_dx_readdir(struct file *filp, | |||
501 | info->curr_minor_hash = fname->minor_hash; | 492 | info->curr_minor_hash = fname->minor_hash; |
502 | if (call_filldir(filp, dirent, filldir, fname)) | 493 | if (call_filldir(filp, dirent, filldir, fname)) |
503 | break; | 494 | break; |
504 | 495 | next_node: | |
505 | info->curr_node = rb_next(info->curr_node); | 496 | info->curr_node = rb_next(info->curr_node); |
506 | if (!info->curr_node) { | 497 | if (info->curr_node) { |
498 | fname = rb_entry(info->curr_node, struct fname, | ||
499 | rb_hash); | ||
500 | info->curr_hash = fname->hash; | ||
501 | info->curr_minor_hash = fname->minor_hash; | ||
502 | } else { | ||
507 | if (info->next_hash == ~0) { | 503 | if (info->next_hash == ~0) { |
508 | filp->f_pos = EXT4_HTREE_EOF; | 504 | filp->f_pos = EXT4_HTREE_EOF; |
509 | break; | 505 | break; |