Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etercifs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etercifs
Commits
edc2bedb
Commit
edc2bedb
authored
Apr 05, 2011
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add strict cache mode for 2.6.32
parent
c8cd2ff8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
173 additions
and
86 deletions
+173
-86
README
sources/2.6.32/README
+5
-0
cifs_fs_sb.h
sources/2.6.32/cifs_fs_sb.h
+1
-0
cifsfs.c
sources/2.6.32/cifsfs.c
+48
-4
cifsfs.h
sources/2.6.32/cifsfs.h
+13
-4
cifsglob.h
sources/2.6.32/cifsglob.h
+1
-0
cifsproto.h
sources/2.6.32/cifsproto.h
+5
-1
connect.c
sources/2.6.32/connect.c
+6
-1
dir.c
sources/2.6.32/dir.c
+9
-15
file.c
sources/2.6.32/file.c
+0
-0
inode.c
sources/2.6.32/inode.c
+61
-56
misc.c
sources/2.6.32/misc.c
+24
-5
No files found.
sources/2.6.32/README
View file @
edc2bedb
...
...
@@ -433,6 +433,11 @@ A partial list of the supported mount options follows:
if oplock (caching token) is granted and held. Note that
direct allows write operations larger than page size
to be sent to the server.
strictcache Use for switching on strict cache mode. In this mode the
client reads from the cache all the time it has Oplock Level II,
otherwise - reads from the server. All written data are stored
in the cache, but if the client doesn't have Exclusive Oplock,
it writes the data to the server.
acl Allow setfacl and getfacl to manage posix ACLs if server
supports them. (default)
noacl Do not allow setfacl and getfacl calls on this mount
...
...
sources/2.6.32/cifs_fs_sb.h
View file @
edc2bedb
...
...
@@ -34,6 +34,7 @@
#define CIFS_MOUNT_NOPOSIXBRL 0x2000
/* mandatory not posix byte range lock */
#define CIFS_MOUNT_NOSSYNC 0x4000
/* don't do slow SMBflush on every sync*/
#define CIFS_MOUNT_WINE_MODE 0x8000
/* use pid forwarding for wine apps */
#define CIFS_MOUNT_STRICT_IO 0x10000
/* strict cache mode */
struct
cifs_sb_info
{
struct
cifsTconInfo
*
tcon
;
/* primary mount */
...
...
sources/2.6.32/cifsfs.c
View file @
edc2bedb
...
...
@@ -309,8 +309,7 @@ cifs_alloc_inode(struct super_block *sb)
/* Until the file is open and we have gotten oplock
info back from the server, can not assume caching of
file data or metadata */
cifs_inode
->
clientCanCacheRead
=
false
;
cifs_inode
->
clientCanCacheAll
=
false
;
cifs_set_oplock_level
(
cifs_inode
,
0
);
cifs_inode
->
delete_pending
=
false
;
cifs_inode
->
vfs_inode
.
i_blkbits
=
14
;
/* 2**14 = CIFS_MAX_MSGSIZE */
cifs_inode
->
server_eof
=
0
;
...
...
@@ -628,10 +627,17 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
{
struct
inode
*
inode
=
iocb
->
ki_filp
->
f_path
.
dentry
->
d_inode
;
ssize_t
written
;
int
rc
;
written
=
generic_file_aio_write
(
iocb
,
iov
,
nr_segs
,
pos
);
if
(
!
CIFS_I
(
inode
)
->
clientCanCacheAll
)
filemap_fdatawrite
(
inode
->
i_mapping
);
if
(
CIFS_I
(
inode
)
->
clientCanCacheAll
)
return
written
;
rc
=
filemap_fdatawrite
(
inode
->
i_mapping
);
if
(
rc
)
cFYI
(
1
,
(
"cifs_file_aio_write: %d rc on %p inode"
,
rc
,
inode
));
return
written
;
}
...
...
@@ -765,6 +771,25 @@ const struct file_operations cifs_file_ops = {
#endif
/* CONFIG_CIFS_EXPERIMENTAL */
};
const
struct
file_operations
cifs_file_strict_ops
=
{
.
read
=
do_sync_read
,
.
write
=
do_sync_write
,
.
aio_read
=
cifs_strict_readv
,
.
aio_write
=
cifs_strict_writev
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
lock
=
cifs_lock
,
.
fsync
=
cifs_strict_fsync
,
.
flush
=
cifs_flush
,
.
mmap
=
cifs_file_strict_mmap
,
.
splice_read
=
generic_file_splice_read
,
.
llseek
=
cifs_llseek
,
#ifdef CONFIG_CIFS_POSIX
.
unlocked_ioctl
=
cifs_ioctl
,
#endif
/* CONFIG_CIFS_POSIX */
.
setlease
=
cifs_setlease
,
};
const
struct
file_operations
cifs_file_direct_ops
=
{
/* no aio, no readv -
BB reevaluate whether they can be done with directio, no cache */
...
...
@@ -785,6 +810,7 @@ const struct file_operations cifs_file_direct_ops = {
.
setlease
=
cifs_setlease
,
#endif
/* CONFIG_CIFS_EXPERIMENTAL */
};
const
struct
file_operations
cifs_file_nobrl_ops
=
{
.
read
=
do_sync_read
,
.
write
=
do_sync_write
,
...
...
@@ -806,6 +832,24 @@ const struct file_operations cifs_file_nobrl_ops = {
#endif
/* CONFIG_CIFS_EXPERIMENTAL */
};
const
struct
file_operations
cifs_file_strict_nobrl_ops
=
{
.
read
=
do_sync_read
,
.
write
=
do_sync_write
,
.
aio_read
=
cifs_strict_readv
,
.
aio_write
=
cifs_strict_writev
,
.
open
=
cifs_open
,
.
release
=
cifs_close
,
.
fsync
=
cifs_strict_fsync
,
.
flush
=
cifs_flush
,
.
mmap
=
cifs_file_strict_mmap
,
.
splice_read
=
generic_file_splice_read
,
.
llseek
=
cifs_llseek
,
#ifdef CONFIG_CIFS_POSIX
.
unlocked_ioctl
=
cifs_ioctl
,
#endif
/* CONFIG_CIFS_POSIX */
.
setlease
=
cifs_setlease
,
};
const
struct
file_operations
cifs_file_direct_nobrl_ops
=
{
/* no aio, no readv -
BB reevaluate whether they can be done with directio, no cache */
...
...
sources/2.6.32/cifsfs.h
View file @
edc2bedb
...
...
@@ -62,6 +62,7 @@ extern int cifs_rmdir(struct inode *, struct dentry *);
extern
int
cifs_rename
(
struct
inode
*
,
struct
dentry
*
,
struct
inode
*
,
struct
dentry
*
);
extern
int
cifs_revalidate
(
struct
dentry
*
);
extern
void
cifs_invalidate_mapping
(
struct
inode
*
inode
);
extern
int
cifs_getattr
(
struct
vfsmount
*
,
struct
dentry
*
,
struct
kstat
*
);
extern
int
cifs_setattr
(
struct
dentry
*
,
struct
iattr
*
);
...
...
@@ -73,19 +74,27 @@ extern const struct inode_operations cifs_dfs_referral_inode_operations;
/* Functions related to files and directories */
extern
const
struct
file_operations
cifs_file_ops
;
extern
const
struct
file_operations
cifs_file_direct_ops
;
/* if directio mnt */
extern
const
struct
file_operations
cifs_file_nobrl_ops
;
extern
const
struct
file_operations
cifs_file_direct_nobrl_ops
;
/* no brlocks */
extern
const
struct
file_operations
cifs_file_strict_ops
;
/* if strictio mnt */
extern
const
struct
file_operations
cifs_file_nobrl_ops
;
/* no brlocks */
extern
const
struct
file_operations
cifs_file_direct_nobrl_ops
;
extern
const
struct
file_operations
cifs_file_strict_nobrl_ops
;
extern
int
cifs_open
(
struct
inode
*
inode
,
struct
file
*
file
);
extern
int
cifs_close
(
struct
inode
*
inode
,
struct
file
*
file
);
extern
int
cifs_closedir
(
struct
inode
*
inode
,
struct
file
*
file
);
extern
ssize_t
cifs_user_read
(
struct
file
*
file
,
char
__user
*
read_data
,
size_t
read_size
,
loff_t
*
poffset
);
size_t
read_size
,
loff_t
*
poffset
);
extern
ssize_t
cifs_strict_readv
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
);
extern
ssize_t
cifs_user_write
(
struct
file
*
file
,
const
char
__user
*
write_data
,
size_t
write_size
,
loff_t
*
poffset
);
size_t
write_size
,
loff_t
*
poffset
);
extern
ssize_t
cifs_strict_writev
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
);
extern
int
cifs_lock
(
struct
file
*
,
int
,
struct
file_lock
*
);
extern
int
cifs_fsync
(
struct
file
*
,
struct
dentry
*
,
int
);
extern
int
cifs_strict_fsync
(
struct
file
*
,
struct
dentry
*
,
int
);
extern
int
cifs_flush
(
struct
file
*
,
fl_owner_t
id
);
extern
int
cifs_file_mmap
(
struct
file
*
,
struct
vm_area_struct
*
);
extern
int
cifs_file_strict_mmap
(
struct
file
*
,
struct
vm_area_struct
*
);
extern
const
struct
file_operations
cifs_dir_ops
;
extern
int
cifs_dir_open
(
struct
inode
*
inode
,
struct
file
*
file
);
extern
int
cifs_readdir
(
struct
file
*
file
,
void
*
direntry
,
filldir_t
filldir
);
...
...
sources/2.6.32/cifsglob.h
View file @
edc2bedb
...
...
@@ -388,6 +388,7 @@ struct cifsInodeInfo {
bool
clientCanCacheRead
:
1
;
/* read oplock */
bool
clientCanCacheAll
:
1
;
/* read and writebehind oplock */
bool
delete_pending
:
1
;
/* DELETE_ON_CLOSE is set */
bool
invalid_mapping
:
1
;
/* uptodate cache flag */
u64
server_eof
;
/* current file size on server */
u64
uniqueid
;
/* server inode number */
struct
inode
vfs_inode
;
...
...
sources/2.6.32/cifsproto.h
View file @
edc2bedb
...
...
@@ -70,6 +70,8 @@ extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *);
#ifdef CONFIG_CIFS_EXPERIMENTAL
extern
struct
cifsFileInfo
*
find_readable_file
(
struct
cifsInodeInfo
*
);
#endif
extern
void
cifs_update_eof
(
struct
cifsInodeInfo
*
cifsi
,
loff_t
offset
,
unsigned
int
bytes_written
);
extern
unsigned
int
smbCalcSize
(
struct
smb_hdr
*
ptr
);
extern
unsigned
int
smbCalcSize_LE
(
struct
smb_hdr
*
ptr
);
extern
int
decode_negTokenInit
(
unsigned
char
*
security_blob
,
int
length
,
...
...
@@ -90,10 +92,12 @@ extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
extern
u64
cifs_UnixTimeToNT
(
struct
timespec
);
extern
struct
timespec
cnvrtDosUnixTm
(
__le16
le_date
,
__le16
le_time
,
int
offset
);
extern
void
cifs_set_oplock_level
(
struct
cifsInodeInfo
*
cinode
,
__u32
oplock
);
extern
struct
cifsFileInfo
*
cifs_new_fileinfo
(
struct
inode
*
newinode
,
__u16
fileHandle
,
struct
file
*
file
,
struct
vfsmount
*
mnt
,
unsigned
int
oflags
);
struct
vfsmount
*
mnt
,
unsigned
int
oflags
,
__u32
oplock
);
extern
int
cifs_posix_open
(
char
*
full_path
,
struct
inode
**
pinode
,
struct
vfsmount
*
mnt
,
struct
super_block
*
sb
,
...
...
sources/2.6.32/connect.c
View file @
edc2bedb
...
...
@@ -82,6 +82,7 @@ struct smb_vol {
bool
no_xattr
:
1
;
/* set if xattr (EA) support should be disabled*/
bool
server_ino
:
1
;
/* use inode numbers from server ie UniqueId */
bool
direct_io
:
1
;
bool
strict_io
:
1
;
/* strict cache behavior */
bool
remap
:
1
;
/* set to remap seven reserved chars in filenames */
bool
posix_paths
:
1
;
/* unset to not ask for posix pathnames. */
bool
no_linux_ext
:
1
;
...
...
@@ -1303,7 +1304,7 @@ cifs_parse_mount_options(char *options, const char *devname,
}
else
if
(
strnicmp
(
data
,
"wine"
,
4
)
==
0
)
{
vol
->
wine_mode
=
1
;
vol
->
mand_lock
=
1
;
vol
->
dire
ct_io
=
1
;
vol
->
stri
ct_io
=
1
;
}
else
if
(
strnicmp
(
data
,
"cifsacl"
,
7
)
==
0
)
{
vol
->
cifs_acl
=
1
;
}
else
if
(
strnicmp
(
data
,
"nocifsacl"
,
9
)
==
0
)
{
...
...
@@ -1328,6 +1329,8 @@ cifs_parse_mount_options(char *options, const char *devname,
vol
->
direct_io
=
1
;
}
else
if
(
strnicmp
(
data
,
"forcedirectio"
,
13
)
==
0
)
{
vol
->
direct_io
=
1
;
}
else
if
(
strnicmp
(
data
,
"strictcache"
,
11
)
==
0
)
{
vol
->
strict_io
=
1
;
}
else
if
(
strnicmp
(
data
,
"noac"
,
4
)
==
0
)
{
printk
(
KERN_WARNING
"CIFS: Mount option noac not "
"supported. Instead set "
...
...
@@ -2191,6 +2194,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_OVERR_GID
;
if
(
pvolume_info
->
dynperm
)
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_DYNPERM
;
if
(
pvolume_info
->
strict_io
)
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_STRICT_IO
;
if
(
pvolume_info
->
direct_io
)
{
cFYI
(
1
,
(
"mounting share using direct i/o"
));
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_DIRECT_IO
;
...
...
sources/2.6.32/dir.c
View file @
edc2bedb
...
...
@@ -132,9 +132,9 @@ cifs_bp_rename_retry:
struct
cifsFileInfo
*
cifs_new_fileinfo
(
struct
inode
*
newinode
,
__u16
fileHandle
,
struct
file
*
file
,
struct
vfsmount
*
mnt
,
unsigned
int
oflags
)
struct
file
*
file
,
struct
vfsmount
*
mnt
,
unsigned
int
oflags
,
__u32
oplock
)
{
int
oplock
=
0
;
struct
cifsFileInfo
*
pCifsFile
;
struct
cifsInodeInfo
*
pCifsInode
;
struct
cifs_sb_info
*
cifs_sb
=
CIFS_SB
(
mnt
->
mnt_sb
);
...
...
@@ -143,9 +143,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
if
(
pCifsFile
==
NULL
)
return
pCifsFile
;
if
(
oplockEnabled
)
oplock
=
REQ_OPLOCK
;
pCifsFile
->
netfid
=
fileHandle
;
pCifsFile
->
pid
=
current
->
tgid
;
pCifsFile
->
pInode
=
igrab
(
newinode
);
...
...
@@ -159,9 +156,12 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
atomic_set
(
&
pCifsFile
->
count
,
1
);
slow_work_init
(
&
pCifsFile
->
oplock_break
,
&
cifs_oplock_break_ops
);
pCifsInode
=
CIFS_I
(
newinode
);
if
(
pCifsInode
)
cifs_set_oplock_level
(
pCifsInode
,
oplock
);
write_lock
(
&
GlobalSMBSeslock
);
list_add
(
&
pCifsFile
->
tlist
,
&
cifs_sb
->
tcon
->
openFileList
);
pCifsInode
=
CIFS_I
(
newinode
);
if
(
pCifsInode
)
{
/* if readable file instance put first in list*/
if
(
oflags
&
FMODE_READ
)
...
...
@@ -169,13 +169,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
else
list_add_tail
(
&
pCifsFile
->
flist
,
&
pCifsInode
->
openFileList
);
if
((
oplock
&
0xF
)
==
OPLOCK_EXCLUSIVE
)
{
pCifsInode
->
clientCanCacheAll
=
true
;
pCifsInode
->
clientCanCacheRead
=
true
;
cFYI
(
1
,
(
"Exclusive Oplock inode %p"
,
newinode
));
}
else
if
((
oplock
&
0xF
)
==
OPLOCK_READ
)
pCifsInode
->
clientCanCacheRead
=
true
;
}
write_unlock
(
&
GlobalSMBSeslock
);
...
...
@@ -252,7 +245,8 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
}
if
(
mnt
)
cifs_new_fileinfo
(
*
pinode
,
*
pnetfid
,
NULL
,
mnt
,
oflags
);
cifs_new_fileinfo
(
*
pinode
,
*
pnetfid
,
NULL
,
mnt
,
oflags
,
*
poplock
);
posix_open_ret:
kfree
(
presp_data
);
...
...
@@ -468,7 +462,7 @@ cifs_create_set_dentry:
CIFSSMBClose
(
xid
,
tcon
,
fileHandle
);
}
else
if
(
!
(
posix_create
)
&&
(
newinode
))
{
cifs_new_fileinfo
(
newinode
,
fileHandle
,
NULL
,
nd
->
path
.
mnt
,
oflags
);
nd
->
path
.
mnt
,
oflags
,
oplock
);
}
cifs_create_out:
kfree
(
buf
);
...
...
sources/2.6.32/file.c
View file @
edc2bedb
This diff is collapsed.
Click to expand it.
sources/2.6.32/inode.c
View file @
edc2bedb
...
...
@@ -42,13 +42,17 @@ static void cifs_set_ops(struct inode *inode, const bool is_dfs_referral)
inode
->
i_fop
=
&
cifs_file_direct_nobrl_ops
;
else
inode
->
i_fop
=
&
cifs_file_direct_ops
;
}
else
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_STRICT_IO
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_BRL
)
inode
->
i_fop
=
&
cifs_file_strict_nobrl_ops
;
else
inode
->
i_fop
=
&
cifs_file_strict_ops
;
}
else
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_BRL
)
inode
->
i_fop
=
&
cifs_file_nobrl_ops
;
else
{
/* not direct, send byte range locks */
inode
->
i_fop
=
&
cifs_file_ops
;
}
/* check if server can support readpages */
if
(
cifs_sb
->
tcon
->
ses
->
server
->
maxBuf
<
PAGE_CACHE_SIZE
+
MAX_CIFS_HDR_SIZE
)
...
...
@@ -1409,16 +1413,64 @@ cifs_rename_exit:
return
rc
;
}
static
bool
cifs_check_inval
(
struct
inode
*
inode
)
{
struct
cifsInodeInfo
*
cifs_i
=
CIFS_I
(
inode
);
if
(
cifs_i
->
clientCanCacheRead
)
return
false
;
if
(
!
lookupCacheEnabled
)
return
true
;
if
(
cifs_i
->
time
==
0
)
return
true
;
/* FIXME: the actimeo should be tunable */
if
(
time_after_eq
(
jiffies
,
cifs_i
->
time
+
HZ
))
return
true
;
/* hardlinked files get "special" treatment */
if
(
S_ISREG
(
inode
->
i_mode
)
&&
inode
->
i_nlink
!=
1
)
return
true
;
return
false
;
}
/*
* Zap the cache. Called when invalid_mapping flag is set.
*/
void
cifs_invalidate_mapping
(
struct
inode
*
inode
)
{
int
rc
;
struct
cifsInodeInfo
*
cifs_i
=
CIFS_I
(
inode
);
cifs_i
->
invalid_mapping
=
false
;
/* write back any cached data */
if
(
inode
->
i_mapping
&&
inode
->
i_mapping
->
nrpages
!=
0
)
{
rc
=
filemap_write_and_wait
(
inode
->
i_mapping
);
if
(
rc
)
cifs_i
->
write_behind_rc
=
rc
;
rc
=
invalidate_inode_pages2
(
inode
->
i_mapping
);
if
(
rc
)
{
cERROR
(
1
,
(
"%s: could not invalidate inode %p"
,
__func__
,
inode
));
cifs_i
->
invalid_mapping
=
true
;
}
}
}
int
cifs_revalidate
(
struct
dentry
*
direntry
)
{
int
xid
;
int
rc
=
0
,
wbrc
=
0
;
int
rc
=
0
;
char
*
full_path
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsInodeInfo
*
cifsInode
;
loff_t
local_size
;
struct
timespec
local_mtime
;
bool
invalidate_inode
=
false
;
if
(
direntry
->
d_inode
==
NULL
)
return
-
ENOENT
;
...
...
@@ -1428,10 +1480,6 @@ int cifs_revalidate(struct dentry *direntry)
if
(
cifsInode
==
NULL
)
return
-
ENOENT
;
/* no sense revalidating inode info on file that no one can write */
if
(
CIFS_I
(
direntry
->
d_inode
)
->
clientCanCacheRead
)
return
rc
;
xid
=
GetXid
();
cifs_sb
=
CIFS_SB
(
direntry
->
d_sb
);
...
...
@@ -1449,19 +1497,8 @@ int cifs_revalidate(struct dentry *direntry)
direntry
->
d_inode
->
i_count
.
counter
,
direntry
,
direntry
->
d_time
,
jiffies
));
if
(
cifsInode
->
time
==
0
)
{
/* was set to zero previously to force revalidate */
}
else
if
(
time_before
(
jiffies
,
cifsInode
->
time
+
HZ
)
&&
lookupCacheEnabled
)
{
if
((
S_ISREG
(
direntry
->
d_inode
->
i_mode
)
==
0
)
||
(
direntry
->
d_inode
->
i_nlink
==
1
))
{
kfree
(
full_path
);
FreeXid
(
xid
);
return
rc
;
}
else
{
cFYI
(
1
,
(
"Have to revalidate file due to hardlinks"
));
}
}
if
(
!
cifs_check_inval
(
direntry
->
d_inode
))
goto
check_inval
;
/* save mtime and size */
local_mtime
=
direntry
->
d_inode
->
i_mtime
;
...
...
@@ -1495,48 +1532,16 @@ int cifs_revalidate(struct dentry *direntry)
(
local_size
==
direntry
->
d_inode
->
i_size
))
{
cFYI
(
1
,
(
"cifs_revalidate - inode unchanged"
));
}
else
{
/* file may have changed on server */
if
(
cifsInode
->
clientCanCacheRead
)
{
/* no need to invalidate inode pages since we were the
only ones who could have modified the file and the
server copy is staler than ours */
}
else
{
invalidate_inode
=
true
;
}
cifsInode
->
invalid_mapping
=
true
;
}
/* can not grab this sem since kernel filesys locking documentation
indicates i_mutex may be taken by the kernel on lookup and rename
which could deadlock if we grab the i_mutex here as well */
check_inval:
/* mutex_lock(&direntry->d_inode->i_mutex);*/
/* need to write out dirty pages here */
if
(
direntry
->
d_inode
->
i_mapping
)
{
/* do we need to lock inode until after invalidate completes
below? */
wbrc
=
filemap_fdatawrite
(
direntry
->
d_inode
->
i_mapping
);
if
(
wbrc
)
CIFS_I
(
direntry
->
d_inode
)
->
write_behind_rc
=
wbrc
;
}
if
(
invalidate_inode
)
{
/* shrink_dcache not necessary now that cifs dentry ops
are exported for negative dentries */
/* if (S_ISDIR(direntry->d_inode->i_mode))
shrink_dcache_parent(direntry); */
if
(
S_ISREG
(
direntry
->
d_inode
->
i_mode
))
{
if
(
direntry
->
d_inode
->
i_mapping
)
{
wbrc
=
filemap_fdatawait
(
direntry
->
d_inode
->
i_mapping
);
if
(
wbrc
)
CIFS_I
(
direntry
->
d_inode
)
->
write_behind_rc
=
wbrc
;
}
/* may eventually have to do this for open files too */
if
(
list_empty
(
&
(
cifsInode
->
openFileList
)))
{
/* changed on server - flush read ahead pages */
cFYI
(
1
,
(
"Invalidating read ahead data on "
"closed file"
));
invalidate_remote_inode
(
direntry
->
d_inode
);
}
}
}
if
(
cifsInode
->
invalid_mapping
)
cifs_invalidate_mapping
(
direntry
->
d_inode
);
/* mutex_unlock(&direntry->d_inode->i_mutex); */
kfree
(
full_path
);
...
...
sources/2.6.32/misc.c
View file @
edc2bedb
...
...
@@ -569,6 +569,10 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
if
(
pSMB
->
Fid
!=
netfile
->
netfid
)
continue
;
cFYI
(
1
,
(
"file id match, oplock break"
));
pCifsInode
=
CIFS_I
(
netfile
->
pInode
);
cifs_set_oplock_level
(
pCifsInode
,
pSMB
->
OplockLevel
?
OPLOCK_READ
:
0
);
/*
* don't do anything if file is about to be
* closed anyway.
...
...
@@ -579,11 +583,6 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
return
true
;
}
cFYI
(
1
,
(
"file id match, oplock break"
));
pCifsInode
=
CIFS_I
(
netfile
->
pInode
);
pCifsInode
->
clientCanCacheAll
=
false
;
if
(
pSMB
->
OplockLevel
==
0
)
pCifsInode
->
clientCanCacheRead
=
false
;
rc
=
slow_work_enqueue
(
&
netfile
->
oplock_break
);
if
(
rc
)
{
cERROR
(
1
,
(
"failed to enqueue oplock "
...
...
@@ -729,3 +728,23 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
cifs_sb
->
tcon
->
treeName
));
}
}
void
cifs_set_oplock_level
(
struct
cifsInodeInfo
*
cinode
,
__u32
oplock
)
{
oplock
&=
0xF
;
if
(
oplock
==
OPLOCK_EXCLUSIVE
)
{
cinode
->
clientCanCacheAll
=
true
;
cinode
->
clientCanCacheRead
=
true
;
cFYI
(
1
,
(
"Exclusive Oplock granted on inode %p"
,
&
cinode
->
vfs_inode
));
}
else
if
(
oplock
==
OPLOCK_READ
)
{
cinode
->
clientCanCacheAll
=
false
;
cinode
->
clientCanCacheRead
=
true
;
cFYI
(
1
,
(
"Level II Oplock granted on inode %p"
,
&
cinode
->
vfs_inode
));
}
else
{
cinode
->
clientCanCacheAll
=
false
;
cinode
->
clientCanCacheRead
=
false
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment