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
bb5a72ce
Commit
bb5a72ce
authored
Oct 20, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge nuts.ninka.net:/disk1/davem/BK/network-2.5
into nuts.ninka.net:/disk1/davem/BK/net-2.5
parents
4e766f6c
edbb65db
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
356 additions
and
199 deletions
+356
-199
drivers/ide/pci/siimage.c
drivers/ide/pci/siimage.c
+3
-2
drivers/md/raid0.c
drivers/md/raid0.c
+4
-3
drivers/media/video/bttv-driver.c
drivers/media/video/bttv-driver.c
+1
-0
fs/cifs/AUTHORS
fs/cifs/AUTHORS
+1
-0
fs/cifs/CHANGES
fs/cifs/CHANGES
+17
-0
fs/cifs/README
fs/cifs/README
+7
-0
fs/cifs/cifs_debug.c
fs/cifs/cifs_debug.c
+8
-6
fs/cifs/cifsencrypt.c
fs/cifs/cifsencrypt.c
+3
-3
fs/cifs/cifsfs.c
fs/cifs/cifsfs.c
+14
-16
fs/cifs/cifsglob.h
fs/cifs/cifsglob.h
+24
-3
fs/cifs/cifssmb.c
fs/cifs/cifssmb.c
+1
-1
fs/cifs/connect.c
fs/cifs/connect.c
+88
-33
fs/cifs/dir.c
fs/cifs/dir.c
+2
-0
fs/cifs/file.c
fs/cifs/file.c
+163
-31
fs/cifs/misc.c
fs/cifs/misc.c
+7
-7
fs/cifs/smbdes.c
fs/cifs/smbdes.c
+1
-39
fs/cifs/smbencrypt.c
fs/cifs/smbencrypt.c
+0
-43
fs/cifs/transport.c
fs/cifs/transport.c
+10
-12
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs3xdr.c
+2
-0
No files found.
drivers/ide/pci/siimage.c
View file @
bb5a72ce
...
@@ -35,13 +35,13 @@
...
@@ -35,13 +35,13 @@
#include "siimage.h"
#include "siimage.h"
#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
static
u8
siimage_proc
=
0
;
static
u8
siimage_proc
=
0
;
#define SIIMAGE_MAX_DEVS 16
#define SIIMAGE_MAX_DEVS 16
static
struct
pci_dev
*
siimage_devs
[
SIIMAGE_MAX_DEVS
];
static
struct
pci_dev
*
siimage_devs
[
SIIMAGE_MAX_DEVS
];
static
int
n_siimage_devs
;
static
int
n_siimage_devs
;
#endif
/* defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) */
/**
/**
* pdev_is_sata - check if device is SATA
* pdev_is_sata - check if device is SATA
...
@@ -121,6 +121,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
...
@@ -121,6 +121,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
return
base
;
return
base
;
}
}
#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
/**
/**
* print_siimage_get_info - print minimal proc information
* print_siimage_get_info - print minimal proc information
* @buf: buffer to write into (kernel space)
* @buf: buffer to write into (kernel space)
...
...
drivers/md/raid0.c
View file @
bb5a72ce
...
@@ -332,7 +332,7 @@ static int raid0_stop (mddev_t *mddev)
...
@@ -332,7 +332,7 @@ static int raid0_stop (mddev_t *mddev)
static
int
raid0_make_request
(
request_queue_t
*
q
,
struct
bio
*
bio
)
static
int
raid0_make_request
(
request_queue_t
*
q
,
struct
bio
*
bio
)
{
{
mddev_t
*
mddev
=
q
->
queuedata
;
mddev_t
*
mddev
=
q
->
queuedata
;
unsigned
int
sect_in_chunk
,
chunksize_bits
,
chunk_size
;
unsigned
int
sect_in_chunk
,
chunksize_bits
,
chunk_size
,
chunk_sects
;
raid0_conf_t
*
conf
=
mddev_to_conf
(
mddev
);
raid0_conf_t
*
conf
=
mddev_to_conf
(
mddev
);
struct
strip_zone
*
zone
;
struct
strip_zone
*
zone
;
mdk_rdev_t
*
tmp_dev
;
mdk_rdev_t
*
tmp_dev
;
...
@@ -340,11 +340,12 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
...
@@ -340,11 +340,12 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
sector_t
block
,
rsect
;
sector_t
block
,
rsect
;
chunk_size
=
mddev
->
chunk_size
>>
10
;
chunk_size
=
mddev
->
chunk_size
>>
10
;
chunk_sects
=
mddev
->
chunk_size
>>
9
;
chunksize_bits
=
ffz
(
~
chunk_size
);
chunksize_bits
=
ffz
(
~
chunk_size
);
block
=
bio
->
bi_sector
>>
1
;
block
=
bio
->
bi_sector
>>
1
;
if
(
unlikely
(
chunk_s
ize
<
(
block
&
(
chunk_size
-
1
))
+
(
bio
->
bi_size
>>
10
)))
{
if
(
unlikely
(
chunk_s
ects
<
(
bio
->
bi_sector
&
(
chunk_sects
-
1
))
+
(
bio
->
bi_size
>>
9
)))
{
struct
bio_pair
*
bp
;
struct
bio_pair
*
bp
;
/* Sanity check -- queue functions should prevent this happening */
/* Sanity check -- queue functions should prevent this happening */
if
(
bio
->
bi_vcnt
!=
1
||
if
(
bio
->
bi_vcnt
!=
1
||
...
@@ -353,7 +354,7 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
...
@@ -353,7 +354,7 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
/* This is a one page bio that upper layers
/* This is a one page bio that upper layers
* refuse to split for us, so we need to split it.
* refuse to split for us, so we need to split it.
*/
*/
bp
=
bio_split
(
bio
,
bio_split_pool
,
(
chunk_size
-
(
block
&
(
chunk_size
-
1
)))
<<
1
);
bp
=
bio_split
(
bio
,
bio_split_pool
,
chunk_sects
-
(
bio
->
bi_sector
&
(
chunk_sects
-
1
))
);
if
(
raid0_make_request
(
q
,
&
bp
->
bio1
))
if
(
raid0_make_request
(
q
,
&
bp
->
bio1
))
generic_make_request
(
&
bp
->
bio1
);
generic_make_request
(
&
bp
->
bio1
);
if
(
raid0_make_request
(
q
,
&
bp
->
bio2
))
if
(
raid0_make_request
(
q
,
&
bp
->
bio2
))
...
...
drivers/media/video/bttv-driver.c
View file @
bb5a72ce
...
@@ -2818,6 +2818,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
...
@@ -2818,6 +2818,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
up
(
&
fh
->
cap
.
lock
);
up
(
&
fh
->
cap
.
lock
);
return
POLLERR
;
return
POLLERR
;
}
}
fh
->
cap
.
read_buf
->
memory
=
V4L2_MEMORY_USERPTR
;
field
=
videobuf_next_field
(
&
fh
->
cap
);
field
=
videobuf_next_field
(
&
fh
->
cap
);
if
(
0
!=
fh
->
cap
.
ops
->
buf_prepare
(
file
,
fh
->
cap
.
read_buf
,
field
))
{
if
(
0
!=
fh
->
cap
.
ops
->
buf_prepare
(
file
,
fh
->
cap
.
read_buf
,
field
))
{
up
(
&
fh
->
cap
.
lock
);
up
(
&
fh
->
cap
.
lock
);
...
...
fs/cifs/AUTHORS
View file @
bb5a72ce
...
@@ -20,6 +20,7 @@ Patch Contributors
...
@@ -20,6 +20,7 @@ Patch Contributors
Zwane Mwaikambo
Zwane Mwaikambo
Andi Kleen
Andi Kleen
Amrut Joshi
Amrut Joshi
Shobhit Dayal
Test case and Bug Report contributors
Test case and Bug Report contributors
-------------------------------------
-------------------------------------
...
...
fs/cifs/CHANGES
View file @
bb5a72ce
Version 0.94
------------
Fix to list processing in reopen_files. Fix reconnection when server hung
but tcpip session still alive. Set proper timeout on socket read.
Version 0.93
------------
Add missing mount options including iocharset. SMP fixes in write and open.
Fix errors in reconnecting after TCP session failure. Fix module unloading
of default nls codepage
Version 0.92
------------
Active smb transactions should never go negative (fix double FreeXid). Fix
list processing in file routines. Check return code on kmalloc in open.
Fix spinlock usage for SMP.
Version 0.91
Version 0.91
------------
------------
Fix oops in reopen_files when invalid dentry. drop dentry on server rename
Fix oops in reopen_files when invalid dentry. drop dentry on server rename
...
...
fs/cifs/README
View file @
bb5a72ce
...
@@ -127,6 +127,13 @@ A partial list of the supported mount options follows:
...
@@ -127,6 +127,13 @@ A partial list of the supported mount options follows:
this overrides the default mode for directory inodes.
this overrides the default mode for directory inodes.
port attempt to contact the server on this tcp port, before
port attempt to contact the server on this tcp port, before
trying the usual ports (port 445, then 139).
trying the usual ports (port 445, then 139).
iocharset Codepage used to convert local path names to and from
Unicode. Unicode is used by default for network path
names if the server supports it. If iocharset is
not specified then the nls_default specified
during the local client kernel build will be used.
If server does not support Unicode, this parameter is
unused.
rsize default read size
rsize default read size
wsize default write size
wsize default write size
rw mount the network share read-write (note that the
rw mount the network share read-write (note that the
...
...
fs/cifs/cifs_debug.c
View file @
bb5a72ce
/*
/*
* fs/cifs_debug.c
* fs/cifs_debug.c
*
*
* Copyright (
c) International Business Machines Corp., 2000,2002
* Copyright (
C) International Business Machines Corp., 2000,2003
*
*
* Modified by Steve French (sfrench@us.ibm.com)
* Modified by Steve French (sfrench@us.ibm.com)
*
*
...
@@ -84,12 +84,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
...
@@ -84,12 +84,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
cifsSessionList
);
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
cifsSessionList
);
length
=
length
=
sprintf
(
buf
,
sprintf
(
buf
,
"
\n
%d) Name: %s Domain: %s Mounts: %d ServerOS: %s
ServerNOS: %s
\n\t
Capabilities: 0x%x
"
,
"
\n
%d) Name: %s Domain: %s Mounts: %d ServerOS: %s
\n\t
ServerNOS: %s
\t
Capabilities: 0x%x
\n\t
SMB session status: %d
\t
TCP session status: %d
"
,
i
,
ses
->
serverName
,
ses
->
serverDomain
,
atomic_read
(
&
ses
->
inUse
),
i
,
ses
->
serverName
,
ses
->
serverDomain
,
atomic_read
(
&
ses
->
inUse
),
ses
->
serverOS
,
ses
->
serverNOS
,
ses
->
capabilities
);
ses
->
serverOS
,
ses
->
serverNOS
,
ses
->
capabilities
,
ses
->
status
,
ses
->
server
->
tcpStatus
);
buf
+=
length
;
buf
+=
length
;
if
(
ses
->
server
)
if
(
ses
->
server
)
buf
+=
sprintf
(
buf
,
"
\t
Local Users To Same Server: %d SecMode: 0x%x"
,
buf
+=
sprintf
(
buf
,
"
\
n\
t
Local Users To Same Server: %d SecMode: 0x%x"
,
atomic_read
(
&
ses
->
server
->
socketUseCount
),
ses
->
server
->
secMode
);
atomic_read
(
&
ses
->
server
->
socketUseCount
),
ses
->
server
->
secMode
);
}
}
read_unlock
(
&
GlobalSMBSeslock
);
read_unlock
(
&
GlobalSMBSeslock
);
...
@@ -106,13 +106,13 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
...
@@ -106,13 +106,13 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
tcon
=
list_entry
(
tmp
,
struct
cifsTconInfo
,
cifsConnectionList
);
tcon
=
list_entry
(
tmp
,
struct
cifsTconInfo
,
cifsConnectionList
);
length
=
length
=
sprintf
(
buf
,
sprintf
(
buf
,
"
\n
%d) %s Uses: %d on FS: %s with characteristics: 0x%x Attributes: 0x%x
\n\t
PathComponentMax: %d"
,
"
\n
%d) %s Uses: %d on FS: %s with characteristics: 0x%x Attributes: 0x%x
\n\t
PathComponentMax: %d
Status: %d
"
,
i
,
tcon
->
treeName
,
i
,
tcon
->
treeName
,
atomic_read
(
&
tcon
->
useCount
),
atomic_read
(
&
tcon
->
useCount
),
tcon
->
nativeFileSystem
,
tcon
->
nativeFileSystem
,
tcon
->
fsDevInfo
.
DeviceCharacteristics
,
tcon
->
fsDevInfo
.
DeviceCharacteristics
,
tcon
->
fsAttrInfo
.
Attributes
,
tcon
->
fsAttrInfo
.
Attributes
,
tcon
->
fsAttrInfo
.
MaxPathNameComponentLength
);
tcon
->
fsAttrInfo
.
MaxPathNameComponentLength
,
tcon
->
tidStatus
);
buf
+=
length
;
buf
+=
length
;
if
(
tcon
->
fsDevInfo
.
DeviceType
==
FILE_DEVICE_DISK
)
if
(
tcon
->
fsDevInfo
.
DeviceType
==
FILE_DEVICE_DISK
)
length
=
sprintf
(
buf
,
" type: DISK "
);
length
=
sprintf
(
buf
,
" type: DISK "
);
...
@@ -123,6 +123,8 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
...
@@ -123,6 +123,8 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
sprintf
(
buf
,
" type: %d "
,
sprintf
(
buf
,
" type: %d "
,
tcon
->
fsDevInfo
.
DeviceType
);
tcon
->
fsDevInfo
.
DeviceType
);
buf
+=
length
;
buf
+=
length
;
if
(
tcon
->
tidStatus
==
CifsNeedReconnect
)
buf
+=
sprintf
(
buf
,
"
\t
DISCONNECTED "
);
}
}
read_unlock
(
&
GlobalSMBSeslock
);
read_unlock
(
&
GlobalSMBSeslock
);
length
=
sprintf
(
buf
,
"
\n
"
);
length
=
sprintf
(
buf
,
"
\n
"
);
...
...
fs/cifs/cifsencrypt.c
View file @
bb5a72ce
/*
/*
* fs/cifs/cifsencrypt.c
* fs/cifs/cifsencrypt.c
*
*
* Copyright (
c
) International Business Machines Corp., 2003
* Copyright (
C
) International Business Machines Corp., 2003
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* This library is free software; you can redistribute it and/or modify
* This library is free software; you can redistribute it and/or modify
...
@@ -64,13 +64,13 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct cifsSesInfo * ses,
...
@@ -64,13 +64,13 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct cifsSesInfo * ses,
if
((
le32_to_cpu
(
cifs_pdu
->
Flags2
)
&
SMBFLG2_SECURITY_SIGNATURE
)
==
0
)
if
((
le32_to_cpu
(
cifs_pdu
->
Flags2
)
&
SMBFLG2_SECURITY_SIGNATURE
)
==
0
)
return
rc
;
return
rc
;
write
_lock
(
&
GlobalMid_Lock
);
spin
_lock
(
&
GlobalMid_Lock
);
cifs_pdu
->
Signature
.
Sequence
.
SequenceNumber
=
cpu_to_le32
(
ses
->
sequence_number
);
cifs_pdu
->
Signature
.
Sequence
.
SequenceNumber
=
cpu_to_le32
(
ses
->
sequence_number
);
cifs_pdu
->
Signature
.
Sequence
.
Reserved
=
0
;
cifs_pdu
->
Signature
.
Sequence
.
Reserved
=
0
;
*
pexpected_response_sequence_number
=
ses
->
sequence_number
++
;
*
pexpected_response_sequence_number
=
ses
->
sequence_number
++
;
ses
->
sequence_number
++
;
ses
->
sequence_number
++
;
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
rc
=
cifs_calculate_signature
(
cifs_pdu
,
ses
->
mac_signing_key
,
smb_signature
);
rc
=
cifs_calculate_signature
(
cifs_pdu
,
ses
->
mac_signing_key
,
smb_signature
);
if
(
rc
)
if
(
rc
)
...
...
fs/cifs/cifsfs.c
View file @
bb5a72ce
/*
/*
* fs/cifs/cifsfs.c
* fs/cifs/cifsfs.c
*
*
* Copyright (
c) International Business Machines Corp., 2002
* Copyright (
C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* Common Internet FileSystem (CIFS) client
* Common Internet FileSystem (CIFS) client
...
@@ -81,7 +81,6 @@ cifs_read_super(struct super_block *sb, void *data,
...
@@ -81,7 +81,6 @@ cifs_read_super(struct super_block *sb, void *data,
cifs_sb
=
CIFS_SB
(
sb
);
cifs_sb
=
CIFS_SB
(
sb
);
if
(
cifs_sb
==
NULL
)
if
(
cifs_sb
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
cifs_sb
->
local_nls
=
load_nls_default
();
/* needed for ASCII cp to Unicode converts */
rc
=
cifs_mount
(
sb
,
cifs_sb
,
data
,
devname
);
rc
=
cifs_mount
(
sb
,
cifs_sb
,
data
,
devname
);
...
@@ -571,8 +570,6 @@ cifs_destroy_mids(void)
...
@@ -571,8 +570,6 @@ cifs_destroy_mids(void)
static
int
cifs_oplock_thread
(
void
*
dummyarg
)
static
int
cifs_oplock_thread
(
void
*
dummyarg
)
{
{
struct
list_head
*
tmp
;
struct
list_head
*
tmp1
;
struct
oplock_q_entry
*
oplock_item
;
struct
oplock_q_entry
*
oplock_item
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsTconInfo
*
pTcon
;
struct
inode
*
inode
;
struct
inode
*
inode
;
...
@@ -585,18 +582,21 @@ static int cifs_oplock_thread(void * dummyarg)
...
@@ -585,18 +582,21 @@ static int cifs_oplock_thread(void * dummyarg)
oplockThread
=
current
;
oplockThread
=
current
;
do
{
do
{
set_current_state
(
TASK_INTERRUPTIBLE
);
set_current_state
(
TASK_INTERRUPTIBLE
);
schedule_timeout
(
100
*
HZ
);
/* BB add missing code */
schedule_timeout
(
39
*
HZ
);
write_lock
(
&
GlobalMid_Lock
);
spin_lock
(
&
GlobalMid_Lock
);
list_for_each_safe
(
tmp
,
tmp1
,
&
GlobalOplock_Q
)
{
if
(
list_empty
(
&
GlobalOplock_Q
))
{
oplock_item
=
list_entry
(
tmp
,
struct
oplock_q_entry
,
spin_unlock
(
&
GlobalMid_Lock
);
qhead
);
schedule_timeout
(
39
*
HZ
);
}
else
{
oplock_item
=
list_entry
(
GlobalOplock_Q
.
next
,
struct
oplock_q_entry
,
qhead
);
if
(
oplock_item
)
{
if
(
oplock_item
)
{
pTcon
=
oplock_item
->
tcon
;
pTcon
=
oplock_item
->
tcon
;
inode
=
oplock_item
->
pinode
;
inode
=
oplock_item
->
pinode
;
netfid
=
oplock_item
->
netfid
;
netfid
=
oplock_item
->
netfid
;
spin_unlock
(
&
GlobalMid_Lock
);
DeleteOplockQEntry
(
oplock_item
);
DeleteOplockQEntry
(
oplock_item
);
write_unlock
(
&
GlobalMid_Lock
);
if
(
S_ISREG
(
inode
->
i_mode
))
if
(
S_ISREG
(
inode
->
i_mode
))
rc
=
filemap_fdatawrite
(
inode
->
i_mapping
);
rc
=
filemap_fdatawrite
(
inode
->
i_mapping
);
else
else
...
@@ -609,11 +609,9 @@ static int cifs_oplock_thread(void * dummyarg)
...
@@ -609,11 +609,9 @@ static int cifs_oplock_thread(void * dummyarg)
0
,
LOCKING_ANDX_OPLOCK_RELEASE
,
0
,
LOCKING_ANDX_OPLOCK_RELEASE
,
0
/* wait flag */
);
0
/* wait flag */
);
cFYI
(
1
,(
"Oplock release rc = %d "
,
rc
));
cFYI
(
1
,(
"Oplock release rc = %d "
,
rc
));
write_lock
(
&
GlobalMid_Lock
);
}
else
}
else
break
;
spin_unlock
(
&
GlobalMid_Lock
)
;
}
}
write_unlock
(
&
GlobalMid_Lock
);
}
while
(
!
signal_pending
(
current
));
}
while
(
!
signal_pending
(
current
));
complete_and_exit
(
&
cifs_oplock_exited
,
0
);
complete_and_exit
(
&
cifs_oplock_exited
,
0
);
}
}
...
@@ -640,7 +638,7 @@ init_cifs(void)
...
@@ -640,7 +638,7 @@ init_cifs(void)
GlobalTotalActiveXid
=
0
;
GlobalTotalActiveXid
=
0
;
GlobalMaxActiveXid
=
0
;
GlobalMaxActiveXid
=
0
;
GlobalSMBSeslock
=
RW_LOCK_UNLOCKED
;
GlobalSMBSeslock
=
RW_LOCK_UNLOCKED
;
GlobalMid_Lock
=
RW
_LOCK_UNLOCKED
;
GlobalMid_Lock
=
SPIN
_LOCK_UNLOCKED
;
rc
=
cifs_init_inodecache
();
rc
=
cifs_init_inodecache
();
if
(
!
rc
)
{
if
(
!
rc
)
{
...
...
fs/cifs/cifsglob.h
View file @
bb5a72ce
/*
/*
* fs/cifs/cifsglob.h
* fs/cifs/cifsglob.h
*
*
* Copyright (
c) International Business Machines Corp., 2002
* Copyright (
C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* This library is free software; you can redistribute it and/or modify
* This library is free software; you can redistribute it and/or modify
...
@@ -212,6 +212,7 @@ struct cifsFileInfo {
...
@@ -212,6 +212,7 @@ struct cifsFileInfo {
int
endOfSearch
:
1
;
/* we have reached end of search */
int
endOfSearch
:
1
;
/* we have reached end of search */
int
closePend
:
1
;
/* file is marked to close */
int
closePend
:
1
;
/* file is marked to close */
int
emptyDir
:
1
;
int
emptyDir
:
1
;
int
invalidHandle
:
1
;
/* file closed via session abend */
char
*
search_resume_name
;
char
*
search_resume_name
;
unsigned
int
resume_name_length
;
unsigned
int
resume_name_length
;
__u32
resume_key
;
__u32
resume_key
;
...
@@ -294,7 +295,27 @@ struct servers_not_supported { /* @z4a */
...
@@ -294,7 +295,27 @@ struct servers_not_supported { /* @z4a */
* following to be declared.
* following to be declared.
*/
*/
/* BB Every global should have an associated mutex for safe update BB */
/****************************************************************************
* Locking notes. All updates to global variables and lists should be
* protected by spinlocks or semaphores.
*
* Spinlocks
* ---------
* GlobalMid_Lock protects:
* list operations on pending_mid_q and oplockQ
* updates to XID counters, multiplex id and SMB sequence numbers
* GlobalSMBSesLock protects:
* list operations on tcp and SMB session lists and tCon lists
* f_owner.lock protects certain per file struct operations
* mapping->page_lock protects certain per page operations
*
* Semaphores
* ----------
* sesSem operations on smb session
* tconSem operations on tree connection
* i_sem inode operations
*
****************************************************************************/
#ifdef DECLARE_GLOBALS_HERE
#ifdef DECLARE_GLOBALS_HERE
#define GLOBAL_EXTERN
#define GLOBAL_EXTERN
...
@@ -327,7 +348,7 @@ GLOBAL_EXTERN struct list_head GlobalOplock_Q;
...
@@ -327,7 +348,7 @@ GLOBAL_EXTERN struct list_head GlobalOplock_Q;
GLOBAL_EXTERN
unsigned
int
GlobalCurrentXid
;
/* protected by GlobalMid_Sem */
GLOBAL_EXTERN
unsigned
int
GlobalCurrentXid
;
/* protected by GlobalMid_Sem */
GLOBAL_EXTERN
unsigned
int
GlobalTotalActiveXid
;
/* prot by GlobalMid_Sem */
GLOBAL_EXTERN
unsigned
int
GlobalTotalActiveXid
;
/* prot by GlobalMid_Sem */
GLOBAL_EXTERN
unsigned
int
GlobalMaxActiveXid
;
/* prot by GlobalMid_Sem */
GLOBAL_EXTERN
unsigned
int
GlobalMaxActiveXid
;
/* prot by GlobalMid_Sem */
GLOBAL_EXTERN
rw
lock_t
GlobalMid_Lock
;
/* protects above and list operations */
GLOBAL_EXTERN
spin
lock_t
GlobalMid_Lock
;
/* protects above and list operations */
/* on midQ entries */
/* on midQ entries */
GLOBAL_EXTERN
char
Local_System_Name
[
15
];
GLOBAL_EXTERN
char
Local_System_Name
[
15
];
...
...
fs/cifs/cifssmb.c
View file @
bb5a72ce
...
@@ -62,6 +62,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
...
@@ -62,6 +62,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
if
(
!
rc
)
if
(
!
rc
)
reopen_files
(
tcon
,
nls_codepage
);
reopen_files
(
tcon
,
nls_codepage
);
}
}
unload_nls
(
nls_codepage
);
}
}
}
}
if
(
rc
)
if
(
rc
)
...
@@ -821,7 +822,6 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
...
@@ -821,7 +822,6 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
}
else
{
}
else
{
len_of_str
=
cifs_strtoUCS
((
wchar_t
*
)
rename_info
->
target_name
,
target_name
,
530
,
nls_codepage
);
len_of_str
=
cifs_strtoUCS
((
wchar_t
*
)
rename_info
->
target_name
,
target_name
,
530
,
nls_codepage
);
}
}
cFYI
(
1
,(
"len of str: %d"
,
len_of_str
));
/* BB removeme BB */
rename_info
->
target_name_len
=
cpu_to_le32
(
2
*
len_of_str
);
rename_info
->
target_name_len
=
cpu_to_le32
(
2
*
len_of_str
);
pSMB
->
DataCount
=
12
/* sizeof(struct set_file_rename) */
+
(
2
*
len_of_str
)
+
2
;
pSMB
->
DataCount
=
12
/* sizeof(struct set_file_rename) */
+
(
2
*
len_of_str
)
+
2
;
pSMB
->
ByteCount
+=
pSMB
->
DataCount
;
pSMB
->
ByteCount
+=
pSMB
->
DataCount
;
...
...
fs/cifs/connect.c
View file @
bb5a72ce
/*
/*
* fs/cifs/connect.c
* fs/cifs/connect.c
*
*
* Copyright (
c) International Business Machines Corp., 2002
* Copyright (
C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* This library is free software; you can redistribute it and/or modify
* This library is free software; you can redistribute it and/or modify
...
@@ -52,6 +52,8 @@ struct smb_vol {
...
@@ -52,6 +52,8 @@ struct smb_vol {
char
*
domainname
;
char
*
domainname
;
char
*
UNC
;
char
*
UNC
;
char
*
UNCip
;
char
*
UNCip
;
char
*
iocharset
;
/* local code page for mapping to and from Unicode */
char
*
source_rfc1001_name
;
/* netbios name of client */
uid_t
linux_uid
;
uid_t
linux_uid
;
gid_t
linux_gid
;
gid_t
linux_gid
;
mode_t
file_mode
;
mode_t
file_mode
;
...
@@ -59,6 +61,7 @@ struct smb_vol {
...
@@ -59,6 +61,7 @@ struct smb_vol {
int
rw
;
int
rw
;
unsigned
int
rsize
;
unsigned
int
rsize
;
unsigned
int
wsize
;
unsigned
int
wsize
;
unsigned
int
sockopt
;
unsigned
short
int
port
;
unsigned
short
int
port
;
};
};
...
@@ -82,6 +85,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
...
@@ -82,6 +85,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
struct
cifsSesInfo
*
ses
;
struct
cifsSesInfo
*
ses
;
struct
cifsTconInfo
*
tcon
;
struct
cifsTconInfo
*
tcon
;
if
(
server
->
tcpStatus
==
CifsExiting
)
return
rc
;
server
->
tcpStatus
=
CifsNeedReconnect
;
server
->
tcpStatus
=
CifsNeedReconnect
;
server
->
maxBuf
=
0
;
server
->
maxBuf
=
0
;
...
@@ -182,23 +187,26 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -182,23 +187,26 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
sizeof
(
struct
smb_hdr
)
-
sizeof
(
struct
smb_hdr
)
-
1
/* RFC1001 header and SMB header */
,
1
/* RFC1001 header and SMB header */
,
MSG_PEEK
/* flags see socket.h */
);
MSG_PEEK
/* flags see socket.h */
);
if
(
length
<
0
)
{
if
(
length
==
-
ECONNRESET
)
{
if
(
server
->
tcpStatus
==
CifsExiting
)
{
cERROR
(
1
,
(
"Connection reset by peer "
));
break
;
}
else
if
(
server
->
tcpStatus
==
CifsNeedReconnect
)
{
cFYI
(
1
,(
"Reconnecting after server stopped responding"
));
cifs_reconnect
(
server
);
cifs_reconnect
(
server
);
csocket
=
server
->
ssocket
;
csocket
=
server
->
ssocket
;
continue
;
continue
;
}
else
{
/* find define for the -512 returned at unmount time */
}
else
if
((
length
==
-
ERESTARTSYS
)
||
(
length
==
-
EAGAIN
))
{
cFYI
(
1
,(
"Error on sock_recvmsg(peek) length = %d"
,
schedule_timeout
(
1
);
/* minimum sleep to prevent looping
length
));
allowing socket to clear and app threads to set
}
tcpStatus CifsNeedReconnect if server hung */
break
;
continue
;
}
else
if
(
length
=
=
0
)
{
}
else
if
(
length
<
=
0
)
{
cFYI
(
1
,(
"
Zero length peek received - dead session?
"
));
cFYI
(
1
,(
"
Reconnecting after unexpected rcvmsg error
"
));
cifs_reconnect
(
server
);
cifs_reconnect
(
server
);
csocket
=
server
->
ssocket
;
csocket
=
server
->
ssocket
;
continue
;
continue
;
}
}
pdu_length
=
4
+
ntohl
(
smb_buffer
->
smb_buf_length
);
pdu_length
=
4
+
ntohl
(
smb_buffer
->
smb_buf_length
);
cFYI
(
1
,
(
"Peek length rcvd: %d with smb length: %d"
,
length
,
pdu_length
));
cFYI
(
1
,
(
"Peek length rcvd: %d with smb length: %d"
,
length
,
pdu_length
));
...
@@ -222,7 +230,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -222,7 +230,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
cERROR
(
1
,
cERROR
(
1
,
(
"Unknown RFC 1001 frame received not 0x00 nor 0x85"
));
(
"Unknown RFC 1001 frame received not 0x00 nor 0x85"
));
cifs_dump_mem
(
" Received Data is: "
,
temp
,
length
);
cifs_dump_mem
(
" Received Data is: "
,
temp
,
length
);
break
;
cifs_reconnect
(
server
);
csocket
=
server
->
ssocket
;
continue
;
}
else
{
}
else
{
if
((
length
!=
sizeof
(
struct
smb_hdr
)
-
1
)
if
((
length
!=
sizeof
(
struct
smb_hdr
)
-
1
)
||
(
pdu_length
>
||
(
pdu_length
>
...
@@ -236,11 +246,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -236,11 +246,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
(
"Invalid size or format for SMB found with length %d and pdu_lenght %d"
,
(
"Invalid size or format for SMB found with length %d and pdu_lenght %d"
,
length
,
pdu_length
));
length
,
pdu_length
));
cifs_dump_mem
(
"Received Data is: "
,
temp
,
sizeof
(
struct
smb_hdr
));
cifs_dump_mem
(
"Received Data is: "
,
temp
,
sizeof
(
struct
smb_hdr
));
/* BB fix by finding next smb signature - and reading off data until next smb ? BB */
/* could we fix this network corruption by finding next
smb header (instead of killing the session) and
/* BB add reconnect here */
restart reading from next valid SMB found? */
cifs_reconnect
(
server
);
break
;
csocket
=
server
->
ssocket
;
continue
;
}
else
{
/* length ok */
}
else
{
/* length ok */
length
=
0
;
length
=
0
;
...
@@ -248,18 +259,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -248,18 +259,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
iov
.
iov_len
=
pdu_length
;
iov
.
iov_len
=
pdu_length
;
for
(
total_read
=
0
;
total_read
<
pdu_length
;
total_read
+=
length
)
{
for
(
total_read
=
0
;
total_read
<
pdu_length
;
total_read
+=
length
)
{
/* Should improve check for buffer overflow with bad pdu_length */
/* Should improve check for buffer overflow with bad pdu_length */
/* iov.iov_base = smb_buffer+total_read;
iov.iov_len = pdu_length-total_read; */
length
=
sock_recvmsg
(
csocket
,
&
smb_msg
,
length
=
sock_recvmsg
(
csocket
,
&
smb_msg
,
pdu_length
-
total_read
,
0
);
pdu_length
-
total_read
,
0
);
/* cERROR(1,("For iovlen %d Length received: %d with total read %d",
iov.iov_len, length,total_read)); */
if
(
length
==
0
)
{
if
(
length
==
0
)
{
cERROR
(
1
,
cERROR
(
1
,
(
"Zero length receive when expecting %d "
,
(
"Zero length receive when expecting %d "
,
pdu_length
-
total_read
));
pdu_length
-
total_read
));
/* BB add reconnect here */
cifs_reconnect
(
server
);
break
;
csocket
=
server
->
ssocket
;
continue
;
}
}
}
}
}
}
...
@@ -272,7 +280,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -272,7 +280,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
}
}
task_to_wake
=
NULL
;
task_to_wake
=
NULL
;
read
_lock
(
&
GlobalMid_Lock
);
spin
_lock
(
&
GlobalMid_Lock
);
list_for_each
(
tmp
,
&
server
->
pending_mid_q
)
{
list_for_each
(
tmp
,
&
server
->
pending_mid_q
)
{
mid_entry
=
list_entry
(
tmp
,
struct
mid_entry
=
list_entry
(
tmp
,
struct
mid_q_entry
,
mid_q_entry
,
...
@@ -288,7 +296,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -288,7 +296,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
MID_RESPONSE_RECEIVED
;
MID_RESPONSE_RECEIVED
;
}
}
}
}
read
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
if
(
task_to_wake
)
{
if
(
task_to_wake
)
{
smb_buffer
=
NULL
;
/* will be freed by users thread after he is done */
smb_buffer
=
NULL
;
/* will be freed by users thread after he is done */
wake_up_process
(
task_to_wake
);
wake_up_process
(
task_to_wake
);
...
@@ -432,6 +440,20 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
...
@@ -432,6 +440,20 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
printk
(
KERN_WARNING
"CIFS: domain name too long
\n
"
);
printk
(
KERN_WARNING
"CIFS: domain name too long
\n
"
);
return
1
;
return
1
;
}
}
}
else
if
(
strnicmp
(
data
,
"iocharset"
,
9
)
==
0
)
{
if
(
!
value
||
!*
value
)
{
printk
(
KERN_WARNING
"CIFS: invalid iocharset specified
\n
"
);
return
1
;
/* needs_arg; */
}
if
(
strnlen
(
value
,
65
)
<
65
)
{
if
(
strnicmp
(
value
,
"default"
,
7
))
vol
->
iocharset
=
value
;
/* if iocharset not set load_nls_default used by caller */
cFYI
(
1
,
(
"iocharset set to %s"
,
value
));
}
else
{
printk
(
KERN_WARNING
"CIFS: iocharset name too long.
\n
"
);
return
1
;
}
}
else
if
(
strnicmp
(
data
,
"uid"
,
3
)
==
0
)
{
}
else
if
(
strnicmp
(
data
,
"uid"
,
3
)
==
0
)
{
if
(
value
&&
*
value
)
{
if
(
value
&&
*
value
)
{
vol
->
linux_uid
=
vol
->
linux_uid
=
...
@@ -467,6 +489,19 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
...
@@ -467,6 +489,19 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
vol
->
wsize
=
vol
->
wsize
=
simple_strtoul
(
value
,
&
value
,
0
);
simple_strtoul
(
value
,
&
value
,
0
);
}
}
}
else
if
(
strnicmp
(
data
,
"sockopt"
,
5
)
==
0
)
{
if
(
value
&&
*
value
)
{
vol
->
sockopt
=
simple_strtoul
(
value
,
&
value
,
0
);
}
}
else
if
(
strnicmp
(
data
,
"netbiosname"
,
4
)
==
0
)
{
if
(
!
value
||
!*
value
)
{
vol
->
source_rfc1001_name
=
NULL
;
}
else
if
(
strnlen
(
value
,
17
)
<
17
)
{
vol
->
source_rfc1001_name
=
value
;
}
else
{
printk
(
KERN_WARNING
"CIFS: netbiosname too long (more than 15)
\n
"
);
}
}
else
if
(
strnicmp
(
data
,
"version"
,
3
)
==
0
)
{
}
else
if
(
strnicmp
(
data
,
"version"
,
3
)
==
0
)
{
/* ignore */
/* ignore */
}
else
if
(
strnicmp
(
data
,
"rw"
,
2
)
==
0
)
{
}
else
if
(
strnicmp
(
data
,
"rw"
,
2
)
==
0
)
{
...
@@ -728,7 +763,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket)
...
@@ -728,7 +763,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket)
*
csocket
=
NULL
;
*
csocket
=
NULL
;
return
rc
;
return
rc
;
}
else
{
}
else
{
/* BB other socket options to set KEEPALIVE,
timeouts?
NODELAY? */
/* BB other socket options to set KEEPALIVE, NODELAY? */
cFYI
(
1
,(
"Socket created"
));
cFYI
(
1
,(
"Socket created"
));
}
}
}
}
...
@@ -763,6 +798,11 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket)
...
@@ -763,6 +798,11 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket)
}
}
}
}
/* Eventually check for other socket options to change from
the default. sock_setsockopt not used because it expects
user space buffer */
(
*
csocket
)
->
sk
->
sk_rcvtimeo
=
8
*
HZ
;
return
rc
;
return
rc
;
}
}
...
@@ -863,6 +903,19 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
...
@@ -863,6 +903,19 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/* this is needed for ASCII cp to Unicode converts */
if
(
volume_info
.
iocharset
==
NULL
)
{
cifs_sb
->
local_nls
=
load_nls_default
();
/* load_nls_default can not return null */
}
else
{
cifs_sb
->
local_nls
=
load_nls
(
volume_info
.
iocharset
);
if
(
cifs_sb
->
local_nls
==
NULL
)
{
cERROR
(
1
,(
"CIFS mount error: iocharset %s not found"
,
volume_info
.
iocharset
));
FreeXid
(
xid
);
return
-
ELIBACC
;
}
}
existingCifsSes
=
existingCifsSes
=
find_tcp_session
(
sin_server
.
sin_addr
.
s_addr
,
find_tcp_session
(
sin_server
.
sin_addr
.
s_addr
,
volume_info
.
username
,
&
srvTcp
);
volume_info
.
username
,
&
srvTcp
);
...
@@ -999,6 +1052,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
...
@@ -999,6 +1052,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
/* on error free sesinfo and tcon struct if needed */
/* on error free sesinfo and tcon struct if needed */
if
(
rc
)
{
if
(
rc
)
{
if
(
atomic_read
(
&
srvTcp
->
socketUseCount
)
==
0
)
srvTcp
->
tcpStatus
=
CifsExiting
;
/* If find_unc succeeded then rc == 0 so we can not end */
/* If find_unc succeeded then rc == 0 so we can not end */
if
(
tcon
)
/* up here accidently freeing someone elses tcon struct */
if
(
tcon
)
/* up here accidently freeing someone elses tcon struct */
tconInfoFree
(
tcon
);
tconInfoFree
(
tcon
);
...
...
fs/cifs/dir.c
View file @
bb5a72ce
...
@@ -218,6 +218,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
...
@@ -218,6 +218,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
pCifsFile
->
netfid
=
fileHandle
;
pCifsFile
->
netfid
=
fileHandle
;
pCifsFile
->
pid
=
current
->
tgid
;
pCifsFile
->
pid
=
current
->
tgid
;
pCifsFile
->
pInode
=
newinode
;
pCifsFile
->
pInode
=
newinode
;
pCifsFile
->
invalidHandle
=
FALSE
;
pCifsFile
->
closePend
=
FALSE
;
/* pCifsFile->pfile = file; */
/* put in at open time */
/* pCifsFile->pfile = file; */
/* put in at open time */
write_lock
(
&
GlobalSMBSeslock
);
write_lock
(
&
GlobalSMBSeslock
);
list_add
(
&
pCifsFile
->
tlist
,
&
pTcon
->
openFileList
);
list_add
(
&
pCifsFile
->
tlist
,
&
pTcon
->
openFileList
);
...
...
fs/cifs/file.c
View file @
bb5a72ce
...
@@ -122,6 +122,12 @@ cifs_open(struct inode *inode, struct file *file)
...
@@ -122,6 +122,12 @@ cifs_open(struct inode *inode, struct file *file)
and calling get_inode_info with returned buf (at least
and calling get_inode_info with returned buf (at least
helps non-Unix server case */
helps non-Unix server case */
buf
=
kmalloc
(
sizeof
(
FILE_ALL_INFO
),
GFP_KERNEL
);
buf
=
kmalloc
(
sizeof
(
FILE_ALL_INFO
),
GFP_KERNEL
);
if
(
buf
==
0
)
{
if
(
full_path
)
kfree
(
full_path
);
FreeXid
(
xid
);
return
-
ENOMEM
;
}
rc
=
CIFSSMBOpen
(
xid
,
pTcon
,
full_path
,
disposition
,
desiredAccess
,
rc
=
CIFSSMBOpen
(
xid
,
pTcon
,
full_path
,
disposition
,
desiredAccess
,
CREATE_NOT_DIR
,
&
netfid
,
&
oplock
,
buf
,
cifs_sb
->
local_nls
);
CREATE_NOT_DIR
,
&
netfid
,
&
oplock
,
buf
,
cifs_sb
->
local_nls
);
if
(
rc
)
{
if
(
rc
)
{
...
@@ -138,6 +144,8 @@ cifs_open(struct inode *inode, struct file *file)
...
@@ -138,6 +144,8 @@ cifs_open(struct inode *inode, struct file *file)
pCifsFile
->
pid
=
current
->
pid
;
pCifsFile
->
pid
=
current
->
pid
;
pCifsFile
->
pfile
=
file
;
/* needed for writepage */
pCifsFile
->
pfile
=
file
;
/* needed for writepage */
pCifsFile
->
pInode
=
inode
;
pCifsFile
->
pInode
=
inode
;
pCifsFile
->
invalidHandle
=
FALSE
;
pCifsFile
->
closePend
=
FALSE
;
write_lock
(
&
file
->
f_owner
.
lock
);
write_lock
(
&
file
->
f_owner
.
lock
);
write_lock
(
&
GlobalSMBSeslock
);
write_lock
(
&
GlobalSMBSeslock
);
list_add
(
&
pCifsFile
->
tlist
,
&
pTcon
->
openFileList
);
list_add
(
&
pCifsFile
->
tlist
,
&
pTcon
->
openFileList
);
...
@@ -200,36 +208,143 @@ int relock_files(struct cifsFileInfo * cifsFile)
...
@@ -200,36 +208,143 @@ int relock_files(struct cifsFileInfo * cifsFile)
return
rc
;
return
rc
;
}
}
static
int
cifs_reopen_file
(
struct
inode
*
inode
,
struct
file
*
file
)
{
int
rc
=
-
EACCES
;
int
xid
,
oplock
;
struct
cifs_sb_info
*
cifs_sb
;
struct
cifsTconInfo
*
pTcon
;
struct
cifsFileInfo
*
pCifsFile
;
struct
cifsInodeInfo
*
pCifsInode
;
char
*
full_path
=
NULL
;
int
desiredAccess
=
0x20197
;
int
disposition
=
FILE_OPEN
;
__u16
netfid
;
FILE_ALL_INFO
*
buf
=
NULL
;
xid
=
GetXid
();
cifs_sb
=
CIFS_SB
(
inode
->
i_sb
);
pTcon
=
cifs_sb
->
tcon
;
full_path
=
build_path_from_dentry
(
file
->
f_dentry
);
cFYI
(
1
,
(
" inode = 0x%p file flags are 0x%x for %s"
,
inode
,
file
->
f_flags
,
full_path
));
if
((
file
->
f_flags
&
O_ACCMODE
)
==
O_RDONLY
)
desiredAccess
=
GENERIC_READ
;
else
if
((
file
->
f_flags
&
O_ACCMODE
)
==
O_WRONLY
)
desiredAccess
=
GENERIC_WRITE
;
else
if
((
file
->
f_flags
&
O_ACCMODE
)
==
O_RDWR
)
desiredAccess
=
GENERIC_ALL
;
if
(
oplockEnabled
)
oplock
=
REQ_OPLOCK
;
else
oplock
=
FALSE
;
/* BB pass O_SYNC flag through on file attributes .. BB */
/* Also refresh inode by passing in file_info buf returned by SMBOpen
and calling get_inode_info with returned buf (at least
helps non-Unix server case */
buf
=
kmalloc
(
sizeof
(
FILE_ALL_INFO
),
GFP_KERNEL
);
if
(
buf
==
0
)
{
if
(
full_path
)
kfree
(
full_path
);
FreeXid
(
xid
);
return
-
ENOMEM
;
}
rc
=
CIFSSMBOpen
(
xid
,
pTcon
,
full_path
,
disposition
,
desiredAccess
,
CREATE_NOT_DIR
,
&
netfid
,
&
oplock
,
buf
,
cifs_sb
->
local_nls
);
if
(
rc
)
{
cFYI
(
1
,
(
"cifs_open returned 0x%x "
,
rc
));
cFYI
(
1
,
(
"oplock: %d "
,
oplock
));
}
else
{
if
(
file
->
private_data
)
{
pCifsFile
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
pCifsFile
->
netfid
=
netfid
;
pCifsFile
->
invalidHandle
=
FALSE
;
pCifsInode
=
CIFS_I
(
file
->
f_dentry
->
d_inode
);
if
(
pCifsInode
)
{
if
(
pTcon
->
ses
->
capabilities
&
CAP_UNIX
)
rc
=
cifs_get_inode_info_unix
(
&
file
->
f_dentry
->
d_inode
,
full_path
,
inode
->
i_sb
);
else
rc
=
cifs_get_inode_info
(
&
file
->
f_dentry
->
d_inode
,
full_path
,
buf
,
inode
->
i_sb
);
if
(
oplock
==
OPLOCK_EXCLUSIVE
)
{
pCifsInode
->
clientCanCacheAll
=
TRUE
;
pCifsInode
->
clientCanCacheRead
=
TRUE
;
cFYI
(
1
,(
"Exclusive Oplock granted on inode %p"
,
file
->
f_dentry
->
d_inode
));
}
else
if
(
oplock
==
OPLOCK_READ
)
{
pCifsInode
->
clientCanCacheRead
=
TRUE
;
pCifsInode
->
clientCanCacheAll
=
FALSE
;
}
else
{
pCifsInode
->
clientCanCacheRead
=
FALSE
;
pCifsInode
->
clientCanCacheAll
=
FALSE
;
}
}
}
else
rc
=
-
EBADF
;
}
if
(
buf
)
kfree
(
buf
);
if
(
full_path
)
kfree
(
full_path
);
FreeXid
(
xid
);
return
rc
;
}
/* Try to reopen files that were closed when session to server was lost */
/* Try to reopen files that were closed when session to server was lost */
int
reopen_files
(
struct
cifsTconInfo
*
pTcon
,
struct
nls_table
*
nlsinfo
)
int
reopen_files
(
struct
cifsTconInfo
*
pTcon
,
struct
nls_table
*
nlsinfo
)
{
{
int
rc
=
0
;
int
rc
=
0
;
struct
cifsFileInfo
*
open_file
=
NULL
;
struct
cifsFileInfo
*
open_file
=
NULL
;
struct
file
*
file
=
NULL
;
struct
file
*
file
=
NULL
;
struct
list_head
*
tmp
;
struct
list_head
invalid_file_list
;
struct
list_head
*
tmp1
;
struct
list_head
*
tmp
;
struct
list_head
*
tmp1
;
/* list all files open on tree connection */
INIT_LIST_HEAD
(
&
invalid_file_list
);
read_lock
(
&
GlobalSMBSeslock
);
/* list all files open on tree connection and mark them invalid */
write_lock
(
&
GlobalSMBSeslock
);
list_for_each_safe
(
tmp
,
tmp1
,
&
pTcon
->
openFileList
)
{
list_for_each_safe
(
tmp
,
tmp1
,
&
pTcon
->
openFileList
)
{
open_file
=
list_entry
(
tmp
,
struct
cifsFileInfo
,
tlist
);
open_file
=
list_entry
(
tmp
,
struct
cifsFileInfo
,
tlist
);
if
(
open_file
)
{
if
(
open_file
)
{
if
(
open_file
->
search_resume_name
)
{
open_file
->
invalidHandle
=
TRUE
;
kfree
(
open_file
->
search_resume_name
);
list_move
(
&
open_file
->
tlist
,
&
invalid_file_list
);
}
}
/* reopen files */
list_for_each_safe
(
tmp
,
tmp1
,
&
invalid_file_list
)
{
/* BB need to fix above to check list end and skip entries we do not need to reopen */
open_file
=
list_entry
(
tmp
,
struct
cifsFileInfo
,
tlist
);
if
(
open_file
==
NULL
)
{
break
;
}
else
{
if
((
open_file
->
invalidHandle
==
FALSE
)
&&
(
open_file
->
closePend
==
FALSE
))
{
list_move
(
&
open_file
->
tlist
,
&
pTcon
->
openFileList
);
continue
;
}
}
file
=
open_file
->
pfile
;
file
=
open_file
->
pfile
;
list_del
(
&
open_file
->
flist
);
list_del
(
&
open_file
->
tlist
);
kfree
(
open_file
);
if
(
file
)
{
file
->
private_data
=
NULL
;
read_unlock
(
&
GlobalSMBSeslock
);
if
(
file
->
f_dentry
==
0
)
{
if
(
file
->
f_dentry
==
0
)
{
cFYI
(
1
,(
"Null dentry for file %p"
,
file
));
cFYI
(
1
,(
"Null dentry for file %p"
,
file
));
read_lock
(
&
GlobalSMBSeslock
);
}
else
{
}
else
{
rc
=
cifs_open
(
file
->
f_dentry
->
d_inode
,
file
);
write_unlock
(
&
GlobalSMBSeslock
);
read_lock
(
&
GlobalSMBSeslock
);
rc
=
cifs_reopen_file
(
file
->
f_dentry
->
d_inode
,
file
);
write_lock
(
&
GlobalSMBSeslock
);
if
(
file
->
private_data
==
NULL
)
{
tmp
=
invalid_file_list
.
next
;
tmp1
=
tmp
->
next
;
continue
;
}
list_move
(
&
open_file
->
tlist
,
&
pTcon
->
openFileList
);
if
(
rc
)
{
if
(
rc
)
{
cFYI
(
1
,(
"reconnecting file %s failed with %d"
,
cFYI
(
1
,(
"reconnecting file %s failed with %d"
,
file
->
f_dentry
->
d_name
.
name
,
rc
));
file
->
f_dentry
->
d_name
.
name
,
rc
));
...
@@ -240,8 +355,7 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo)
...
@@ -240,8 +355,7 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo)
}
}
}
}
}
}
}
write_unlock
(
&
GlobalSMBSeslock
);
read_unlock
(
&
GlobalSMBSeslock
);
return
rc
;
return
rc
;
}
}
...
@@ -260,11 +374,20 @@ cifs_close(struct inode *inode, struct file *file)
...
@@ -260,11 +374,20 @@ cifs_close(struct inode *inode, struct file *file)
cifs_sb
=
CIFS_SB
(
inode
->
i_sb
);
cifs_sb
=
CIFS_SB
(
inode
->
i_sb
);
pTcon
=
cifs_sb
->
tcon
;
pTcon
=
cifs_sb
->
tcon
;
if
(
pSMBFile
)
{
if
(
pSMBFile
)
{
pSMBFile
->
closePend
=
TRUE
;
write_lock
(
&
file
->
f_owner
.
lock
);
if
(
pTcon
)
{
/* no sense reconnecting to close a file that is
already closed */
if
(
pTcon
->
tidStatus
!=
CifsNeedReconnect
)
{
write_unlock
(
&
file
->
f_owner
.
lock
);
rc
=
CIFSSMBClose
(
xid
,
pTcon
,
pSMBFile
->
netfid
);
write_lock
(
&
file
->
f_owner
.
lock
);
write_lock
(
&
file
->
f_owner
.
lock
);
}
}
list_del
(
&
pSMBFile
->
flist
);
list_del
(
&
pSMBFile
->
flist
);
list_del
(
&
pSMBFile
->
tlist
);
list_del
(
&
pSMBFile
->
tlist
);
write_unlock
(
&
file
->
f_owner
.
lock
);
write_unlock
(
&
file
->
f_owner
.
lock
);
rc
=
CIFSSMBClose
(
xid
,
pTcon
,
pSMBFile
->
netfid
);
if
(
pSMBFile
->
search_resume_name
)
if
(
pSMBFile
->
search_resume_name
)
kfree
(
pSMBFile
->
search_resume_name
);
kfree
(
pSMBFile
->
search_resume_name
);
kfree
(
file
->
private_data
);
kfree
(
file
->
private_data
);
...
@@ -447,7 +570,6 @@ cifs_write(struct file * file, const char *write_data,
...
@@ -447,7 +570,6 @@ cifs_write(struct file * file, const char *write_data,
&
bytes_written
,
&
bytes_written
,
write_data
+
total_written
,
long_op
);
write_data
+
total_written
,
long_op
);
if
(
rc
||
(
bytes_written
==
0
))
{
if
(
rc
||
(
bytes_written
==
0
))
{
FreeXid
(
xid
);
if
(
total_written
)
if
(
total_written
)
break
;
break
;
else
{
else
{
...
@@ -492,7 +614,6 @@ cifs_partialpagewrite(struct page *page,unsigned from, unsigned to)
...
@@ -492,7 +614,6 @@ cifs_partialpagewrite(struct page *page,unsigned from, unsigned to)
/* figure out which file struct to use
/* figure out which file struct to use
if (file->private_data == NULL) {
if (file->private_data == NULL) {
kunmap(page);
FreeXid(xid);
FreeXid(xid);
return -EBADF;
return -EBADF;
}
}
...
@@ -546,6 +667,13 @@ cifs_partialpagewrite(struct page *page,unsigned from, unsigned to)
...
@@ -546,6 +667,13 @@ cifs_partialpagewrite(struct page *page,unsigned from, unsigned to)
}
else
if
(
bytes_written
<
0
)
{
}
else
if
(
bytes_written
<
0
)
{
rc
=
bytes_written
;
rc
=
bytes_written
;
}
}
break
;
/* now that we found a valid file handle
and tried to write to it we are done, no
sense continuing to loop looking for another */
}
if
(
tmp
->
next
==
NULL
)
{
cFYI
(
1
,(
"File instance %p removed"
,
tmp
));
break
;
}
}
}
}
read_unlock
(
&
GlobalSMBSeslock
);
read_unlock
(
&
GlobalSMBSeslock
);
...
@@ -836,6 +964,7 @@ cifs_readpages(struct file *file, struct address_space *mapping,
...
@@ -836,6 +964,7 @@ cifs_readpages(struct file *file, struct address_space *mapping,
for
(
i
=
0
;
i
<
num_pages
;)
{
for
(
i
=
0
;
i
<
num_pages
;)
{
spin_lock
(
&
mapping
->
page_lock
);
spin_lock
(
&
mapping
->
page_lock
);
if
(
list_empty
(
page_list
))
{
if
(
list_empty
(
page_list
))
{
spin_unlock
(
&
mapping
->
page_lock
);
break
;
break
;
}
}
page
=
list_entry
(
page_list
->
prev
,
struct
page
,
list
);
page
=
list_entry
(
page_list
->
prev
,
struct
page
,
list
);
...
@@ -1236,8 +1365,10 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
...
@@ -1236,8 +1365,10 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
rc
=
0
;
rc
=
0
;
break
;
break
;
}
}
}
else
}
else
{
cifsFile
->
invalidHandle
=
TRUE
;
CIFSFindClose
(
xid
,
pTcon
,
cifsFile
->
netfid
);
CIFSFindClose
(
xid
,
pTcon
,
cifsFile
->
netfid
);
}
if
(
cifsFile
->
search_resume_name
)
{
if
(
cifsFile
->
search_resume_name
)
{
kfree
(
cifsFile
->
search_resume_name
);
kfree
(
cifsFile
->
search_resume_name
);
cifsFile
->
search_resume_name
=
NULL
;
cifsFile
->
search_resume_name
=
NULL
;
...
@@ -1261,6 +1392,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
...
@@ -1261,6 +1392,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
cifsFile
=
cifsFile
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
(
struct
cifsFileInfo
*
)
file
->
private_data
;
cifsFile
->
netfid
=
searchHandle
;
cifsFile
->
netfid
=
searchHandle
;
cifsFile
->
invalidHandle
=
FALSE
;
}
else
{
}
else
{
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
break
;
break
;
...
...
fs/cifs/misc.c
View file @
bb5a72ce
/*
/*
* fs/cifs/misc.c
* fs/cifs/misc.c
*
*
* Copyright (
c
) International Business Machines Corp., 2002,2003
* Copyright (
C
) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* This library is free software; you can redistribute it and/or modify
* This library is free software; you can redistribute it and/or modify
...
@@ -42,23 +42,23 @@ _GetXid(void)
...
@@ -42,23 +42,23 @@ _GetXid(void)
{
{
unsigned
int
xid
;
unsigned
int
xid
;
write
_lock
(
&
GlobalMid_Lock
);
spin
_lock
(
&
GlobalMid_Lock
);
GlobalTotalActiveXid
++
;
GlobalTotalActiveXid
++
;
if
(
GlobalTotalActiveXid
>
GlobalMaxActiveXid
)
if
(
GlobalTotalActiveXid
>
GlobalMaxActiveXid
)
GlobalMaxActiveXid
=
GlobalTotalActiveXid
;
/* keep high water mark for number of simultaneous vfs ops in our filesystem */
GlobalMaxActiveXid
=
GlobalTotalActiveXid
;
/* keep high water mark for number of simultaneous vfs ops in our filesystem */
xid
=
GlobalCurrentXid
++
;
xid
=
GlobalCurrentXid
++
;
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
return
xid
;
return
xid
;
}
}
void
void
_FreeXid
(
unsigned
int
xid
)
_FreeXid
(
unsigned
int
xid
)
{
{
write
_lock
(
&
GlobalMid_Lock
);
spin
_lock
(
&
GlobalMid_Lock
);
/* if(GlobalTotalActiveXid == 0)
/* if(GlobalTotalActiveXid == 0)
BUG(); */
BUG(); */
GlobalTotalActiveXid
--
;
GlobalTotalActiveXid
--
;
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
}
}
struct
cifsSesInfo
*
struct
cifsSesInfo
*
...
@@ -217,10 +217,10 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
...
@@ -217,10 +217,10 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
buffer
->
Pid
=
tmp
&
0xFFFF
;
buffer
->
Pid
=
tmp
&
0xFFFF
;
tmp
>>=
16
;
tmp
>>=
16
;
buffer
->
PidHigh
=
tmp
&
0xFFFF
;
buffer
->
PidHigh
=
tmp
&
0xFFFF
;
write
_lock
(
&
GlobalMid_Lock
);
spin
_lock
(
&
GlobalMid_Lock
);
GlobalMid
++
;
GlobalMid
++
;
buffer
->
Mid
=
GlobalMid
;
buffer
->
Mid
=
GlobalMid
;
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
if
(
treeCon
)
{
if
(
treeCon
)
{
buffer
->
Tid
=
treeCon
->
tid
;
buffer
->
Tid
=
treeCon
->
tid
;
if
(
treeCon
->
ses
)
{
if
(
treeCon
->
ses
)
{
...
...
fs/cifs/smbdes.c
View file @
bb5a72ce
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
SMB authentication protocol
SMB authentication protocol
Copyright (C) Andrew Tridgell 1998
Copyright (C) Andrew Tridgell 1998
Modified by Steve French (sfrench@us.ibm.com) 2002
Modified by Steve French (sfrench@us.ibm.com) 2002
,2003
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
@@ -376,41 +376,3 @@ cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
...
@@ -376,41 +376,3 @@ cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
key2
[
0
]
=
key
[
7
];
key2
[
0
]
=
key
[
7
];
smbhash
(
out
+
8
,
in
+
8
,
key2
,
forw
);
smbhash
(
out
+
8
,
in
+
8
,
key2
,
forw
);
}
}
void
SamOEMhash
(
unsigned
char
*
data
,
unsigned
char
*
key
,
int
val
)
{
unsigned
char
s_box
[
256
];
unsigned
char
index_i
=
0
;
unsigned
char
index_j
=
0
;
unsigned
char
j
=
0
;
int
ind
;
for
(
ind
=
0
;
ind
<
256
;
ind
++
)
{
s_box
[
ind
]
=
(
unsigned
char
)
ind
;
}
for
(
ind
=
0
;
ind
<
256
;
ind
++
)
{
unsigned
char
tc
;
j
+=
(
s_box
[
ind
]
+
key
[
ind
%
16
]);
tc
=
s_box
[
ind
];
s_box
[
ind
]
=
s_box
[
j
];
s_box
[
j
]
=
tc
;
}
for
(
ind
=
0
;
ind
<
val
;
ind
++
)
{
unsigned
char
tc
;
unsigned
char
t
;
index_i
++
;
index_j
+=
s_box
[
index_i
];
tc
=
s_box
[
index_i
];
s_box
[
index_i
]
=
s_box
[
index_j
];
s_box
[
index_j
]
=
tc
;
t
=
s_box
[
index_i
]
+
s_box
[
index_j
];
data
[
ind
]
=
data
[
ind
]
^
s_box
[
t
];
}
}
fs/cifs/smbencrypt.c
View file @
bb5a72ce
...
@@ -63,7 +63,6 @@ void cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key);
...
@@ -63,7 +63,6 @@ void cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key);
void
cred_hash2
(
unsigned
char
*
out
,
unsigned
char
*
in
,
unsigned
char
*
key
);
void
cred_hash2
(
unsigned
char
*
out
,
unsigned
char
*
in
,
unsigned
char
*
key
);
void
cred_hash3
(
unsigned
char
*
out
,
unsigned
char
*
in
,
unsigned
char
*
key
,
void
cred_hash3
(
unsigned
char
*
out
,
unsigned
char
*
in
,
unsigned
char
*
key
,
int
forw
);
int
forw
);
void
SamOEMhash
(
unsigned
char
*
data
,
unsigned
char
*
key
,
int
val
);
/*The following definitions come from libsmb/smbencrypt.c */
/*The following definitions come from libsmb/smbencrypt.c */
...
@@ -75,8 +74,6 @@ void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
...
@@ -75,8 +74,6 @@ void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
void
NTLMSSPOWFencrypt
(
unsigned
char
passwd
[
8
],
void
NTLMSSPOWFencrypt
(
unsigned
char
passwd
[
8
],
unsigned
char
*
ntlmchalresp
,
unsigned
char
p24
[
24
]);
unsigned
char
*
ntlmchalresp
,
unsigned
char
p24
[
24
]);
void
SMBNTencrypt
(
unsigned
char
*
passwd
,
unsigned
char
*
c8
,
unsigned
char
*
p24
);
void
SMBNTencrypt
(
unsigned
char
*
passwd
,
unsigned
char
*
c8
,
unsigned
char
*
p24
);
int
make_oem_passwd_hash
(
char
data
[
516
],
const
char
*
passwd
,
unsigned
char
old_pw_hash
[
16
],
int
unicode
);
int
decode_pw_buffer
(
char
in_buffer
[
516
],
char
*
new_pwrd
,
int
decode_pw_buffer
(
char
in_buffer
[
516
],
char
*
new_pwrd
,
int
new_pwrd_size
,
__u32
*
new_pw_len
);
int
new_pwrd_size
,
__u32
*
new_pw_len
);
...
@@ -346,46 +343,6 @@ static struct data_blob LMv2_generate_response(const unsigned char ntlm_v2_hash[
...
@@ -346,46 +343,6 @@ static struct data_blob LMv2_generate_response(const unsigned char ntlm_v2_hash[
return
final_response
;
return
final_response
;
}
}
int
make_oem_passwd_hash
(
char
data
[
516
],
const
char
*
passwd
,
unsigned
char
old_pw_hash
[
16
],
int
unicode
)
{
int
new_pw_len
=
strlen
(
passwd
)
*
(
unicode
?
2
:
1
);
if
(
new_pw_len
>
512
)
{
cERROR
(
1
,
(
"CIFS make_oem_passwd_hash: new password is too long."
));
return
FALSE
;
}
/*
* Now setup the data area.
* We need to generate a random fill
* for this area to make it harder to
* decrypt. JRA.
*
*/
get_random_bytes
(
data
,
sizeof
(
data
));
if
(
unicode
)
{
/* Note that passwd should be in DOS oem character set. */
/* dos_struni2( &data[512 - new_pw_len], passwd, 512); */
cifs_strtoUCS
((
wchar_t
*
)
&
data
[
512
-
new_pw_len
],
passwd
,
512
,
/* struct nls_table */
load_nls_default
());
/* BB call unload_nls now or get nls differntly */
}
else
{
/* Note that passwd should be in DOS oem character set. */
strcpy
(
&
data
[
512
-
new_pw_len
],
passwd
);
}
SIVAL
(
data
,
512
,
new_pw_len
);
#ifdef DEBUG_PASSWORD
DEBUG
(
100
,
(
"make_oem_passwd_hash
\n
"
));
dump_data
(
100
,
data
,
516
);
#endif
SamOEMhash
((
unsigned
char
*
)
data
,
(
unsigned
char
*
)
old_pw_hash
,
516
);
return
TRUE
;
}
void
void
SMBsesskeygen_ntv2
(
const
unsigned
char
kr
[
16
],
SMBsesskeygen_ntv2
(
const
unsigned
char
kr
[
16
],
const
unsigned
char
*
nt_resp
,
__u8
sess_key
[
16
])
const
unsigned
char
*
nt_resp
,
__u8
sess_key
[
16
])
...
...
fs/cifs/transport.c
View file @
bb5a72ce
/*
/*
* fs/cifs/transport.c
* fs/cifs/transport.c
*
*
* Copyright (
c) International Business Machines Corp., 2002
* Copyright (
C) International Business Machines Corp., 2002,2003
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* This library is free software; you can redistribute it and/or modify
* This library is free software; you can redistribute it and/or modify
...
@@ -39,7 +39,6 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
...
@@ -39,7 +39,6 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
struct
mid_q_entry
*
temp
;
struct
mid_q_entry
*
temp
;
int
timeout
=
10
*
HZ
;
int
timeout
=
10
*
HZ
;
/* BB add spinlock to protect midq for each session BB */
if
(
ses
==
NULL
)
{
if
(
ses
==
NULL
)
{
cERROR
(
1
,
(
"Null session passed in to AllocMidQEntry "
));
cERROR
(
1
,
(
"Null session passed in to AllocMidQEntry "
));
return
NULL
;
return
NULL
;
...
@@ -72,11 +71,11 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
...
@@ -72,11 +71,11 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
}
}
if
(
ses
->
server
->
tcpStatus
==
CifsGood
)
{
if
(
ses
->
server
->
tcpStatus
==
CifsGood
)
{
write
_lock
(
&
GlobalMid_Lock
);
spin
_lock
(
&
GlobalMid_Lock
);
list_add_tail
(
&
temp
->
qhead
,
&
ses
->
server
->
pending_mid_q
);
list_add_tail
(
&
temp
->
qhead
,
&
ses
->
server
->
pending_mid_q
);
atomic_inc
(
&
midCount
);
atomic_inc
(
&
midCount
);
temp
->
midState
=
MID_REQUEST_ALLOCATED
;
temp
->
midState
=
MID_REQUEST_ALLOCATED
;
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
}
else
{
}
else
{
cERROR
(
1
,(
"Need to reconnect after session died to server"
));
cERROR
(
1
,(
"Need to reconnect after session died to server"
));
if
(
temp
)
if
(
temp
)
...
@@ -89,12 +88,11 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
...
@@ -89,12 +88,11 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
void
void
DeleteMidQEntry
(
struct
mid_q_entry
*
midEntry
)
DeleteMidQEntry
(
struct
mid_q_entry
*
midEntry
)
{
{
/* BB add spinlock to protect midq for each session BB */
spin_lock
(
&
GlobalMid_Lock
);
write_lock
(
&
GlobalMid_Lock
);
midEntry
->
midState
=
MID_FREE
;
midEntry
->
midState
=
MID_FREE
;
list_del
(
&
midEntry
->
qhead
);
list_del
(
&
midEntry
->
qhead
);
atomic_dec
(
&
midCount
);
atomic_dec
(
&
midCount
);
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
buf_release
(
midEntry
->
resp_buf
);
buf_release
(
midEntry
->
resp_buf
);
kmem_cache_free
(
cifs_mid_cachep
,
midEntry
);
kmem_cache_free
(
cifs_mid_cachep
,
midEntry
);
}
}
...
@@ -115,9 +113,9 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
...
@@ -115,9 +113,9 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
temp
->
pinode
=
pinode
;
temp
->
pinode
=
pinode
;
temp
->
tcon
=
tcon
;
temp
->
tcon
=
tcon
;
temp
->
netfid
=
fid
;
temp
->
netfid
=
fid
;
write
_lock
(
&
GlobalMid_Lock
);
spin
_lock
(
&
GlobalMid_Lock
);
list_add_tail
(
&
temp
->
qhead
,
&
GlobalOplock_Q
);
list_add_tail
(
&
temp
->
qhead
,
&
GlobalOplock_Q
);
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
}
}
return
temp
;
return
temp
;
...
@@ -125,11 +123,10 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
...
@@ -125,11 +123,10 @@ AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon)
void
DeleteOplockQEntry
(
struct
oplock_q_entry
*
oplockEntry
)
void
DeleteOplockQEntry
(
struct
oplock_q_entry
*
oplockEntry
)
{
{
/* BB add spinlock to protect midq for each session BB */
spin_lock
(
&
GlobalMid_Lock
);
write_lock
(
&
GlobalMid_Lock
);
/* should we check if list empty first? */
/* should we check if list empty first? */
list_del
(
&
oplockEntry
->
qhead
);
list_del
(
&
oplockEntry
->
qhead
);
write
_unlock
(
&
GlobalMid_Lock
);
spin
_unlock
(
&
GlobalMid_Lock
);
kmem_cache_free
(
cifs_oplock_cachep
,
oplockEntry
);
kmem_cache_free
(
cifs_oplock_cachep
,
oplockEntry
);
}
}
...
@@ -240,6 +237,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -240,6 +237,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
else
{
else
{
cFYI
(
1
,(
"No response buffer"
));
cFYI
(
1
,(
"No response buffer"
));
DeleteMidQEntry
(
midQ
);
DeleteMidQEntry
(
midQ
);
ses
->
server
->
tcpStatus
=
CifsNeedReconnect
;
return
-
EIO
;
return
-
EIO
;
}
}
}
}
...
...
fs/nfsd/nfs3xdr.c
View file @
bb5a72ce
...
@@ -825,6 +825,8 @@ encode_entry(struct readdir_cd *ccd, const char *name,
...
@@ -825,6 +825,8 @@ encode_entry(struct readdir_cd *ccd, const char *name,
dchild
=
lookup_one_len
(
name
,
dparent
,
namlen
);
dchild
=
lookup_one_len
(
name
,
dparent
,
namlen
);
if
(
IS_ERR
(
dchild
))
if
(
IS_ERR
(
dchild
))
goto
noexec
;
goto
noexec
;
if
(
d_mountpoint
(
dchild
))
goto
noexec
;
if
(
fh_compose
(
&
fh
,
exp
,
dchild
,
&
cd
->
fh
)
!=
0
||
!
dchild
->
d_inode
)
if
(
fh_compose
(
&
fh
,
exp
,
dchild
,
&
cd
->
fh
)
!=
0
||
!
dchild
->
d_inode
)
goto
noexec
;
goto
noexec
;
p
=
encode_post_op_attr
(
cd
->
rqstp
,
p
,
&
fh
);
p
=
encode_post_op_attr
(
cd
->
rqstp
,
p
,
&
fh
);
...
...
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