Commit 8a98ef65 authored by Steve French's avatar Steve French

Fix caching of directory inodes (was always querying server on directory...

Fix caching of directory inodes (was always querying server on directory inodes).  Reconnect fids (file ids) after session reconnection e.g. due to temporary server or network failure.
parent 7f754cf4
Version 0.66
------------
Reconnect tids and fids after session reconnection (still do not
reconnect byte range locks though). Fix problem caching
lookup information for directory inodes, improving performance,
especially in deep directory trees. Fix various build warnings.
Version 0.65 Version 0.65
------------ ------------
Finish fixes to commit write for caching/readahead consistency. fsx Finish fixes to commit write for caching/readahead consistency. fsx
......
...@@ -72,6 +72,7 @@ extern int cifs_get_inode_info_unix(struct inode **pinode, ...@@ -72,6 +72,7 @@ extern int cifs_get_inode_info_unix(struct inode **pinode,
const unsigned char *search_path, const unsigned char *search_path,
struct super_block *sb); struct super_block *sb);
extern int reopen_files(struct cifsTconInfo *, struct nls_table *);
extern int setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, extern int setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
struct nls_table * nls_info); struct nls_table * nls_info);
extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses); extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses);
......
...@@ -59,6 +59,8 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, ...@@ -59,6 +59,8 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon, rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon,
nls_codepage); nls_codepage);
cFYI(1, ("reconnect tcon rc = %d", rc)); cFYI(1, ("reconnect tcon rc = %d", rc));
if(!rc)
reopen_files(tcon,nls_codepage);
} }
} }
} }
......
...@@ -137,6 +137,46 @@ cifs_open(struct inode *inode, struct file *file) ...@@ -137,6 +137,46 @@ cifs_open(struct inode *inode, struct file *file)
return rc; return rc;
} }
/* Try to reaquire byte range locks that were released when session */
/* to server was lost */
int relock_files(struct cifsFileInfo * cifsFile)
{
int rc = 0;
/* list all locks open on this file */
return rc;
}
/* Try to reopen files that were closed when session to server was lost */
int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo)
{
int rc = 0;
struct cifsFileInfo *open_file = NULL;
struct list_head *tmp;
/* list all files open on tree connection */
list_for_each(tmp, &pTcon->openFileList) {
open_file = list_entry(tmp,struct cifsFileInfo, flist);
if(open_file)
if(open_file->pfile) {
if(open_file->pfile->private_data) {
kfree(open_file->pfile->private_data);
}
rc = cifs_open(open_file->pfile->f_dentry->d_inode,
open_file->pfile);
if(rc) {
cFYI(1,("reconnecting file %s failed with %d",
open_file->pfile->f_dentry->d_name.name,rc));
} else {
cFYI(1,("reconnection of %s succeeded",
open_file->pfile->f_dentry->d_name.name));
}
}
}
return rc;
}
int int
cifs_close(struct inode *inode, struct file *file) cifs_close(struct inode *inode, struct file *file)
{ {
......
...@@ -494,20 +494,25 @@ cifs_revalidate(struct dentry *direntry) ...@@ -494,20 +494,25 @@ cifs_revalidate(struct dentry *direntry)
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
cFYI(1, cFYI(1,
(" full path: %s for inode 0x%p with count %d dentry: 0x%p d_time %ld at time %ld ", ("Revalidate full path: %s for inode 0x%p with count %d dentry: 0x%p d_time %ld at time %ld ",
full_path, direntry->d_inode, full_path, direntry->d_inode,
direntry->d_inode->i_count.counter, direntry, direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies)); direntry->d_time, jiffies));
cifsInode = CIFS_I(direntry->d_inode); cifsInode = CIFS_I(direntry->d_inode);
/* BB add check - do not need to revalidate oplocked files */ /* BB add check - do not need to revalidate oplocked files */
if ((time_before(jiffies, cifsInode->time + HZ))
&& (direntry->d_inode->i_nlink == 1)) { if (time_before(jiffies, cifsInode->time + HZ)) {
cFYI(1, (" Do not need to revalidate ")); if((S_ISREG(direntry->d_inode->i_mode) == 0) ||
(direntry->d_inode->i_nlink == 1)) {
if (full_path) if (full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} else {
cFYI(1,("Have to revalidate file due to hardlinks"));
}
} }
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
......
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