diff options
Diffstat (limited to 'fs/ext4/dir.c')
-rw-r--r-- | fs/ext4/dir.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index d3d23d73c08b..ec8e33b45219 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -411,7 +411,7 @@ static int call_filldir(struct file * filp, void * dirent, | |||
411 | get_dtype(sb, fname->file_type)); | 411 | get_dtype(sb, fname->file_type)); |
412 | if (error) { | 412 | if (error) { |
413 | filp->f_pos = curr_pos; | 413 | filp->f_pos = curr_pos; |
414 | info->extra_fname = fname->next; | 414 | info->extra_fname = fname; |
415 | return error; | 415 | return error; |
416 | } | 416 | } |
417 | fname = fname->next; | 417 | fname = fname->next; |
@@ -450,11 +450,21 @@ static int ext4_dx_readdir(struct file * filp, | |||
450 | * If there are any leftover names on the hash collision | 450 | * If there are any leftover names on the hash collision |
451 | * chain, return them first. | 451 | * chain, return them first. |
452 | */ | 452 | */ |
453 | if (info->extra_fname && | 453 | if (info->extra_fname) { |
454 | call_filldir(filp, dirent, filldir, info->extra_fname)) | 454 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) |
455 | goto finished; | 455 | goto finished; |
456 | 456 | ||
457 | if (!info->curr_node) | 457 | info->extra_fname = NULL; |
458 | info->curr_node = rb_next(info->curr_node); | ||
459 | if (!info->curr_node) { | ||
460 | if (info->next_hash == ~0) { | ||
461 | filp->f_pos = EXT4_HTREE_EOF; | ||
462 | goto finished; | ||
463 | } | ||
464 | info->curr_hash = info->next_hash; | ||
465 | info->curr_minor_hash = 0; | ||
466 | } | ||
467 | } else if (!info->curr_node) | ||
458 | info->curr_node = rb_first(&info->root); | 468 | info->curr_node = rb_first(&info->root); |
459 | 469 | ||
460 | while (1) { | 470 | while (1) { |