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 @@
%define src_2_6_29_version 1.57
Name: etercifs
Version: 4.3.0
Version: 4.3.1
Release: alt1
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
%doc README.ETER AUTHORS CHANGES README TODO
%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
- add sources/2.6.29
- 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,
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 ) {
int retval = 0;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -722,13 +723,13 @@ struct inode_operations cifs_symlink_inode_ops = {
};
struct file_operations cifs_file_ops = {
.read = cifs_file_read,
.read = do_sync_read,
.write = do_sync_write,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
.readv = generic_file_readv,
.writev = cifs_file_writev,
#endif
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......@@ -1060,9 +1061,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock
already released by the server in that case */
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,
0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE,
......
......@@ -363,7 +363,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1;
unsigned needForceInvalidate:1;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
struct inode vfs_inode;
#endif
......
......@@ -1273,7 +1273,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) {
if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) {
......@@ -1315,10 +1315,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */
if (!cifsInode->needForceInvalidate &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size) ) {
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size)) {
cFYI(1, ("cifs_revalidate - inode unchanged"));
} else {
/* file may have changed on server */
if (cifsInode->clientCanCacheRead) {
......@@ -1348,12 +1347,8 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) {
if (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 */
} else if (list_empty(&(cifsInode->openFileList))) {
if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on "
"closed file"));
......
......@@ -536,19 +536,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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 ) {
int retval = 0;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -627,9 +628,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
};
const struct file_operations cifs_file_ops = {
.read = cifs_file_read,
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......@@ -917,10 +918,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock
already released by the server in that case */
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,
0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE,
......
......@@ -350,7 +350,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode;
};
......
......@@ -1242,7 +1242,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) {
if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) {
......@@ -1284,10 +1284,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */
if (!cifsInode->needForceInvalidate &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size) ) {
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size)) {
cFYI(1, ("cifs_revalidate - inode unchanged"));
} else {
/* file may have changed on server */
if (cifsInode->clientCanCacheRead) {
......@@ -1317,13 +1316,8 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) {
if (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 */
} else if (list_empty(&(cifsInode->openFileList))) {
if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on "
"closed file"));
......
......@@ -535,19 +535,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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 ) {
int retval = 0;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -626,9 +627,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
};
const struct file_operations cifs_file_ops = {
.read = cifs_file_read,
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......@@ -919,10 +920,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock
already released by the server in that case */
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,
0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE,
......
......@@ -367,7 +367,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode;
};
......
......@@ -1269,7 +1269,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) {
if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) {
......@@ -1311,10 +1311,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */
if (!cifsInode->needForceInvalidate &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size) ) {
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size)) {
cFYI(1, ("cifs_revalidate - inode unchanged"));
} else {
/* file may have changed on server */
if (cifsInode->clientCanCacheRead) {
......@@ -1346,15 +1345,10 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) {
if (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)
CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
/* 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 */
cFYI(1, ("Invalidating read ahead data on "
"closed file"));
......
......@@ -573,19 +573,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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 ) {
int retval = 0;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -664,9 +665,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
};
const struct file_operations cifs_file_ops = {
.read = cifs_file_read,
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......@@ -957,10 +958,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock
already released by the server in that case */
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,
0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE,
......
......@@ -360,7 +360,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode;
};
......
......@@ -1217,7 +1217,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) {
if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) {
......@@ -1259,10 +1259,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */
if (!cifsInode->needForceInvalidate &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size) ) {
cFYI(1, ("************** cifs_revalidate - inode unchanged"));
if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size)) {
cFYI(1, ("cifs_revalidate - inode unchanged"));
} else {
/* file may have changed on server */
if (cifsInode->clientCanCacheRead) {
......@@ -1294,15 +1293,10 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) {
if (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)
CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
/* 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 */
cFYI(1, ("Invalidating read ahead data on "
"closed file"));
......
......@@ -600,19 +600,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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 ) {
int retval = 0;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -691,9 +692,9 @@ const struct inode_operations cifs_symlink_inode_ops = {
};
const struct file_operations cifs_file_ops = {
.read = cifs_file_read,
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......@@ -984,10 +985,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock
already released by the server in that case */
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,
0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE,
......
......@@ -352,7 +352,6 @@ struct cifsInodeInfo {
bool clientCanCacheRead:1; /* read oplock */
bool clientCanCacheAll:1; /* read and writebehind oplock */
bool oplockPending:1;
unsigned needForceInvalidate:1;
struct inode vfs_inode;
};
......
......@@ -1237,7 +1237,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) {
if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) {
......@@ -1279,10 +1279,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */
if (!cifsInode->needForceInvalidate &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size) ) {
cFYI(1, ("************** cifs_revalidate - inode unchanged"));
if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size)) {
cFYI(1, ("cifs_revalidate - inode unchanged"));
} else {
/* file may have changed on server */
if (cifsInode->clientCanCacheRead) {
......@@ -1314,15 +1313,10 @@ int cifs_revalidate(struct dentry *direntry)
if (S_ISREG(direntry->d_inode->i_mode)) {
if (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)
CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
/* 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 */
cFYI(1, ("Invalidating read ahead data on "
"closed file"));
......
......@@ -601,6 +601,19 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -681,7 +694,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
const struct file_operations cifs_file_ops = {
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......
......@@ -605,6 +605,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -716,7 +730,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
const struct file_operations cifs_file_ops = {
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......
......@@ -622,6 +622,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -733,7 +747,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
const struct file_operations cifs_file_ops = {
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......
......@@ -629,19 +629,20 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const char __user *buf,
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 ) {
int retval = 0;
CIFS_I(file->f_dentry->d_inode)->needForceInvalidate = 1;
retval = cifs_revalidate(file->f_dentry);
if( retval < 0 )
return (ssize_t)retval;
}
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
ssize_t read;
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)
{
/* origin == SEEK_END => we must revalidate the cached file length */
......@@ -730,13 +731,13 @@ const struct inode_operations cifs_symlink_inode_ops = {
};
const struct file_operations cifs_file_ops = {
.read = cifs_file_read,
.read = do_sync_read,
.write = do_sync_write,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
.readv = generic_file_readv,
.writev = cifs_file_writev,
#endif
.aio_read = generic_file_aio_read,
.aio_read = cifs_file_aio_read,
.aio_write = cifs_file_aio_write,
.open = cifs_open,
.release = cifs_close,
......@@ -1073,9 +1074,6 @@ static int cifs_oplock_thread(void *dummyarg)
to server still is disconnected since oplock
already released by the server in that case */
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,
0 /* len */ , 0 /* offset */, 0,
......
......@@ -363,7 +363,6 @@ struct cifsInodeInfo {
unsigned clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1;
unsigned needForceInvalidate:1;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
struct inode vfs_inode;
#endif
......
......@@ -1271,7 +1271,7 @@ int cifs_revalidate(struct dentry *direntry)
direntry->d_inode->i_count.counter, direntry,
direntry->d_time, jiffies));
if (cifsInode->time == 0 || cifsInode->needForceInvalidate ) {
if (cifsInode->time == 0) {
/* was set to zero previously to force revalidate */
} else if (time_before(jiffies, cifsInode->time + HZ) &&
lookupCacheEnabled) {
......@@ -1313,10 +1313,9 @@ int cifs_revalidate(struct dentry *direntry)
/* if not oplocked, we invalidate inode pages if mtime or file size
had changed on server */
if (!cifsInode->needForceInvalidate &&
timespec_equal(&local_mtime,&direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size) ) {
cFYI(1, ("***************************** cifs_revalidate - inode unchanged"));
if (timespec_equal(&local_mtime, &direntry->d_inode->i_mtime) &&
(local_size == direntry->d_inode->i_size)) {
cFYI(1, ("cifs_revalidate - inode unchanged"));
} else {
/* file may have changed on server */
if (cifsInode->clientCanCacheRead) {
......@@ -1346,12 +1345,8 @@ int cifs_revalidate(struct dentry *direntry)
if (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 */
} else if (list_empty(&(cifsInode->openFileList))) {
if (list_empty(&(cifsInode->openFileList))) {
/* changed on server - flush read ahead pages */
cFYI(1, ("Invalidating read ahead data on "
"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