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

reset searches properly when filldir fails

parent aad2e949
Version 1.03
------------
Fix problem not attempting connect to server when port number
override not specified.
Connect to server when port number override not specified, and tcp port
unitialized. Reset search to restart at correct file when kernel routine
filldir returns error during large directory searches (readdir).
Version 1.02
------------
......
......@@ -16,6 +16,7 @@
*
*/
#include <linux/in.h>
#include <linux/in6.h>
#include "cifs_fs_sb.h"
/*
* The sizes of various internal tables and strings
......@@ -105,7 +106,10 @@ struct TCP_Server_Info {
char server_Name[SERVER_NAME_LEN_WITH_NULL]; /* 15 chars + X'20'in 16th */
char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2]; /* Unicode version of server_Name */
struct socket *ssocket;
struct sockaddr_in sockAddr;
union {
struct sockaddr_in sockAddr;
struct sockaddr_in6 sockAddr6;
} addr;
wait_queue_head_t response_q;
struct list_head pending_mid_q;
void *Server_NlsInfo; /* BB - placeholder for future NLS info */
......
......@@ -1283,8 +1283,8 @@ construct_dentry(struct qstr *qstring, struct file *file,
}
static void reset_resume_key(struct file * dir_file,
unsigned char * filename,
unsigned int len) {
unsigned char * filename,
unsigned int len) {
struct cifsFileInfo *cifsFile;
cifsFile = (struct cifsFileInfo *)dir_file->private_data;
......@@ -1324,7 +1324,6 @@ cifs_filldir(struct qstr *pqstring, FILE_DIRECTORY_INFO * pfindData,
if(rc) {
/* due to readdir error we need to recalculate resume
key so next readdir will restart on right entry */
reset_resume_key(file, pfindData->FileName, pqstring->len);
cFYI(1,("Error %d on filldir of %s",rc ,pfindData->FileName));
}
dput(tmp_dentry);
......@@ -1351,7 +1350,6 @@ cifs_filldir_unix(struct qstr *pqstring,
if(rc) {
/* due to readdir error we need to recalculate resume
key so next readdir will restart on right entry */
reset_resume_key(file, pUnixFindData->FileName,pqstring->len);
cFYI(1,("Error %d on filldir of %s",rc ,pUnixFindData->FileName));
}
dput(tmp_dentry);
......@@ -1542,6 +1540,11 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
/* do not end search if
kernel not ready to take
remaining entries yet */
if(Unicode == TRUE) {
qstring.len = cifs_strtoUCS((wchar_t *) pfindData->FileName,
pfindData->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindData->FileName,qstring.len);
findParms.EndofSearch = 0;
break;
}
......@@ -1580,6 +1583,11 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
kernel not ready to take
remaining entries yet */
findParms.EndofSearch = 0;
if(Unicode == TRUE) {
qstring.len = cifs_strtoUCS((wchar_t *) pfindDataUnix->FileName,
pfindDataUnix->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindDataUnix->FileName,qstring.len);
break;
}
file->f_pos++;
......@@ -1729,6 +1737,11 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
kernel not ready to take
remaining entries yet */
findNextParms.EndofSearch = 0;
if(Unicode == TRUE) {
qstring.len = cifs_strtoUCS((wchar_t *) pfindData->FileName,
pfindData->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindData->FileName,qstring.len);
break;
}
file->f_pos++;
......@@ -1769,6 +1782,11 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
kernel not ready to take
remaining entries yet */
findNextParms.EndofSearch = 0;
if(Unicode == TRUE) {
qstring.len = cifs_strtoUCS((wchar_t *) pfindDataUnix->FileName,
pfindDataUnix->FileName, 2 * (qstring.len + 1), cifs_sb->local_nls);
}
reset_resume_key(file, pfindDataUnix->FileName,qstring.len);
break;
}
file->f_pos++;
......
......@@ -218,7 +218,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
midQ->midState = MID_REQUEST_SUBMITTED;
rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length,
(struct sockaddr *) &(ses->server->sockAddr));
(struct sockaddr *) &(ses->server->addr.sockAddr));
up(&ses->server->tcpSem);
if (long_op == -1)
goto cifs_no_response_exit;
......
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