Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
8f09c3d8
Commit
8f09c3d8
authored
Mar 26, 2012
by
Steve French
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-3.4'
parents
e22057c8
c7ad42b5
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1376 additions
and
944 deletions
+1376
-944
fs/cifs/cifs_debug.c
fs/cifs/cifs_debug.c
+13
-55
fs/cifs/cifs_debug.h
fs/cifs/cifs_debug.h
+2
-2
fs/cifs/cifsfs.c
fs/cifs/cifsfs.c
+12
-1
fs/cifs/cifsglob.h
fs/cifs/cifsglob.h
+30
-9
fs/cifs/cifsproto.h
fs/cifs/cifsproto.h
+13
-7
fs/cifs/cifssmb.c
fs/cifs/cifssmb.c
+72
-54
fs/cifs/connect.c
fs/cifs/connect.c
+874
-575
fs/cifs/file.c
fs/cifs/file.c
+176
-95
fs/cifs/misc.c
fs/cifs/misc.c
+55
-45
fs/cifs/netmisc.c
fs/cifs/netmisc.c
+2
-1
fs/cifs/transport.c
fs/cifs/transport.c
+127
-100
No files found.
fs/cifs/cifs_debug.c
View file @
8f09c3d8
...
...
@@ -58,15 +58,16 @@ cifs_dump_mem(char *label, void *data, int length)
}
#ifdef CONFIG_CIFS_DEBUG2
void
cifs_dump_detail
(
struct
smb_hdr
*
smb
)
void
cifs_dump_detail
(
void
*
buf
)
{
struct
smb_hdr
*
smb
=
(
struct
smb_hdr
*
)
buf
;
cERROR
(
1
,
"Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d"
,
smb
->
Command
,
smb
->
Status
.
CifsError
,
smb
->
Flags
,
smb
->
Flags2
,
smb
->
Mid
,
smb
->
Pid
);
cERROR
(
1
,
"smb buf %p len %d"
,
smb
,
smbCalcSize
(
smb
));
}
void
cifs_dump_mids
(
struct
TCP_Server_Info
*
server
)
{
struct
list_head
*
tmp
;
...
...
@@ -79,15 +80,15 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
spin_lock
(
&
GlobalMid_Lock
);
list_for_each
(
tmp
,
&
server
->
pending_mid_q
)
{
mid_entry
=
list_entry
(
tmp
,
struct
mid_q_entry
,
qhead
);
cERROR
(
1
,
"State: %d Cmd: %d Pid: %d Cbdata: %p Mid %
d
"
,
mid_entry
->
mid
S
tate
,
(
int
)
mid_entry
->
command
,
cERROR
(
1
,
"State: %d Cmd: %d Pid: %d Cbdata: %p Mid %
llu
"
,
mid_entry
->
mid
_s
tate
,
le16_to_cpu
(
mid_entry
->
command
)
,
mid_entry
->
pid
,
mid_entry
->
callback_data
,
mid_entry
->
mid
);
#ifdef CONFIG_CIFS_STATS2
cERROR
(
1
,
"IsLarge: %d buf: %p time rcv: %ld now: %ld"
,
mid_entry
->
large
B
uf
,
mid_entry
->
large
_b
uf
,
mid_entry
->
resp_buf
,
mid_entry
->
when_received
,
jiffies
);
...
...
@@ -217,12 +218,12 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
mid_entry
=
list_entry
(
tmp3
,
struct
mid_q_entry
,
qhead
);
seq_printf
(
m
,
"
\t
State: %d com: %d pid:"
" %d cbdata: %p mid %d
\n
"
,
mid_entry
->
midS
tate
,
(
int
)
mid_entry
->
command
,
mid_entry
->
pid
,
mid_entry
->
callback_data
,
mid_entry
->
mid
);
" %d cbdata: %p mid %llu
\n
"
,
mid_entry
->
mid_s
tate
,
le16_to_cpu
(
mid_entry
->
command
)
,
mid_entry
->
pid
,
mid_entry
->
callback_data
,
mid_entry
->
mid
);
}
spin_unlock
(
&
GlobalMid_Lock
);
}
...
...
@@ -417,7 +418,6 @@ static const struct file_operations cifs_stats_proc_fops = {
static
struct
proc_dir_entry
*
proc_fs_cifs
;
static
const
struct
file_operations
cifsFYI_proc_fops
;
static
const
struct
file_operations
cifs_oplock_proc_fops
;
static
const
struct
file_operations
cifs_lookup_cache_proc_fops
;
static
const
struct
file_operations
traceSMB_proc_fops
;
static
const
struct
file_operations
cifs_multiuser_mount_proc_fops
;
...
...
@@ -438,7 +438,6 @@ cifs_proc_init(void)
#endif
/* STATS */
proc_create
(
"cifsFYI"
,
0
,
proc_fs_cifs
,
&
cifsFYI_proc_fops
);
proc_create
(
"traceSMB"
,
0
,
proc_fs_cifs
,
&
traceSMB_proc_fops
);
proc_create
(
"OplockEnabled"
,
0
,
proc_fs_cifs
,
&
cifs_oplock_proc_fops
);
proc_create
(
"LinuxExtensionsEnabled"
,
0
,
proc_fs_cifs
,
&
cifs_linux_ext_proc_fops
);
proc_create
(
"MultiuserMount"
,
0
,
proc_fs_cifs
,
...
...
@@ -462,7 +461,6 @@ cifs_proc_clean(void)
remove_proc_entry
(
"Stats"
,
proc_fs_cifs
);
#endif
remove_proc_entry
(
"MultiuserMount"
,
proc_fs_cifs
);
remove_proc_entry
(
"OplockEnabled"
,
proc_fs_cifs
);
remove_proc_entry
(
"SecurityFlags"
,
proc_fs_cifs
);
remove_proc_entry
(
"LinuxExtensionsEnabled"
,
proc_fs_cifs
);
remove_proc_entry
(
"LookupCacheEnabled"
,
proc_fs_cifs
);
...
...
@@ -508,46 +506,6 @@ static const struct file_operations cifsFYI_proc_fops = {
.
write
=
cifsFYI_proc_write
,
};
static
int
cifs_oplock_proc_show
(
struct
seq_file
*
m
,
void
*
v
)
{
seq_printf
(
m
,
"%d
\n
"
,
enable_oplocks
);
return
0
;
}
static
int
cifs_oplock_proc_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
cifs_oplock_proc_show
,
NULL
);
}
static
ssize_t
cifs_oplock_proc_write
(
struct
file
*
file
,
const
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
char
c
;
int
rc
;
printk
(
KERN_WARNING
"CIFS: The /proc/fs/cifs/OplockEnabled interface "
"will be removed in kernel version 3.4. Please migrate to "
"using the 'enable_oplocks' module parameter in cifs.ko.
\n
"
);
rc
=
get_user
(
c
,
buffer
);
if
(
rc
)
return
rc
;
if
(
c
==
'0'
||
c
==
'n'
||
c
==
'N'
)
enable_oplocks
=
false
;
else
if
(
c
==
'1'
||
c
==
'y'
||
c
==
'Y'
)
enable_oplocks
=
true
;
return
count
;
}
static
const
struct
file_operations
cifs_oplock_proc_fops
=
{
.
owner
=
THIS_MODULE
,
.
open
=
cifs_oplock_proc_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
.
write
=
cifs_oplock_proc_write
,
};
static
int
cifs_linux_ext_proc_show
(
struct
seq_file
*
m
,
void
*
v
)
{
seq_printf
(
m
,
"%d
\n
"
,
linuxExtEnabled
);
...
...
fs/cifs/cifs_debug.h
View file @
8f09c3d8
...
...
@@ -26,13 +26,13 @@
void
cifs_dump_mem
(
char
*
label
,
void
*
data
,
int
length
);
#ifdef CONFIG_CIFS_DEBUG2
#define DBG2 2
void
cifs_dump_detail
(
struct
smb_hdr
*
);
void
cifs_dump_detail
(
void
*
);
void
cifs_dump_mids
(
struct
TCP_Server_Info
*
);
#else
#define DBG2 0
#endif
extern
int
traceSMB
;
/* flag which enables the function below */
void
dump_smb
(
struct
smb_hdr
*
,
int
);
void
dump_smb
(
void
*
,
int
);
#define CIFS_INFO 0x01
#define CIFS_RC 0x02
#define CIFS_TIMER 0x04
...
...
fs/cifs/cifsfs.c
View file @
8f09c3d8
...
...
@@ -85,6 +85,8 @@ extern mempool_t *cifs_sm_req_poolp;
extern
mempool_t
*
cifs_req_poolp
;
extern
mempool_t
*
cifs_mid_poolp
;
struct
workqueue_struct
*
cifsiod_wq
;
static
int
cifs_read_super
(
struct
super_block
*
sb
)
{
...
...
@@ -1111,9 +1113,15 @@ init_cifs(void)
cFYI
(
1
,
"cifs_max_pending set to max of %u"
,
CIFS_MAX_REQ
);
}
cifsiod_wq
=
alloc_workqueue
(
"cifsiod"
,
WQ_FREEZABLE
|
WQ_MEM_RECLAIM
,
0
);
if
(
!
cifsiod_wq
)
{
rc
=
-
ENOMEM
;
goto
out_clean_proc
;
}
rc
=
cifs_fscache_register
();
if
(
rc
)
goto
out_
clean_proc
;
goto
out_
destroy_wq
;
rc
=
cifs_init_inodecache
();
if
(
rc
)
...
...
@@ -1161,6 +1169,8 @@ init_cifs(void)
cifs_destroy_inodecache
();
out_unreg_fscache:
cifs_fscache_unregister
();
out_destroy_wq:
destroy_workqueue
(
cifsiod_wq
);
out_clean_proc:
cifs_proc_clean
();
return
rc
;
...
...
@@ -1183,6 +1193,7 @@ exit_cifs(void)
cifs_destroy_mids
();
cifs_destroy_inodecache
();
cifs_fscache_unregister
();
destroy_workqueue
(
cifsiod_wq
);
cifs_proc_clean
();
}
...
...
fs/cifs/cifsglob.h
View file @
8f09c3d8
...
...
@@ -230,6 +230,12 @@ struct cifs_mnt_data {
int
flags
;
};
static
inline
unsigned
int
get_rfc1002_length
(
void
*
buf
)
{
return
be32_to_cpu
(
*
((
__be32
*
)
buf
));
}
struct
TCP_Server_Info
{
struct
list_head
tcp_ses_list
;
struct
list_head
smb_ses_list
;
...
...
@@ -276,7 +282,7 @@ struct TCP_Server_Info {
vcnumbers */
int
capabilities
;
/* allow selective disabling of caps by smb sess */
int
timeAdj
;
/* Adjust for difference in server time zone in sec */
__u
16
CurrentMid
;
/* multiplex id - rotating counter */
__u
64
CurrentMid
;
/* multiplex id - rotating counter */
char
cryptkey
[
CIFS_CRYPTO_KEY_SIZE
];
/* used by ntlm, ntlmv2 etc */
/* 16th byte of RFC1001 workstation name is always null */
char
workstation_RFC1001_name
[
RFC1001_NAME_LEN_WITH_NULL
];
...
...
@@ -335,6 +341,18 @@ has_credits(struct TCP_Server_Info *server, int *credits)
return
num
>
0
;
}
static
inline
size_t
header_size
(
void
)
{
return
sizeof
(
struct
smb_hdr
);
}
static
inline
size_t
max_header_size
(
void
)
{
return
MAX_CIFS_HDR_SIZE
;
}
/*
* Macros to allow the TCP_Server_Info->net field and related code to drop out
* when CONFIG_NET_NS isn't set.
...
...
@@ -583,9 +601,11 @@ struct cifs_io_parms {
* Take a reference on the file private data. Must be called with
* cifs_file_list_lock held.
*/
static
inline
void
cifsFileInfo_get
(
struct
cifsFileInfo
*
cifs_file
)
static
inline
struct
cifsFileInfo
*
cifsFileInfo_get
(
struct
cifsFileInfo
*
cifs_file
)
{
++
cifs_file
->
count
;
return
cifs_file
;
}
void
cifsFileInfo_put
(
struct
cifsFileInfo
*
cifs_file
);
...
...
@@ -606,7 +626,7 @@ struct cifsInodeInfo {
bool
delete_pending
;
/* DELETE_ON_CLOSE is set */
bool
invalid_mapping
;
/* pagecache is invalid */
unsigned
long
time
;
/* jiffies of last update of inode */
u64
server_eof
;
/* current file size on server */
u64
server_eof
;
/* current file size on server
-- protected by i_lock
*/
u64
uniqueid
;
/* server inode number */
u64
createtime
;
/* creation time on server */
#ifdef CONFIG_CIFS_FSCACHE
...
...
@@ -713,8 +733,8 @@ typedef void (mid_callback_t)(struct mid_q_entry *mid);
/* one of these for every pending CIFS request to the server */
struct
mid_q_entry
{
struct
list_head
qhead
;
/* mids waiting on reply from this server */
__u
16
mid
;
/* multiplex id */
__u
16
pid
;
/* process id */
__u
64
mid
;
/* multiplex id */
__u
32
pid
;
/* process id */
__u32
sequence_number
;
/* for CIFS signing */
unsigned
long
when_alloc
;
/* when mid was created */
#ifdef CONFIG_CIFS_STATS2
...
...
@@ -724,10 +744,10 @@ struct mid_q_entry {
mid_receive_t
*
receive
;
/* call receive callback */
mid_callback_t
*
callback
;
/* call completion callback */
void
*
callback_data
;
/* general purpose pointer for callback */
struct
smb_hdr
*
resp_buf
;
/* pointer to received SMB header */
int
mid
S
tate
;
/* wish this were enum but can not pass to wait_event */
__
u8
command
;
/* smb command code */
bool
large
B
uf
:
1
;
/* if valid response, is pointer to large buf */
void
*
resp_buf
;
/* pointer to received SMB header */
int
mid
_s
tate
;
/* wish this were enum but can not pass to wait_event */
__
le16
command
;
/* smb command code */
bool
large
_b
uf
:
1
;
/* if valid response, is pointer to large buf */
bool
multiRsp
:
1
;
/* multiple trans2 responses for one request */
bool
multiEnd
:
1
;
/* both received */
};
...
...
@@ -1052,5 +1072,6 @@ GLOBAL_EXTERN spinlock_t gidsidlock;
void
cifs_oplock_break
(
struct
work_struct
*
work
);
extern
const
struct
slow_work_ops
cifs_oplock_break_ops
;
extern
struct
workqueue_struct
*
cifsiod_wq
;
#endif
/* _CIFS_GLOB_H */
fs/cifs/cifsproto.h
View file @
8f09c3d8
...
...
@@ -77,7 +77,7 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
struct
smb_hdr
*
/* out */
,
int
*
/* bytes returned */
,
const
int
long_op
);
extern
int
SendReceiveNoRsp
(
const
unsigned
int
xid
,
struct
cifs_ses
*
ses
,
struct
smb_hd
r
*
in_buf
,
int
flags
);
cha
r
*
in_buf
,
int
flags
);
extern
int
cifs_check_receive
(
struct
mid_q_entry
*
mid
,
struct
TCP_Server_Info
*
server
,
bool
log_error
);
extern
int
SendReceive2
(
const
unsigned
int
/* xid */
,
struct
cifs_ses
*
,
...
...
@@ -91,9 +91,8 @@ extern int SendReceiveBlockingLock(const unsigned int xid,
extern
void
cifs_add_credits
(
struct
TCP_Server_Info
*
server
,
const
unsigned
int
add
);
extern
void
cifs_set_credits
(
struct
TCP_Server_Info
*
server
,
const
int
val
);
extern
int
checkSMB
(
struct
smb_hdr
*
smb
,
__u16
mid
,
unsigned
int
length
);
extern
bool
is_valid_oplock_break
(
struct
smb_hdr
*
smb
,
struct
TCP_Server_Info
*
);
extern
int
checkSMB
(
char
*
buf
,
unsigned
int
length
);
extern
bool
is_valid_oplock_break
(
char
*
,
struct
TCP_Server_Info
*
);
extern
bool
backup_cred
(
struct
cifs_sb_info
*
);
extern
bool
is_size_safe_to_change
(
struct
cifsInodeInfo
*
,
__u64
eof
);
extern
void
cifs_update_eof
(
struct
cifsInodeInfo
*
cifsi
,
loff_t
offset
,
...
...
@@ -107,7 +106,7 @@ extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len);
extern
int
cifs_set_port
(
struct
sockaddr
*
addr
,
const
unsigned
short
int
port
);
extern
int
cifs_fill_sockaddr
(
struct
sockaddr
*
dst
,
const
char
*
src
,
int
len
,
const
unsigned
short
int
port
);
extern
int
map_smb_to_linux_error
(
struct
smb_hdr
*
smb
,
bool
logErr
);
extern
int
map_smb_to_linux_error
(
char
*
buf
,
bool
logErr
);
extern
void
header_assemble
(
struct
smb_hdr
*
,
char
/* command */
,
const
struct
cifs_tcon
*
,
int
/* length of
fixed section (word count) in two byte units */
);
...
...
@@ -116,7 +115,7 @@ extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
void
**
request_buf
);
extern
int
CIFS_SessSetup
(
unsigned
int
xid
,
struct
cifs_ses
*
ses
,
const
struct
nls_table
*
nls_cp
);
extern
__u
16
GetNextMid
(
struct
TCP_Server_Info
*
server
);
extern
__u
64
GetNextMid
(
struct
TCP_Server_Info
*
server
);
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
,
...
...
@@ -484,18 +483,25 @@ int cifs_async_readv(struct cifs_readdata *rdata);
/* asynchronous write support */
struct
cifs_writedata
{
struct
kref
refcount
;
struct
list_head
list
;
struct
completion
done
;
enum
writeback_sync_modes
sync_mode
;
struct
work_struct
work
;
struct
cifsFileInfo
*
cfile
;
__u64
offset
;
pid_t
pid
;
unsigned
int
bytes
;
int
result
;
void
(
*
marshal_iov
)
(
struct
kvec
*
iov
,
struct
cifs_writedata
*
wdata
);
unsigned
int
nr_pages
;
struct
page
*
pages
[
1
];
};
int
cifs_async_writev
(
struct
cifs_writedata
*
wdata
);
struct
cifs_writedata
*
cifs_writedata_alloc
(
unsigned
int
nr_pages
);
void
cifs_writev_complete
(
struct
work_struct
*
work
);
struct
cifs_writedata
*
cifs_writedata_alloc
(
unsigned
int
nr_pages
,
work_func_t
complete
);
void
cifs_writedata_release
(
struct
kref
*
refcount
);
#endif
/* _CIFSPROTO_H */
fs/cifs/cifssmb.c
View file @
8f09c3d8
This diff is collapsed.
Click to expand it.
fs/cifs/connect.c
View file @
8f09c3d8
This diff is collapsed.
Click to expand it.
fs/cifs/file.c
View file @
8f09c3d8
This diff is collapsed.
Click to expand it.
fs/cifs/misc.c
View file @
8f09c3d8
...
...
@@ -213,55 +213,62 @@ cifs_small_buf_release(void *buf_to_free)
}
/*
Find a free multiplex id (SMB mid). Otherwise there could be
mid collisions which might cause problems, demultiplexing the
wrong response to this request. Multiplex ids could collide if
one of a series requests takes much longer than the others, or
if a very large number of long lived requests (byte range
locks or FindNotify requests) are pending.
No more than
64K-1 requests can be outstanding at one time.
If no
mids are available, return zero.
A future optimization
could make the combination of mids and uid the key we use
to demultiplex on (rather than mid alone).
In addition to the above check, the cifs demultiplex
code already used the command code as a secondary
check of the frame and if signing is negotiated the
response would be discarded if the mid were the same
but the signature was wrong.
Since the mid is not put in the
pending queue until later (when it is about to be dispatched)
we do have to limit the number of outstanding requests
to somewhat less than 64K-1 although it is hard to imagine
so many threads being in the vfs at one time.
*/
__u
16
GetNextMid
(
struct
TCP_Server_Info
*
server
)
*
Find a free multiplex id (SMB mid). Otherwise there could be
*
mid collisions which might cause problems, demultiplexing the
*
wrong response to this request. Multiplex ids could collide if
*
one of a series requests takes much longer than the others, or
*
if a very large number of long lived requests (byte range
* locks or FindNotify requests) are pending.
No more than
* 64K-1 requests can be outstanding at one time.
If no
* mids are available, return zero.
A future optimization
*
could make the combination of mids and uid the key we use
*
to demultiplex on (rather than mid alone).
*
In addition to the above check, the cifs demultiplex
*
code already used the command code as a secondary
*
check of the frame and if signing is negotiated the
*
response would be discarded if the mid were the same
* but the signature was wrong.
Since the mid is not put in the
*
pending queue until later (when it is about to be dispatched)
*
we do have to limit the number of outstanding requests
*
to somewhat less than 64K-1 although it is hard to imagine
*
so many threads being in the vfs at one time.
*/
__u
64
GetNextMid
(
struct
TCP_Server_Info
*
server
)
{
__u
16
mid
=
0
;
__u16
last_mid
;
__u
64
mid
=
0
;
__u16
last_mid
,
cur_mid
;
bool
collision
;
spin_lock
(
&
GlobalMid_Lock
);
last_mid
=
server
->
CurrentMid
;
/* we do not want to loop forever */
server
->
CurrentMid
++
;
/* This nested loop looks more expensive than it is.
In practice the list of pending requests is short,
fewer than 50, and the mids are likely to be unique
on the first pass through the loop unless some request
takes longer than the 64 thousand requests before it
(and it would also have to have been a request that
did not time out) */
while
(
server
->
CurrentMid
!=
last_mid
)
{
/* mid is 16 bit only for CIFS/SMB */
cur_mid
=
(
__u16
)((
server
->
CurrentMid
)
&
0xffff
);
/* we do not want to loop forever */
last_mid
=
cur_mid
;
cur_mid
++
;
/*
* This nested loop looks more expensive than it is.
* In practice the list of pending requests is short,
* fewer than 50, and the mids are likely to be unique
* on the first pass through the loop unless some request
* takes longer than the 64 thousand requests before it
* (and it would also have to have been a request that
* did not time out).
*/
while
(
cur_mid
!=
last_mid
)
{
struct
mid_q_entry
*
mid_entry
;
unsigned
int
num_mids
;
collision
=
false
;
if
(
server
->
CurrentM
id
==
0
)
server
->
CurrentM
id
++
;
if
(
cur_m
id
==
0
)
cur_m
id
++
;
num_mids
=
0
;
list_for_each_entry
(
mid_entry
,
&
server
->
pending_mid_q
,
qhead
)
{
++
num_mids
;
if
(
mid_entry
->
mid
==
server
->
CurrentM
id
&&
mid_entry
->
mid
S
tate
==
MID_REQUEST_SUBMITTED
)
{
if
(
mid_entry
->
mid
==
cur_m
id
&&
mid_entry
->
mid
_s
tate
==
MID_REQUEST_SUBMITTED
)
{
/* This mid is in use, try a different one */
collision
=
true
;
break
;
...
...
@@ -282,10 +289,11 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
server
->
tcpStatus
=
CifsNeedReconnect
;
if
(
!
collision
)
{
mid
=
server
->
CurrentMid
;
mid
=
(
__u64
)
cur_mid
;
server
->
CurrentMid
=
mid
;
break
;
}
server
->
CurrentM
id
++
;
cur_m
id
++
;
}
spin_unlock
(
&
GlobalMid_Lock
);
return
mid
;
...
...
@@ -420,8 +428,10 @@ check_smb_hdr(struct smb_hdr *smb, __u16 mid)
}
int
checkSMB
(
struct
smb_hdr
*
smb
,
__u16
mid
,
unsigned
int
total_read
)
checkSMB
(
char
*
buf
,
unsigned
int
total_read
)
{
struct
smb_hdr
*
smb
=
(
struct
smb_hdr
*
)
buf
;
__u16
mid
=
smb
->
Mid
;
__u32
rfclen
=
be32_to_cpu
(
smb
->
smb_buf_length
);
__u32
clc_len
;
/* calculated length */
cFYI
(
0
,
"checkSMB Length: 0x%x, smb_buf_length: 0x%x"
,
...
...
@@ -502,8 +512,9 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int total_read)
}
bool
is_valid_oplock_break
(
struct
smb_hdr
*
buf
,
struct
TCP_Server_Info
*
srv
)
is_valid_oplock_break
(
char
*
buffer
,
struct
TCP_Server_Info
*
srv
)
{
struct
smb_hdr
*
buf
=
(
struct
smb_hdr
*
)
buffer
;
struct
smb_com_lock_req
*
pSMB
=
(
struct
smb_com_lock_req
*
)
buf
;
struct
list_head
*
tmp
,
*
tmp1
,
*
tmp2
;
struct
cifs_ses
*
ses
;
...
...
@@ -584,7 +595,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
cifs_set_oplock_level
(
pCifsInode
,
pSMB
->
OplockLevel
?
OPLOCK_READ
:
0
);
queue_work
(
system_nrt
_wq
,
queue_work
(
cifsiod
_wq
,
&
netfile
->
oplock_break
);
netfile
->
oplock_break_cancelled
=
false
;
...
...
@@ -604,16 +615,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
}
void
dump_smb
(
struct
smb_hdr
*
smb_
buf
,
int
smb_buf_length
)
dump_smb
(
void
*
buf
,
int
smb_buf_length
)
{
int
i
,
j
;
char
debug_line
[
17
];
unsigned
char
*
buffer
;
unsigned
char
*
buffer
=
buf
;
if
(
traceSMB
==
0
)
return
;
buffer
=
(
unsigned
char
*
)
smb_buf
;
for
(
i
=
0
,
j
=
0
;
i
<
smb_buf_length
;
i
++
,
j
++
)
{
if
(
i
%
8
==
0
)
{
/* have reached the beginning of line */
...
...
fs/cifs/netmisc.c
View file @
8f09c3d8
...
...
@@ -836,8 +836,9 @@ ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode)
}
int
map_smb_to_linux_error
(
struct
smb_hdr
*
smb
,
bool
logErr
)
map_smb_to_linux_error
(
char
*
buf
,
bool
logErr
)
{
struct
smb_hdr
*
smb
=
(
struct
smb_hdr
*
)
buf
;
unsigned
int
i
;
int
rc
=
-
EIO
;
/* if transport error smb error may not be set */
__u8
smberrclass
;
...
...
fs/cifs/transport.c
View file @
8f09c3d8
This diff is collapsed.
Click to expand it.
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