Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 318109 Details for
Bug 239685
connectathon special/telldir test fails on CIFS against win2k3
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch -- make sure we have resume info before calling CIFSFindNext
0001-cifs-make-sure-we-have-the-right-resume-info-before.patch (text/plain), 7.89 KB, created by
Jeff Layton
on 2008-09-30 19:13:50 UTC
(
hide
)
Description:
patch -- make sure we have resume info before calling CIFSFindNext
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2008-09-30 19:13:50 UTC
Size:
7.89 KB
patch
obsolete
>From f394a60f9ce7b07b69312fd6f8f9957190a0bd60 Mon Sep 17 00:00:00 2001 >From: Jeff Layton <jlayton@redhat.com> >Date: Tue, 30 Sep 2008 14:25:15 -0400 >Subject: [PATCH] cifs: make sure we have the right resume info before calling CIFSFindNext > >When we do a seekdir() or equivalent, we usually end up doing a >FindFirst call and then call FindNext until we get to the offset that we >want. The problem is that when we call FindNext, the code usually >doesn't have the proper info (mostly, the filename of the entry from the >last search) to resume the search. > >Add a "last_entry" field to the cifs_search_info that points to the last >entry in the search. We calculate this pointer by using the >LastNameOffset field from the search parms that are returned. We then >use that info to do a cifs_save_resume_key before we call CIFSFindNext. > >This patch allows CIFS to reliably pass the "telldir" connectathon test. > >Signed-off-by: Jeff Layton <jlayton@redhat.com> >--- > fs/cifs/cifsglob.h | 1 + > fs/cifs/cifssmb.c | 4 ++ > fs/cifs/readdir.c | 128 ++++++++++++++++++++++++++------------------------- > 3 files changed, 70 insertions(+), 63 deletions(-) > >diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h >index 8dfd6f2..0d22479 100644 >--- a/fs/cifs/cifsglob.h >+++ b/fs/cifs/cifsglob.h >@@ -309,6 +309,7 @@ struct cifs_search_info { > __u32 resume_key; > char *ntwrk_buf_start; > char *srch_entries_start; >+ char *last_entry; > char *presume_name; > unsigned int resume_name_len; > bool endOfSearch:1; >diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c >index 7504d15..7b00a16 100644 >--- a/fs/cifs/cifssmb.c >+++ b/fs/cifs/cifssmb.c >@@ -3636,6 +3636,8 @@ findFirstRetry: > le16_to_cpu(parms->SearchCount); > psrch_inf->index_of_last_entry = 2 /* skip . and .. */ + > psrch_inf->entries_in_buffer; >+ psrch_inf->last_entry = psrch_inf->srch_entries_start + >+ le16_to_cpu(parms->LastNameOffset); > *pnetfid = parms->SearchHandle; > } else { > cifs_buf_release(pSMB); >@@ -3751,6 +3753,8 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, > le16_to_cpu(parms->SearchCount); > psrch_inf->index_of_last_entry += > psrch_inf->entries_in_buffer; >+ psrch_inf->last_entry = psrch_inf->srch_entries_start + >+ le16_to_cpu(parms->LastNameOffset); > /* cFYI(1,("fnxt2 entries in buf %d index_of_last %d", > psrch_inf->entries_in_buffer, psrch_inf->index_of_last_entry)); */ > >diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c >index 5f40ed3..765adf1 100644 >--- a/fs/cifs/readdir.c >+++ b/fs/cifs/readdir.c >@@ -640,6 +640,70 @@ static int is_dir_changed(struct file *file) > > } > >+static int cifs_save_resume_key(const char *current_entry, >+ struct cifsFileInfo *cifsFile) >+{ >+ int rc = 0; >+ unsigned int len = 0; >+ __u16 level; >+ char *filename; >+ >+ if ((cifsFile == NULL) || (current_entry == NULL)) >+ return -EINVAL; >+ >+ level = cifsFile->srch_inf.info_level; >+ >+ if (level == SMB_FIND_FILE_UNIX) { >+ FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry; >+ >+ filename = &pFindData->FileName[0]; >+ if (cifsFile->srch_inf.unicode) { >+ len = cifs_unicode_bytelen(filename); >+ } else { >+ /* BB should we make this strnlen of PATH_MAX? */ >+ len = strnlen(filename, PATH_MAX); >+ } >+ cifsFile->srch_inf.resume_key = pFindData->ResumeKey; >+ } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { >+ FILE_DIRECTORY_INFO *pFindData = >+ (FILE_DIRECTORY_INFO *)current_entry; >+ filename = &pFindData->FileName[0]; >+ len = le32_to_cpu(pFindData->FileNameLength); >+ cifsFile->srch_inf.resume_key = pFindData->FileIndex; >+ } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { >+ FILE_FULL_DIRECTORY_INFO *pFindData = >+ (FILE_FULL_DIRECTORY_INFO *)current_entry; >+ filename = &pFindData->FileName[0]; >+ len = le32_to_cpu(pFindData->FileNameLength); >+ cifsFile->srch_inf.resume_key = pFindData->FileIndex; >+ } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { >+ SEARCH_ID_FULL_DIR_INFO *pFindData = >+ (SEARCH_ID_FULL_DIR_INFO *)current_entry; >+ filename = &pFindData->FileName[0]; >+ len = le32_to_cpu(pFindData->FileNameLength); >+ cifsFile->srch_inf.resume_key = pFindData->FileIndex; >+ } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { >+ FILE_BOTH_DIRECTORY_INFO *pFindData = >+ (FILE_BOTH_DIRECTORY_INFO *)current_entry; >+ filename = &pFindData->FileName[0]; >+ len = le32_to_cpu(pFindData->FileNameLength); >+ cifsFile->srch_inf.resume_key = pFindData->FileIndex; >+ } else if (level == SMB_FIND_FILE_INFO_STANDARD) { >+ FIND_FILE_STANDARD_INFO *pFindData = >+ (FIND_FILE_STANDARD_INFO *)current_entry; >+ filename = &pFindData->FileName[0]; >+ /* one byte length, no name conversion */ >+ len = (unsigned int)pFindData->FileNameLength; >+ cifsFile->srch_inf.resume_key = pFindData->ResumeKey; >+ } else { >+ cFYI(1, ("Unknown findfirst level %d", level)); >+ return -EINVAL; >+ } >+ cifsFile->srch_inf.resume_name_len = len; >+ cifsFile->srch_inf.presume_name = filename; >+ return rc; >+} >+ > /* find the corresponding entry in the search */ > /* Note that the SMB server returns search entries for . and .. which > complicates logic here if we choose to parse for them and we do not >@@ -703,6 +767,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, > while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && > (rc == 0) && !cifsFile->srch_inf.endOfSearch) { > cFYI(1, ("calling findnext2")); >+ cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); > rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, > &cifsFile->srch_inf); > if (rc) >@@ -919,69 +984,6 @@ static int cifs_filldir(char *pfindEntry, struct file *file, > return rc; > } > >-static int cifs_save_resume_key(const char *current_entry, >- struct cifsFileInfo *cifsFile) >-{ >- int rc = 0; >- unsigned int len = 0; >- __u16 level; >- char *filename; >- >- if ((cifsFile == NULL) || (current_entry == NULL)) >- return -EINVAL; >- >- level = cifsFile->srch_inf.info_level; >- >- if (level == SMB_FIND_FILE_UNIX) { >- FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry; >- >- filename = &pFindData->FileName[0]; >- if (cifsFile->srch_inf.unicode) { >- len = cifs_unicode_bytelen(filename); >- } else { >- /* BB should we make this strnlen of PATH_MAX? */ >- len = strnlen(filename, PATH_MAX); >- } >- cifsFile->srch_inf.resume_key = pFindData->ResumeKey; >- } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { >- FILE_DIRECTORY_INFO *pFindData = >- (FILE_DIRECTORY_INFO *)current_entry; >- filename = &pFindData->FileName[0]; >- len = le32_to_cpu(pFindData->FileNameLength); >- cifsFile->srch_inf.resume_key = pFindData->FileIndex; >- } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { >- FILE_FULL_DIRECTORY_INFO *pFindData = >- (FILE_FULL_DIRECTORY_INFO *)current_entry; >- filename = &pFindData->FileName[0]; >- len = le32_to_cpu(pFindData->FileNameLength); >- cifsFile->srch_inf.resume_key = pFindData->FileIndex; >- } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { >- SEARCH_ID_FULL_DIR_INFO *pFindData = >- (SEARCH_ID_FULL_DIR_INFO *)current_entry; >- filename = &pFindData->FileName[0]; >- len = le32_to_cpu(pFindData->FileNameLength); >- cifsFile->srch_inf.resume_key = pFindData->FileIndex; >- } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { >- FILE_BOTH_DIRECTORY_INFO *pFindData = >- (FILE_BOTH_DIRECTORY_INFO *)current_entry; >- filename = &pFindData->FileName[0]; >- len = le32_to_cpu(pFindData->FileNameLength); >- cifsFile->srch_inf.resume_key = pFindData->FileIndex; >- } else if (level == SMB_FIND_FILE_INFO_STANDARD) { >- FIND_FILE_STANDARD_INFO *pFindData = >- (FIND_FILE_STANDARD_INFO *)current_entry; >- filename = &pFindData->FileName[0]; >- /* one byte length, no name conversion */ >- len = (unsigned int)pFindData->FileNameLength; >- cifsFile->srch_inf.resume_key = pFindData->ResumeKey; >- } else { >- cFYI(1, ("Unknown findfirst level %d", level)); >- return -EINVAL; >- } >- cifsFile->srch_inf.resume_name_len = len; >- cifsFile->srch_inf.presume_name = filename; >- return rc; >-} > > int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) > { >-- >1.5.5.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 239685
:
154477
|
317817
|
318109
|
323717