Commit 7bf675d6 authored by Steve French's avatar Steve French Committed by Steve French

improve resume key resetting logic when filldir returns error and filename is in unicode

parent 47b65300
...@@ -1284,7 +1284,7 @@ construct_dentry(struct qstr *qstring, struct file *file, ...@@ -1284,7 +1284,7 @@ construct_dentry(struct qstr *qstring, struct file *file,
static void reset_resume_key(struct file * dir_file, static void reset_resume_key(struct file * dir_file,
unsigned char * filename, unsigned char * filename,
unsigned int len) { unsigned int len,int Unicode,struct nls_table * nls_tab) {
struct cifsFileInfo *cifsFile; struct cifsFileInfo *cifsFile;
cifsFile = (struct cifsFileInfo *)dir_file->private_data; cifsFile = (struct cifsFileInfo *)dir_file->private_data;
...@@ -1294,12 +1294,20 @@ static void reset_resume_key(struct file * dir_file, ...@@ -1294,12 +1294,20 @@ static void reset_resume_key(struct file * dir_file,
kfree(cifsFile->search_resume_name); kfree(cifsFile->search_resume_name);
} }
if(Unicode)
len *= 2;
cifsFile->resume_name_length = len; cifsFile->resume_name_length = len;
cifsFile->search_resume_name = cifsFile->search_resume_name =
kmalloc(cifsFile->resume_name_length, GFP_KERNEL); kmalloc(cifsFile->resume_name_length, GFP_KERNEL);
memcpy(cifsFile->search_resume_name, filename,
if(Unicode)
cifs_strtoUCS((wchar_t *) cifsFile->search_resume_name,
filename, len, nls_tab);
else
memcpy(cifsFile->search_resume_name, filename,
cifsFile->resume_name_length); cifsFile->resume_name_length);
cFYI(1,("Reset resume key to: %s",filename)); cFYI(1,("Reset resume key to: %s with len %d",filename,len));
return; return;
} }
...@@ -1540,11 +1548,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1540,11 +1548,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
/* do not end search if /* do not end search if
kernel not ready to take kernel not ready to take
remaining entries yet */ remaining entries yet */
if(Unicode == TRUE) { reset_resume_key(file, pfindData->FileName,qstring.len,
qstring.len = cifs_strtoUCS((wchar_t *) pfindData->FileName, Unicode, cifs_sb->local_nls);
pfindData->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindData->FileName,qstring.len);
findParms.EndofSearch = 0; findParms.EndofSearch = 0;
break; break;
} }
...@@ -1583,11 +1588,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1583,11 +1588,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
kernel not ready to take kernel not ready to take
remaining entries yet */ remaining entries yet */
findParms.EndofSearch = 0; findParms.EndofSearch = 0;
if(Unicode == TRUE) { reset_resume_key(file, pfindDataUnix->FileName,
qstring.len = cifs_strtoUCS((wchar_t *) pfindDataUnix->FileName, qstring.len,Unicode,cifs_sb->local_nls);
pfindDataUnix->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindDataUnix->FileName,qstring.len);
break; break;
} }
file->f_pos++; file->f_pos++;
...@@ -1737,11 +1739,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1737,11 +1739,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
kernel not ready to take kernel not ready to take
remaining entries yet */ remaining entries yet */
findNextParms.EndofSearch = 0; findNextParms.EndofSearch = 0;
if(Unicode == TRUE) { reset_resume_key(file, pfindData->FileName,qstring.len,
qstring.len = cifs_strtoUCS((wchar_t *) pfindData->FileName, Unicode,cifs_sb->local_nls);
pfindData->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindData->FileName,qstring.len);
break; break;
} }
file->f_pos++; file->f_pos++;
...@@ -1782,11 +1781,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1782,11 +1781,8 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
kernel not ready to take kernel not ready to take
remaining entries yet */ remaining entries yet */
findNextParms.EndofSearch = 0; findNextParms.EndofSearch = 0;
if(Unicode == TRUE) { reset_resume_key(file, pfindDataUnix->FileName,qstring.len,
qstring.len = cifs_strtoUCS((wchar_t *) pfindDataUnix->FileName, Unicode,cifs_sb->local_nls);
pfindDataUnix->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindDataUnix->FileName,qstring.len);
break; break;
} }
file->f_pos++; file->f_pos++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment