diff options
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r-- | fs/cifs/readdir.c | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index df40cc5fd13a..770d5a9781c1 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -48,15 +48,15 @@ static void dump_cifs_file_struct(struct file *file, char *label) | |||
48 | if (file) { | 48 | if (file) { |
49 | cf = file->private_data; | 49 | cf = file->private_data; |
50 | if (cf == NULL) { | 50 | if (cf == NULL) { |
51 | cFYI(1, "empty cifs private file data"); | 51 | cifs_dbg(FYI, "empty cifs private file data\n"); |
52 | return; | 52 | return; |
53 | } | 53 | } |
54 | if (cf->invalidHandle) | 54 | if (cf->invalidHandle) |
55 | cFYI(1, "invalid handle"); | 55 | cifs_dbg(FYI, "invalid handle\n"); |
56 | if (cf->srch_inf.endOfSearch) | 56 | if (cf->srch_inf.endOfSearch) |
57 | cFYI(1, "end of search"); | 57 | cifs_dbg(FYI, "end of search\n"); |
58 | if (cf->srch_inf.emptyDir) | 58 | if (cf->srch_inf.emptyDir) |
59 | cFYI(1, "empty dir"); | 59 | cifs_dbg(FYI, "empty dir\n"); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | #else | 62 | #else |
@@ -80,7 +80,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
80 | struct super_block *sb = parent->d_inode->i_sb; | 80 | struct super_block *sb = parent->d_inode->i_sb; |
81 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 81 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
82 | 82 | ||
83 | cFYI(1, "%s: for %s", __func__, name->name); | 83 | cifs_dbg(FYI, "%s: for %s\n", __func__, name->name); |
84 | 84 | ||
85 | dentry = d_hash_and_lookup(parent, name); | 85 | dentry = d_hash_and_lookup(parent, name); |
86 | if (unlikely(IS_ERR(dentry))) | 86 | if (unlikely(IS_ERR(dentry))) |
@@ -233,7 +233,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb, | |||
233 | fid, | 233 | fid, |
234 | cifs_sb->local_nls); | 234 | cifs_sb->local_nls); |
235 | if (CIFSSMBClose(xid, ptcon, fid)) { | 235 | if (CIFSSMBClose(xid, ptcon, fid)) { |
236 | cFYI(1, "Error closing temporary reparsepoint open"); | 236 | cifs_dbg(FYI, "Error closing temporary reparsepoint open\n"); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | } | 239 | } |
@@ -285,7 +285,7 @@ initiate_cifs_search(const unsigned int xid, struct file *file) | |||
285 | goto error_exit; | 285 | goto error_exit; |
286 | } | 286 | } |
287 | 287 | ||
288 | cFYI(1, "Full path: %s start at: %lld", full_path, file->f_pos); | 288 | cifs_dbg(FYI, "Full path: %s start at: %lld\n", full_path, file->f_pos); |
289 | 289 | ||
290 | ffirst_retry: | 290 | ffirst_retry: |
291 | /* test for Unix extensions */ | 291 | /* test for Unix extensions */ |
@@ -336,7 +336,7 @@ static int cifs_unicode_bytelen(const char *str) | |||
336 | if (ustr[len] == 0) | 336 | if (ustr[len] == 0) |
337 | return len << 1; | 337 | return len << 1; |
338 | } | 338 | } |
339 | cFYI(1, "Unicode string longer than PATH_MAX found"); | 339 | cifs_dbg(FYI, "Unicode string longer than PATH_MAX found\n"); |
340 | return len << 1; | 340 | return len << 1; |
341 | } | 341 | } |
342 | 342 | ||
@@ -353,18 +353,18 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) | |||
353 | pfData->FileNameLength; | 353 | pfData->FileNameLength; |
354 | } else | 354 | } else |
355 | new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset); | 355 | new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset); |
356 | cFYI(1, "new entry %p old entry %p", new_entry, old_entry); | 356 | cifs_dbg(FYI, "new entry %p old entry %p\n", new_entry, old_entry); |
357 | /* validate that new_entry is not past end of SMB */ | 357 | /* validate that new_entry is not past end of SMB */ |
358 | if (new_entry >= end_of_smb) { | 358 | if (new_entry >= end_of_smb) { |
359 | cERROR(1, "search entry %p began after end of SMB %p old entry %p", | 359 | cifs_dbg(VFS, "search entry %p began after end of SMB %p old entry %p\n", |
360 | new_entry, end_of_smb, old_entry); | 360 | new_entry, end_of_smb, old_entry); |
361 | return NULL; | 361 | return NULL; |
362 | } else if (((level == SMB_FIND_FILE_INFO_STANDARD) && | 362 | } else if (((level == SMB_FIND_FILE_INFO_STANDARD) && |
363 | (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb)) | 363 | (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb)) |
364 | || ((level != SMB_FIND_FILE_INFO_STANDARD) && | 364 | || ((level != SMB_FIND_FILE_INFO_STANDARD) && |
365 | (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) { | 365 | (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) { |
366 | cERROR(1, "search entry %p extends after end of SMB %p", | 366 | cifs_dbg(VFS, "search entry %p extends after end of SMB %p\n", |
367 | new_entry, end_of_smb); | 367 | new_entry, end_of_smb); |
368 | return NULL; | 368 | return NULL; |
369 | } else | 369 | } else |
370 | return new_entry; | 370 | return new_entry; |
@@ -457,7 +457,7 @@ static int cifs_fill_dirent(struct cifs_dirent *de, const void *info, | |||
457 | cifs_fill_dirent_std(de, info); | 457 | cifs_fill_dirent_std(de, info); |
458 | break; | 458 | break; |
459 | default: | 459 | default: |
460 | cFYI(1, "Unknown findfirst level %d", level); | 460 | cifs_dbg(FYI, "Unknown findfirst level %d\n", level); |
461 | return -EINVAL; | 461 | return -EINVAL; |
462 | } | 462 | } |
463 | 463 | ||
@@ -572,7 +572,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, | |||
572 | if (((index_to_find < cfile->srch_inf.index_of_last_entry) && | 572 | if (((index_to_find < cfile->srch_inf.index_of_last_entry) && |
573 | is_dir_changed(file)) || (index_to_find < first_entry_in_buffer)) { | 573 | is_dir_changed(file)) || (index_to_find < first_entry_in_buffer)) { |
574 | /* close and restart search */ | 574 | /* close and restart search */ |
575 | cFYI(1, "search backing up - close and restart search"); | 575 | cifs_dbg(FYI, "search backing up - close and restart search\n"); |
576 | spin_lock(&cifs_file_list_lock); | 576 | spin_lock(&cifs_file_list_lock); |
577 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { | 577 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { |
578 | cfile->invalidHandle = true; | 578 | cfile->invalidHandle = true; |
@@ -582,7 +582,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, | |||
582 | } else | 582 | } else |
583 | spin_unlock(&cifs_file_list_lock); | 583 | spin_unlock(&cifs_file_list_lock); |
584 | if (cfile->srch_inf.ntwrk_buf_start) { | 584 | if (cfile->srch_inf.ntwrk_buf_start) { |
585 | cFYI(1, "freeing SMB ff cache buf on search rewind"); | 585 | cifs_dbg(FYI, "freeing SMB ff cache buf on search rewind\n"); |
586 | if (cfile->srch_inf.smallBuf) | 586 | if (cfile->srch_inf.smallBuf) |
587 | cifs_small_buf_release(cfile->srch_inf. | 587 | cifs_small_buf_release(cfile->srch_inf. |
588 | ntwrk_buf_start); | 588 | ntwrk_buf_start); |
@@ -593,7 +593,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, | |||
593 | } | 593 | } |
594 | rc = initiate_cifs_search(xid, file); | 594 | rc = initiate_cifs_search(xid, file); |
595 | if (rc) { | 595 | if (rc) { |
596 | cFYI(1, "error %d reinitiating a search on rewind", | 596 | cifs_dbg(FYI, "error %d reinitiating a search on rewind\n", |
597 | rc); | 597 | rc); |
598 | return rc; | 598 | return rc; |
599 | } | 599 | } |
@@ -608,7 +608,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, | |||
608 | 608 | ||
609 | while ((index_to_find >= cfile->srch_inf.index_of_last_entry) && | 609 | while ((index_to_find >= cfile->srch_inf.index_of_last_entry) && |
610 | (rc == 0) && !cfile->srch_inf.endOfSearch) { | 610 | (rc == 0) && !cfile->srch_inf.endOfSearch) { |
611 | cFYI(1, "calling findnext2"); | 611 | cifs_dbg(FYI, "calling findnext2\n"); |
612 | rc = server->ops->query_dir_next(xid, tcon, &cfile->fid, | 612 | rc = server->ops->query_dir_next(xid, tcon, &cfile->fid, |
613 | search_flags, | 613 | search_flags, |
614 | &cfile->srch_inf); | 614 | &cfile->srch_inf); |
@@ -631,7 +631,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, | |||
631 | first_entry_in_buffer = cfile->srch_inf.index_of_last_entry | 631 | first_entry_in_buffer = cfile->srch_inf.index_of_last_entry |
632 | - cfile->srch_inf.entries_in_buffer; | 632 | - cfile->srch_inf.entries_in_buffer; |
633 | pos_in_buf = index_to_find - first_entry_in_buffer; | 633 | pos_in_buf = index_to_find - first_entry_in_buffer; |
634 | cFYI(1, "found entry - pos_in_buf %d", pos_in_buf); | 634 | cifs_dbg(FYI, "found entry - pos_in_buf %d\n", pos_in_buf); |
635 | 635 | ||
636 | for (i = 0; (i < (pos_in_buf)) && (cur_ent != NULL); i++) { | 636 | for (i = 0; (i < (pos_in_buf)) && (cur_ent != NULL); i++) { |
637 | /* go entry by entry figuring out which is first */ | 637 | /* go entry by entry figuring out which is first */ |
@@ -640,19 +640,18 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, | |||
640 | } | 640 | } |
641 | if ((cur_ent == NULL) && (i < pos_in_buf)) { | 641 | if ((cur_ent == NULL) && (i < pos_in_buf)) { |
642 | /* BB fixme - check if we should flag this error */ | 642 | /* BB fixme - check if we should flag this error */ |
643 | cERROR(1, "reached end of buf searching for pos in buf" | 643 | cifs_dbg(VFS, "reached end of buf searching for pos in buf %d index to find %lld rc %d\n", |
644 | " %d index to find %lld rc %d", pos_in_buf, | 644 | pos_in_buf, index_to_find, rc); |
645 | index_to_find, rc); | ||
646 | } | 645 | } |
647 | rc = 0; | 646 | rc = 0; |
648 | *current_entry = cur_ent; | 647 | *current_entry = cur_ent; |
649 | } else { | 648 | } else { |
650 | cFYI(1, "index not in buffer - could not findnext into it"); | 649 | cifs_dbg(FYI, "index not in buffer - could not findnext into it\n"); |
651 | return 0; | 650 | return 0; |
652 | } | 651 | } |
653 | 652 | ||
654 | if (pos_in_buf >= cfile->srch_inf.entries_in_buffer) { | 653 | if (pos_in_buf >= cfile->srch_inf.entries_in_buffer) { |
655 | cFYI(1, "can not return entries pos_in_buf beyond last"); | 654 | cifs_dbg(FYI, "can not return entries pos_in_buf beyond last\n"); |
656 | *num_to_ret = 0; | 655 | *num_to_ret = 0; |
657 | } else | 656 | } else |
658 | *num_to_ret = cfile->srch_inf.entries_in_buffer - pos_in_buf; | 657 | *num_to_ret = cfile->srch_inf.entries_in_buffer - pos_in_buf; |
@@ -678,8 +677,8 @@ static int cifs_filldir(char *find_entry, struct file *file, filldir_t filldir, | |||
678 | return rc; | 677 | return rc; |
679 | 678 | ||
680 | if (de.namelen > max_len) { | 679 | if (de.namelen > max_len) { |
681 | cERROR(1, "bad search response length %zd past smb end", | 680 | cifs_dbg(VFS, "bad search response length %zd past smb end\n", |
682 | de.namelen); | 681 | de.namelen); |
683 | return -EINVAL; | 682 | return -EINVAL; |
684 | } | 683 | } |
685 | 684 | ||
@@ -768,7 +767,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
768 | */ | 767 | */ |
769 | if (file->private_data == NULL) { | 768 | if (file->private_data == NULL) { |
770 | rc = initiate_cifs_search(xid, file); | 769 | rc = initiate_cifs_search(xid, file); |
771 | cFYI(1, "initiate cifs search rc %d", rc); | 770 | cifs_dbg(FYI, "initiate cifs search rc %d\n", rc); |
772 | if (rc) | 771 | if (rc) |
773 | goto rddir2_exit; | 772 | goto rddir2_exit; |
774 | } | 773 | } |
@@ -777,7 +776,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
777 | case 0: | 776 | case 0: |
778 | if (filldir(direntry, ".", 1, file->f_pos, | 777 | if (filldir(direntry, ".", 1, file->f_pos, |
779 | file_inode(file)->i_ino, DT_DIR) < 0) { | 778 | file_inode(file)->i_ino, DT_DIR) < 0) { |
780 | cERROR(1, "Filldir for current dir failed"); | 779 | cifs_dbg(VFS, "Filldir for current dir failed\n"); |
781 | rc = -ENOMEM; | 780 | rc = -ENOMEM; |
782 | break; | 781 | break; |
783 | } | 782 | } |
@@ -785,7 +784,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
785 | case 1: | 784 | case 1: |
786 | if (filldir(direntry, "..", 2, file->f_pos, | 785 | if (filldir(direntry, "..", 2, file->f_pos, |
787 | parent_ino(file->f_path.dentry), DT_DIR) < 0) { | 786 | parent_ino(file->f_path.dentry), DT_DIR) < 0) { |
788 | cERROR(1, "Filldir for parent dir failed"); | 787 | cifs_dbg(VFS, "Filldir for parent dir failed\n"); |
789 | rc = -ENOMEM; | 788 | rc = -ENOMEM; |
790 | break; | 789 | break; |
791 | } | 790 | } |
@@ -804,7 +803,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
804 | cifsFile = file->private_data; | 803 | cifsFile = file->private_data; |
805 | if (cifsFile->srch_inf.endOfSearch) { | 804 | if (cifsFile->srch_inf.endOfSearch) { |
806 | if (cifsFile->srch_inf.emptyDir) { | 805 | if (cifsFile->srch_inf.emptyDir) { |
807 | cFYI(1, "End of search, empty dir"); | 806 | cifs_dbg(FYI, "End of search, empty dir\n"); |
808 | rc = 0; | 807 | rc = 0; |
809 | break; | 808 | break; |
810 | } | 809 | } |
@@ -817,16 +816,16 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
817 | rc = find_cifs_entry(xid, tcon, file, ¤t_entry, | 816 | rc = find_cifs_entry(xid, tcon, file, ¤t_entry, |
818 | &num_to_fill); | 817 | &num_to_fill); |
819 | if (rc) { | 818 | if (rc) { |
820 | cFYI(1, "fce error %d", rc); | 819 | cifs_dbg(FYI, "fce error %d\n", rc); |
821 | goto rddir2_exit; | 820 | goto rddir2_exit; |
822 | } else if (current_entry != NULL) { | 821 | } else if (current_entry != NULL) { |
823 | cFYI(1, "entry %lld found", file->f_pos); | 822 | cifs_dbg(FYI, "entry %lld found\n", file->f_pos); |
824 | } else { | 823 | } else { |
825 | cFYI(1, "could not find entry"); | 824 | cifs_dbg(FYI, "could not find entry\n"); |
826 | goto rddir2_exit; | 825 | goto rddir2_exit; |
827 | } | 826 | } |
828 | cFYI(1, "loop through %d times filling dir for net buf %p", | 827 | cifs_dbg(FYI, "loop through %d times filling dir for net buf %p\n", |
829 | num_to_fill, cifsFile->srch_inf.ntwrk_buf_start); | 828 | num_to_fill, cifsFile->srch_inf.ntwrk_buf_start); |
830 | max_len = tcon->ses->server->ops->calc_smb_size( | 829 | max_len = tcon->ses->server->ops->calc_smb_size( |
831 | cifsFile->srch_inf.ntwrk_buf_start); | 830 | cifsFile->srch_inf.ntwrk_buf_start); |
832 | end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; | 831 | end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; |
@@ -840,8 +839,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
840 | for (i = 0; (i < num_to_fill) && (rc == 0); i++) { | 839 | for (i = 0; (i < num_to_fill) && (rc == 0); i++) { |
841 | if (current_entry == NULL) { | 840 | if (current_entry == NULL) { |
842 | /* evaluate whether this case is an error */ | 841 | /* evaluate whether this case is an error */ |
843 | cERROR(1, "past SMB end, num to fill %d i %d", | 842 | cifs_dbg(VFS, "past SMB end, num to fill %d i %d\n", |
844 | num_to_fill, i); | 843 | num_to_fill, i); |
845 | break; | 844 | break; |
846 | } | 845 | } |
847 | /* | 846 | /* |
@@ -858,8 +857,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
858 | file->f_pos++; | 857 | file->f_pos++; |
859 | if (file->f_pos == | 858 | if (file->f_pos == |
860 | cifsFile->srch_inf.index_of_last_entry) { | 859 | cifsFile->srch_inf.index_of_last_entry) { |
861 | cFYI(1, "last entry in buf at pos %lld %s", | 860 | cifs_dbg(FYI, "last entry in buf at pos %lld %s\n", |
862 | file->f_pos, tmp_buf); | 861 | file->f_pos, tmp_buf); |
863 | cifs_save_resume_key(current_entry, cifsFile); | 862 | cifs_save_resume_key(current_entry, cifsFile); |
864 | break; | 863 | break; |
865 | } else | 864 | } else |