Commit e984f541 authored by Konstantin Baev's avatar Konstantin Baev

4.3.1-alt1

- Remove oplock part of Etersoft patches (sources < 2.6.27) - use cifs_file_aio_read instead of generic_file_aio_read in all sources
parent 919d9d7d
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
%define src_2_6_29_version 1.57 %define src_2_6_29_version 1.57
Name: etercifs Name: etercifs
Version: 4.3.0 Version: 4.3.1
Release: alt1 Release: alt1
Summary: Advanced Common Internet File System for Linux with Etersoft extension Summary: Advanced Common Internet File System for Linux with Etersoft extension
...@@ -121,6 +121,10 @@ cp %SOURCE29 %buildroot/%etercifs_src/%src_package_name-2.6.29-%src_2_6_29_versi ...@@ -121,6 +121,10 @@ cp %SOURCE29 %buildroot/%etercifs_src/%src_package_name-2.6.29-%src_2_6_29_versi
%doc README.ETER AUTHORS CHANGES README TODO %doc README.ETER AUTHORS CHANGES README TODO
%changelog %changelog
* Tue Mar 31 2009 Konstantin Baev <kipruss@altlinux.org> 4.3.1-alt1
- Remove oplock part of Etersoft patches (sources < 2.6.27)
- use cifs_file_aio_read instead of generic_file_aio_read in all sources
* Mon Mar 30 2009 Konstantin Baev <kipruss@altlinux.org> 4.3.0-alt1 * Mon Mar 30 2009 Konstantin Baev <kipruss@altlinux.org> 4.3.0-alt1
- add sources/2.6.29 - add sources/2.6.29
- Fix bugs Eter#1185 and Eter#3660 (F_GETLK problem connected with wrong returning file_lock structure) - Fix bugs Eter#1185 and Eter#3660 (F_GETLK problem connected with wrong returning file_lock structure)
......
...@@ -621,19 +621,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf, ...@@ -621,19 +621,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf,
return written; return written;
} }
static ssize_t cifs_file_read(struct file *file, char *user, size_t cnt, loff_t *pos) static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{ {
if( file!=NULL && file->f_dentry!=NULL && CIFS_I(file->f_dentry->d_inode)!=NULL ) { struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
int retval = 0; ssize_t read;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
return do_sync_read(file,user,cnt,pos); if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
} }
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -722,13 +723,13 @@ struct inode_operations cifs_symlink_inode_ops = { ...@@ -722,13 +723,13 @@ struct inode_operations cifs_symlink_inode_ops = {
}; };
struct file_operations cifs_file_ops = { struct file_operations cifs_file_ops = {
.read = cifs_file_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
.readv = generic_file_readv, .readv = generic_file_readv,
.writev = cifs_file_writev, .writev = cifs_file_writev,
#endif #endif
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
...@@ -1060,9 +1061,6 @@ static int cifs_oplock_thread(void *dummyarg) ...@@ -1060,9 +1061,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock to server still is disconnected since oplock
already released by the server in that case */ already released by the server in that case */
if (pTcon->tidStatus != CifsNeedReconnect) { if (pTcon->tidStatus != CifsNeedReconnect) {
/* PV: disable caching if oplock missed */
CIFS_I(inode)->clientCanCacheRead = FALSE;
CIFS_I(inode)->clientCanCacheAll = FALSE;
rc = CIFSSMBLock(0, pTcon, netfid, rc = CIFSSMBLock(0, pTcon, netfid,
0 /* len */ , 0 /* offset */, 0, 0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE, 0, LOCKING_ANDX_OPLOCK_RELEASE,
......
...@@ -363,7 +363,6 @@ struct cifsInodeInfo { ...@@ -363,7 +363,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */ unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */ unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1; unsigned oplockPending:1;
unsigned needForceInvalidate:1;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0) #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
struct inode vfs_inode; struct inode vfs_inode;
#endif #endif
......
...@@ -1273,7 +1273,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1273,7 +1273,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry, direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies)); direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) { if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */ /* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) && } else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) { lookupCacheEnabled) {
...@@ -1315,10 +1315,9 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1315,10 +1315,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size /* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */ had changed on server */
if (!cifsInode->needForceInvalidate && if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) && (local_size == direntry->d_inode->i_size)) {
(local_size == direntry->d_inode->i_size) ) { cFYI(1, ("cifs_revalidate - inode unchanged"));
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
} else { } else {
/* file may have changed on server */ /* file may have changed on server */
if (cifsInode->clientCanCacheRead) { if (cifsInode->clientCanCacheRead) {
...@@ -1348,12 +1347,8 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1348,12 +1347,8 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) { if (S_ISREG(direntry->d_inode->i_mode)) {
if (direntry->d_inode->i_mapping) if (direntry->d_inode->i_mapping)
filemap_fdatawait(direntry->d_inode->i_mapping); filemap_fdatawait(direntry->d_inode->i_mapping);
if( cifsInode->needForceInvalidate ) {
cFYI(1, ("Force invalidating."));
invalidate_remote_inode(direntry->d_inode);
cifsInode->needForceInvalidate = 0;
/* may eventually have to do this for open files too */ /* may eventually have to do this for open files too */
} else if (list_empty(&(cifsInode->openFileList))) { if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */ /* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on " cFYI(1, ("Invalidating read ahead data on "
"closed file")); "closed file"));
......
...@@ -536,19 +536,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -536,19 +536,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return written; return written;
} }
static ssize_t cifs_file_read(struct file *file, char *user, size_t cnt, loff_t *pos) static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{ {
if( file!=NULL && file->f_dentry!=NULL && CIFS_I(file->f_dentry->d_inode)!=NULL ) { struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
int retval = 0; ssize_t read;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
return do_sync_read(file,user,cnt,pos); if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
} }
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -627,9 +628,9 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -627,9 +628,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
}; };
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = cifs_file_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
...@@ -917,10 +918,6 @@ static int cifs_oplock_thread(void *dummyarg) ...@@ -917,10 +918,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock to server still is disconnected since oplock
already released by the server in that case */ already released by the server in that case */
if (pTcon->tidStatus != CifsNeedReconnect) { if (pTcon->tidStatus != CifsNeedReconnect) {
/* PV: disable caching if oplock missed */
CIFS_I(inode)->clientCanCacheRead = false;
CIFS_I(inode)->clientCanCacheAll = false;
rc = CIFSSMBLock(0, pTcon, netfid, rc = CIFSSMBLock(0, pTcon, netfid,
0 /* len */ , 0 /* offset */, 0, 0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE, 0, LOCKING_ANDX_OPLOCK_RELEASE,
......
...@@ -350,7 +350,6 @@ struct cifsInodeInfo { ...@@ -350,7 +350,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */ unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */ unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1; unsigned oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode; struct inode vfs_inode;
}; };
......
...@@ -1242,7 +1242,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1242,7 +1242,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry, direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies)); direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) { if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */ /* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) && } else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) { lookupCacheEnabled) {
...@@ -1284,10 +1284,9 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1284,10 +1284,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size /* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */ had changed on server */
if (!cifsInode->needForceInvalidate && if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) && (local_size == direntry->d_inode->i_size)) {
(local_size == direntry->d_inode->i_size) ) { cFYI(1, ("cifs_revalidate - inode unchanged"));
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
} else { } else {
/* file may have changed on server */ /* file may have changed on server */
if (cifsInode->clientCanCacheRead) { if (cifsInode->clientCanCacheRead) {
...@@ -1317,13 +1316,8 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1317,13 +1316,8 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) { if (S_ISREG(direntry->d_inode->i_mode)) {
if (direntry->d_inode->i_mapping) if (direntry->d_inode->i_mapping)
filemap_fdatawait(direntry->d_inode->i_mapping); filemap_fdatawait(direntry->d_inode->i_mapping);
if( cifsInode->needForceInvalidate ) {
cFYI(1, ("Force invalidating."));
invalidate_remote_inode(direntry->d_inode);
cifsInode->needForceInvalidate = 0;
/* may eventually have to do this for open files too */ /* may eventually have to do this for open files too */
} else if (list_empty(&(cifsInode->openFileList))) { if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */ /* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on " cFYI(1, ("Invalidating read ahead data on "
"closed file")); "closed file"));
......
...@@ -535,19 +535,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -535,19 +535,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return written; return written;
} }
static ssize_t cifs_file_read(struct file *file, char *user, size_t cnt, loff_t *pos) static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{ {
if( file!=NULL && file->f_dentry!=NULL && CIFS_I(file->f_dentry->d_inode)!=NULL ) { struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
int retval = 0; ssize_t read;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
return do_sync_read(file,user,cnt,pos); if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
} }
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -626,9 +627,9 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -626,9 +627,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
}; };
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = cifs_file_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
...@@ -919,10 +920,6 @@ static int cifs_oplock_thread(void *dummyarg) ...@@ -919,10 +920,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock to server still is disconnected since oplock
already released by the server in that case */ already released by the server in that case */
if (pTcon->tidStatus != CifsNeedReconnect) { if (pTcon->tidStatus != CifsNeedReconnect) {
/* PV: disable caching if oplock missed */
CIFS_I(inode)->clientCanCacheRead = false;
CIFS_I(inode)->clientCanCacheAll = false;
rc = CIFSSMBLock(0, pTcon, netfid, rc = CIFSSMBLock(0, pTcon, netfid,
0 /* len */ , 0 /* offset */, 0, 0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE, 0, LOCKING_ANDX_OPLOCK_RELEASE,
......
...@@ -367,7 +367,6 @@ struct cifsInodeInfo { ...@@ -367,7 +367,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */ unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */ unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1; unsigned oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode; struct inode vfs_inode;
}; };
......
...@@ -1269,7 +1269,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1269,7 +1269,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry, direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies)); direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) { if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */ /* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) && } else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) { lookupCacheEnabled) {
...@@ -1311,10 +1311,9 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1311,10 +1311,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size /* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */ had changed on server */
if (!cifsInode->needForceInvalidate && if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) && (local_size == direntry->d_inode->i_size)) {
(local_size == direntry->d_inode->i_size) ) { cFYI(1, ("cifs_revalidate - inode unchanged"));
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
} else { } else {
/* file may have changed on server */ /* file may have changed on server */
if (cifsInode->clientCanCacheRead) { if (cifsInode->clientCanCacheRead) {
...@@ -1346,15 +1345,10 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1346,15 +1345,10 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) { if (S_ISREG(direntry->d_inode->i_mode)) {
if (direntry->d_inode->i_mapping) if (direntry->d_inode->i_mapping)
wbrc = filemap_fdatawait(direntry->d_inode->i_mapping); wbrc = filemap_fdatawait(direntry->d_inode->i_mapping);
if( cifsInode->needForceInvalidate ) {
cFYI(1, ("Force invalidating."));
invalidate_remote_inode(direntry->d_inode);
cifsInode->needForceInvalidate = 0;
if (wbrc) if (wbrc)
CIFS_I(direntry->d_inode)->write_behind_rc = wbrc; CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
/* may eventually have to do this for open files too */ /* may eventually have to do this for open files too */
} else if (list_empty(&(cifsInode->openFileList))) { if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */ /* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on " cFYI(1, ("Invalidating read ahead data on "
"closed file")); "closed file"));
......
...@@ -573,19 +573,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -573,19 +573,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return written; return written;
} }
static ssize_t cifs_file_read(struct file *file, char *user, size_t cnt, loff_t *pos) static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{ {
if( file!=NULL && file->f_dentry!=NULL && CIFS_I(file->f_dentry->d_inode)!=NULL ) { struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
int retval = 0; ssize_t read;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
return do_sync_read(file,user,cnt,pos); if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
} }
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -664,9 +665,9 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -664,9 +665,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
}; };
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = cifs_file_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
...@@ -957,10 +958,6 @@ static int cifs_oplock_thread(void *dummyarg) ...@@ -957,10 +958,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock to server still is disconnected since oplock
already released by the server in that case */ already released by the server in that case */
if (pTcon->tidStatus != CifsNeedReconnect) { if (pTcon->tidStatus != CifsNeedReconnect) {
/* PV: disable caching if oplock missed */
CIFS_I(inode)->clientCanCacheRead = false;
CIFS_I(inode)->clientCanCacheAll = false;
rc = CIFSSMBLock(0, pTcon, netfid, rc = CIFSSMBLock(0, pTcon, netfid,
0 /* len */ , 0 /* offset */, 0, 0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE, 0, LOCKING_ANDX_OPLOCK_RELEASE,
......
...@@ -360,7 +360,6 @@ struct cifsInodeInfo { ...@@ -360,7 +360,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */ unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */ unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1; unsigned oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode; struct inode vfs_inode;
}; };
......
...@@ -1217,7 +1217,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1217,7 +1217,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry, direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies)); direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) { if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */ /* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) && } else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) { lookupCacheEnabled) {
...@@ -1259,10 +1259,9 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1259,10 +1259,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size /* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */ had changed on server */
if (!cifsInode->needForceInvalidate && if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) && (local_size == direntry->d_inode->i_size)) {
(local_size == direntry->d_inode->i_size) ) { cFYI(1, ("cifs_revalidate - inode unchanged"));
cFYI(1, ("************** cifs_revalidate - inode unchanged"));
} else { } else {
/* file may have changed on server */ /* file may have changed on server */
if (cifsInode->clientCanCacheRead) { if (cifsInode->clientCanCacheRead) {
...@@ -1294,15 +1293,10 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1294,15 +1293,10 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) { if (S_ISREG(direntry->d_inode->i_mode)) {
if (direntry->d_inode->i_mapping) if (direntry->d_inode->i_mapping)
wbrc = filemap_fdatawait(direntry->d_inode->i_mapping); wbrc = filemap_fdatawait(direntry->d_inode->i_mapping);
if( cifsInode->needForceInvalidate ) {
cFYI(1, ("Force invalidating."));
invalidate_remote_inode(direntry->d_inode);
cifsInode->needForceInvalidate = 0;
if (wbrc) if (wbrc)
CIFS_I(direntry->d_inode)->write_behind_rc = wbrc; CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
/* may eventually have to do this for open files too */ /* may eventually have to do this for open files too */
} else if (list_empty(&(cifsInode->openFileList))) { if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */ /* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on " cFYI(1, ("Invalidating read ahead data on "
"closed file")); "closed file"));
......
...@@ -600,19 +600,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -600,19 +600,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return written; return written;
} }
static ssize_t cifs_file_read(struct file *file, char *user, size_t cnt, loff_t *pos) static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{ {
if( file!=NULL && file->f_dentry!=NULL && CIFS_I(file->f_dentry->d_inode)!=NULL ) { struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
int retval = 0; ssize_t read;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
return do_sync_read(file,user,cnt,pos); if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
} }
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -691,9 +692,9 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -691,9 +692,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
}; };
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = cifs_file_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
...@@ -984,10 +985,6 @@ static int cifs_oplock_thread(void *dummyarg) ...@@ -984,10 +985,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock to server still is disconnected since oplock
already released by the server in that case */ already released by the server in that case */
if (pTcon->tidStatus != CifsNeedReconnect) { if (pTcon->tidStatus != CifsNeedReconnect) {
/* PV: disable caching if oplock missed */
CIFS_I(inode)->clientCanCacheRead = false;
CIFS_I(inode)->clientCanCacheAll = false;
rc = CIFSSMBLock(0, pTcon, netfid, rc = CIFSSMBLock(0, pTcon, netfid,
0 /* len */ , 0 /* offset */, 0, 0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE, 0, LOCKING_ANDX_OPLOCK_RELEASE,
......
...@@ -352,7 +352,6 @@ struct cifsInodeInfo { ...@@ -352,7 +352,6 @@ struct cifsInodeInfo {
bool clientCanCacheRead:1; /* read oplock */ bool clientCanCacheRead:1; /* read oplock */
bool clientCanCacheAll:1; /* read and writebehind oplock */ bool clientCanCacheAll:1; /* read and writebehind oplock */
bool oplockPending:1; bool oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode; struct inode vfs_inode;
}; };
......
...@@ -1237,7 +1237,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1237,7 +1237,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry, direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies)); direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) { if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */ /* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) && } else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) { lookupCacheEnabled) {
...@@ -1279,10 +1279,9 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1279,10 +1279,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size /* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */ had changed on server */
if (!cifsInode->needForceInvalidate && if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) && (local_size == direntry->d_inode->i_size)) {
(local_size == direntry->d_inode->i_size) ) { cFYI(1, ("cifs_revalidate - inode unchanged"));
cFYI(1, ("************** cifs_revalidate - inode unchanged"));
} else { } else {
/* file may have changed on server */ /* file may have changed on server */
if (cifsInode->clientCanCacheRead) { if (cifsInode->clientCanCacheRead) {
...@@ -1314,15 +1313,10 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1314,15 +1313,10 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) { if (S_ISREG(direntry->d_inode->i_mode)) {
if (direntry->d_inode->i_mapping) if (direntry->d_inode->i_mapping)
wbrc = filemap_fdatawait(direntry->d_inode->i_mapping); wbrc = filemap_fdatawait(direntry->d_inode->i_mapping);
if( cifsInode->needForceInvalidate ) {
cFYI(1, ("Force invalidating."));
invalidate_remote_inode(direntry->d_inode);
cifsInode->needForceInvalidate = 0;
if (wbrc) if (wbrc)
CIFS_I(direntry->d_inode)->write_behind_rc = wbrc; CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
/* may eventually have to do this for open files too */ /* may eventually have to do this for open files too */
} else if (list_empty(&(cifsInode->openFileList))) { if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */ /* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on " cFYI(1, ("Invalidating read ahead data on "
"closed file")); "closed file"));
......
...@@ -601,6 +601,19 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -601,6 +601,19 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return written; return written;
} }
static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
}
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -681,7 +694,7 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -681,7 +694,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = do_sync_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
......
...@@ -605,6 +605,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -605,6 +605,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return written; return written;
} }
static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
}
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -716,7 +730,7 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -716,7 +730,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = do_sync_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
......
...@@ -622,6 +622,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -622,6 +622,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return written; return written;
} }
static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
}
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -733,7 +747,7 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -733,7 +747,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = do_sync_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
......
...@@ -629,19 +629,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf, ...@@ -629,19 +629,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf,
return written; return written;
} }
static ssize_t cifs_file_read(struct file *file, char *user, size_t cnt, loff_t *pos) static ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{ {
if( file!=NULL && file->f_dentry!=NULL && CIFS_I(file->f_dentry->d_inode)!=NULL ) { struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
int retval = 0; ssize_t read;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
return do_sync_read(file,user,cnt,pos); if (CIFS_I(inode)->clientCanCacheRead)
read = generic_file_aio_read(iocb, iov, nr_segs, pos);
else
read = cifs_user_read(iocb->ki_filp, iov->iov_base, iov->iov_len, &pos);
return read;
} }
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{ {
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
...@@ -730,13 +731,13 @@ const struct inode_operations cifs_symlink_inode_ops = { ...@@ -730,13 +731,13 @@ const struct inode_operations cifs_symlink_inode_ops = {
}; };
const struct file_operations cifs_file_ops = { const struct file_operations cifs_file_ops = {
.read = cifs_file_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
.readv = generic_file_readv, .readv = generic_file_readv,
.writev = cifs_file_writev, .writev = cifs_file_writev,
#endif #endif
.aio_read = generic_file_aio_read, .aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write, .aio_write = cifs_file_aio_write,
.open = cifs_open, .open = cifs_open,
.release = cifs_close, .release = cifs_close,
...@@ -1073,9 +1074,6 @@ static int cifs_oplock_thread(void *dummyarg) ...@@ -1073,9 +1074,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock to server still is disconnected since oplock
already released by the server in that case */ already released by the server in that case */
if (pTcon->tidStatus != CifsNeedReconnect) { if (pTcon->tidStatus != CifsNeedReconnect) {
/* PV: disable caching if oplock missed */
CIFS_I(inode)->clientCanCacheRead = FALSE;
CIFS_I(inode)->clientCanCacheAll = FALSE;
rc = CIFSSMBLock(0, pTcon, netfid, rc = CIFSSMBLock(0, pTcon, netfid,
0 /* len */ , 0 /* offset */, 0, 0 /* len */ , 0 /* offset */, 0,
......
...@@ -363,7 +363,6 @@ struct cifsInodeInfo { ...@@ -363,7 +363,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */ unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */ unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1; unsigned oplockPending:1;
unsigned needForceInvalidate:1;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0) #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
struct inode vfs_inode; struct inode vfs_inode;
#endif #endif
......
...@@ -1271,7 +1271,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1271,7 +1271,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry, direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies)); direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) { if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */ /* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) && } else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) { lookupCacheEnabled) {
...@@ -1313,10 +1313,9 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1313,10 +1313,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size /* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */ had changed on server */
if (!cifsInode->needForceInvalidate && if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) && (local_size == direntry->d_inode->i_size)) {
(local_size == direntry->d_inode->i_size) ) { cFYI(1, ("cifs_revalidate - inode unchanged"));
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
} else { } else {
/* file may have changed on server */ /* file may have changed on server */
if (cifsInode->clientCanCacheRead) { if (cifsInode->clientCanCacheRead) {
...@@ -1346,12 +1345,8 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1346,12 +1345,8 @@ int cifs_revalidate(struct dentry *direntry)
if (direntry->d_inode->i_mapping) if (direntry->d_inode->i_mapping)
filemap_fdatawait(direntry->d_inode->i_mapping); filemap_fdatawait(direntry->d_inode->i_mapping);
if( cifsInode->needForceInvalidate ) {
cFYI(1, ("Force invalidating."));
invalidate_remote_inode(direntry->d_inode);
cifsInode->needForceInvalidate = 0;
/* may eventually have to do this for open files too */ /* may eventually have to do this for open files too */
} else if (list_empty(&(cifsInode->openFileList))) { if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */ /* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on " cFYI(1, ("Invalidating read ahead data on "
"closed file")); "closed file"));
......
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