NFS: Don't ignore errors from nfs_do_filldir()

We should ignore the errors from the filldir callback, and just interpret
them as meaning we should exit, however we should definitely pass back
ENOMEM errors.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

+9 -9
+9 -9
fs/nfs/dir.c
··· 709 709 } 710 710 711 711 for (i = desc->cache_entry_index; i < array->size; i++) { 712 + struct nfs_cache_array_entry *ent; 712 713 d_type = DT_UNKNOWN; 713 714 714 - res = filldir(dirent, array->array[i].string.name, 715 - array->array[i].string.len, file->f_pos, 716 - nfs_compat_user_ino64(array->array[i].ino), d_type); 717 - if (res < 0) 715 + ent = &array->array[i]; 716 + if (filldir(dirent, ent->string.name, ent->string.len, 717 + file->f_pos, nfs_compat_user_ino64(ent->ino), d_type) < 0) { 718 + desc->eof = 1; 718 719 break; 720 + } 719 721 file->f_pos++; 720 722 desc->cache_entry_index = i; 721 723 if (i < (array->size-1)) ··· 822 820 res = readdir_search_pagecache(desc); 823 821 824 822 if (res == -EBADCOOKIE) { 823 + res = 0; 825 824 /* This means either end of directory */ 826 825 if (*desc->dir_cookie && desc->eof == 0) { 827 826 /* Or that the server has 'lost' a cookie */ 828 827 res = uncached_readdir(desc, dirent, filldir); 829 - if (res >= 0) 828 + if (res == 0) 830 829 continue; 831 830 } 832 - res = 0; 833 831 break; 834 832 } 835 833 if (res == -ETOOSMALL && desc->plus) { ··· 844 842 break; 845 843 846 844 res = nfs_do_filldir(desc, dirent, filldir); 847 - if (res < 0) { 848 - res = 0; 845 + if (res < 0) 849 846 break; 850 - } 851 847 } 852 848 out: 853 849 nfs_unblock_sillyrename(dentry);