diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-11-20 13:55:33 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-11-22 13:24:47 -0500 |
commit | ece0b4233b6b915d1f63add2bd9f2733aec6317a (patch) | |
tree | f0f9a2ec50079ccd0c95ddce082648ab25923cfe | |
parent | 85f8607e163f8d281fb407357279cb4ac6df12e6 (diff) |
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>
-rw-r--r-- | fs/nfs/dir.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 2492bacf68a7..ddc2e439702b 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -709,13 +709,15 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
709 | } | 709 | } |
710 | 710 | ||
711 | for (i = desc->cache_entry_index; i < array->size; i++) { | 711 | for (i = desc->cache_entry_index; i < array->size; i++) { |
712 | struct nfs_cache_array_entry *ent; | ||
712 | d_type = DT_UNKNOWN; | 713 | d_type = DT_UNKNOWN; |
713 | 714 | ||
714 | res = filldir(dirent, array->array[i].string.name, | 715 | ent = &array->array[i]; |
715 | array->array[i].string.len, file->f_pos, | 716 | if (filldir(dirent, ent->string.name, ent->string.len, |
716 | nfs_compat_user_ino64(array->array[i].ino), d_type); | 717 | file->f_pos, nfs_compat_user_ino64(ent->ino), d_type) < 0) { |
717 | if (res < 0) | 718 | desc->eof = 1; |
718 | break; | 719 | break; |
720 | } | ||
719 | file->f_pos++; | 721 | file->f_pos++; |
720 | desc->cache_entry_index = i; | 722 | desc->cache_entry_index = i; |
721 | if (i < (array->size-1)) | 723 | if (i < (array->size-1)) |
@@ -820,14 +822,14 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
820 | res = readdir_search_pagecache(desc); | 822 | res = readdir_search_pagecache(desc); |
821 | 823 | ||
822 | if (res == -EBADCOOKIE) { | 824 | if (res == -EBADCOOKIE) { |
825 | res = 0; | ||
823 | /* This means either end of directory */ | 826 | /* This means either end of directory */ |
824 | if (*desc->dir_cookie && desc->eof == 0) { | 827 | if (*desc->dir_cookie && desc->eof == 0) { |
825 | /* Or that the server has 'lost' a cookie */ | 828 | /* Or that the server has 'lost' a cookie */ |
826 | res = uncached_readdir(desc, dirent, filldir); | 829 | res = uncached_readdir(desc, dirent, filldir); |
827 | if (res >= 0) | 830 | if (res == 0) |
828 | continue; | 831 | continue; |
829 | } | 832 | } |
830 | res = 0; | ||
831 | break; | 833 | break; |
832 | } | 834 | } |
833 | if (res == -ETOOSMALL && desc->plus) { | 835 | if (res == -ETOOSMALL && desc->plus) { |
@@ -842,10 +844,8 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
842 | break; | 844 | break; |
843 | 845 | ||
844 | res = nfs_do_filldir(desc, dirent, filldir); | 846 | res = nfs_do_filldir(desc, dirent, filldir); |
845 | if (res < 0) { | 847 | if (res < 0) |
846 | res = 0; | ||
847 | break; | 848 | break; |
848 | } | ||
849 | } | 849 | } |
850 | out: | 850 | out: |
851 | nfs_unblock_sillyrename(dentry); | 851 | nfs_unblock_sillyrename(dentry); |