aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/readdir.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 1f0bd0f972d4..6f3d13ff9470 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -790,6 +790,17 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
790 790
791 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 791 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
792 792
793 /*
794 * Ensure FindFirst doesn't fail before doing filldir() for '.' and
795 * '..'. Otherwise we won't be able to notify VFS in case of failure.
796 */
797 if (file->private_data == NULL) {
798 rc = initiate_cifs_search(xid, file);
799 cFYI(1, "initiate cifs search rc %d", rc);
800 if (rc)
801 goto rddir2_exit;
802 }
803
793 switch ((int) file->f_pos) { 804 switch ((int) file->f_pos) {
794 case 0: 805 case 0:
795 if (filldir(direntry, ".", 1, file->f_pos, 806 if (filldir(direntry, ".", 1, file->f_pos,
@@ -814,14 +825,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
814 if after then keep searching till find it */ 825 if after then keep searching till find it */
815 826
816 if (file->private_data == NULL) { 827 if (file->private_data == NULL) {
817 rc = initiate_cifs_search(xid, file);
818 cFYI(1, "initiate cifs search rc %d", rc);
819 if (rc) {
820 FreeXid(xid);
821 return rc;
822 }
823 }
824 if (file->private_data == NULL) {
825 rc = -EINVAL; 828 rc = -EINVAL;
826 FreeXid(xid); 829 FreeXid(xid);
827 return rc; 830 return rc;