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