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
6b0d1001
Commit
6b0d1001
authored
Mar 02, 2010
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pull from cifs-2.6 repo for 2.6.30
Implement WINE logic Fix losing locks during fork()
parent
434802b0
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
104 additions
and
29 deletions
+104
-29
cifs_fs_sb.h
sources/2.6.30/cifs_fs_sb.h
+1
-0
cifsfs.c
sources/2.6.30/cifsfs.c
+9
-1
cifsglob.h
sources/2.6.30/cifsglob.h
+2
-0
cifsproto.h
sources/2.6.30/cifsproto.h
+6
-6
cifssmb.c
sources/2.6.30/cifssmb.c
+15
-4
connect.c
sources/2.6.30/connect.c
+7
-0
dir.c
sources/2.6.30/dir.c
+2
-2
file.c
sources/2.6.30/file.c
+56
-12
inode.c
sources/2.6.30/inode.c
+6
-4
No files found.
sources/2.6.30/cifs_fs_sb.h
View file @
6b0d1001
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#define CIFS_MOUNT_DYNPERM 0x1000
/* allow in-memory only mode setting */
#define CIFS_MOUNT_DYNPERM 0x1000
/* allow in-memory only mode setting */
#define CIFS_MOUNT_NOPOSIXBRL 0x2000
/* mandatory not posix byte range lock */
#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_NOSSYNC 0x4000
/* don't do slow SMBflush on every sync*/
#define CIFS_MOUNT_WINE_MODE 0x8000
/* use pid forwarding for wine apps */
struct
cifs_sb_info
{
struct
cifs_sb_info
{
struct
cifsTconInfo
*
tcon
;
/* primary mount */
struct
cifsTconInfo
*
tcon
;
/* primary mount */
...
...
sources/2.6.30/cifsfs.c
View file @
6b0d1001
...
@@ -387,6 +387,10 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
...
@@ -387,6 +387,10 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
seq_printf
(
s
,
",nocase"
);
seq_printf
(
s
,
",nocase"
);
if
(
tcon
->
retry
)
if
(
tcon
->
retry
)
seq_printf
(
s
,
",hard"
);
seq_printf
(
s
,
",hard"
);
if
(
cifs_sb
->
tcon
->
unix_ext
)
seq_printf
(
s
,
",unix"
);
else
seq_printf
(
s
,
",nounix"
);
}
}
if
(
cifs_sb
->
prepath
)
if
(
cifs_sb
->
prepath
)
seq_printf
(
s
,
",prepath=%s"
,
cifs_sb
->
prepath
);
seq_printf
(
s
,
",prepath=%s"
,
cifs_sb
->
prepath
);
...
@@ -396,6 +400,10 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
...
@@ -396,6 +400,10 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
seq_printf
(
s
,
",setuids"
);
seq_printf
(
s
,
",setuids"
);
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_SERVER_INUM
)
seq_printf
(
s
,
",serverino"
);
seq_printf
(
s
,
",serverino"
);
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
)
seq_printf
(
s
,
",wine"
);
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NOPOSIXBRL
)
seq_printf
(
s
,
",forcemand"
);
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_DIRECT_IO
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_DIRECT_IO
)
seq_printf
(
s
,
",directio"
);
seq_printf
(
s
,
",directio"
);
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
...
@@ -638,7 +646,7 @@ static ssize_t cifs_sync_read(struct file *filp, char __user *buf, size_t len, l
...
@@ -638,7 +646,7 @@ static ssize_t cifs_sync_read(struct file *filp, char __user *buf, size_t len, l
return
-
ENOENT
;
return
-
ENOENT
;
if
(
!
CIFS_I
(
filp
->
f_path
.
dentry
->
d_inode
)
->
clientCanCacheRead
&&
!
posix_locking
)
{
if
(
!
CIFS_I
(
filp
->
f_path
.
dentry
->
d_inode
)
->
clientCanCacheRead
&&
!
posix_locking
)
{
retval
=
cifs_lock
(
filp
,
F_GETLK
,
&
pfLock
);
retval
=
cifs_lock
(
filp
,
F_GETLK
|
CIFS_NOPOSIXBRL_READ
,
&
pfLock
);
if
(
retval
<
0
)
if
(
retval
<
0
)
return
(
ssize_t
)
retval
;
return
(
ssize_t
)
retval
;
if
(
pfLock
.
fl_type
==
F_UNLCK
)
if
(
pfLock
.
fl_type
==
F_UNLCK
)
...
...
sources/2.6.30/cifsglob.h
View file @
6b0d1001
...
@@ -316,6 +316,8 @@ struct cifsLockInfo {
...
@@ -316,6 +316,8 @@ struct cifsLockInfo {
__u8
type
;
__u8
type
;
};
};
#define CIFS_NOPOSIXBRL_READ 64
/*
/*
* One of these for each open instance of a file
* One of these for each open instance of a file
*/
*/
...
...
sources/2.6.30/cifsproto.h
View file @
6b0d1001
...
@@ -290,16 +290,16 @@ extern int CIFSSMBFlush(const int xid, struct cifsTconInfo *tcon,
...
@@ -290,16 +290,16 @@ extern int CIFSSMBFlush(const int xid, struct cifsTconInfo *tcon,
const
int
smb_file_id
);
const
int
smb_file_id
);
extern
int
CIFSSMBRead
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
extern
int
CIFSSMBRead
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
int
netfid
,
unsigned
int
count
,
const
int
netfid
,
const
u32
netpid
,
unsigned
int
count
,
const
__u64
lseek
,
unsigned
int
*
nbytes
,
char
**
buf
,
const
__u64
lseek
,
unsigned
int
*
nbytes
,
char
**
buf
,
int
*
return_buf_type
);
int
*
return_buf_type
);
extern
int
CIFSSMBWrite
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
extern
int
CIFSSMBWrite
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
int
netfid
,
const
u
nsigned
int
count
,
const
int
netfid
,
const
u
32
netpid
,
const
__u64
lseek
,
unsigned
int
*
nbytes
,
const
unsigned
int
count
,
const
__u64
lseek
,
const
char
*
buf
,
const
char
__user
*
u
buf
,
unsigned
int
*
nbytes
,
const
char
*
buf
,
const
int
long_op
);
const
char
__user
*
ubuf
,
const
int
long_op
);
extern
int
CIFSSMBWrite2
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
extern
int
CIFSSMBWrite2
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
int
netfid
,
const
unsigned
int
count
,
const
int
netfid
,
const
u
32
netpid
,
const
u
nsigned
int
count
,
const
__u64
offset
,
unsigned
int
*
nbytes
,
const
__u64
offset
,
unsigned
int
*
nbytes
,
struct
kvec
*
iov
,
const
int
nvec
,
const
int
long_op
);
struct
kvec
*
iov
,
const
int
nvec
,
const
int
long_op
);
extern
int
CIFSGetSrvInodeNumber
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
extern
int
CIFSGetSrvInodeNumber
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
...
...
sources/2.6.30/cifssmb.c
View file @
6b0d1001
...
@@ -1381,8 +1381,8 @@ openRetry:
...
@@ -1381,8 +1381,8 @@ openRetry:
int
int
CIFSSMBRead
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
int
netfid
,
CIFSSMBRead
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
int
netfid
,
const
u
nsigned
int
count
,
const
__u64
lseek
,
unsigned
int
*
nbytes
,
const
u
32
netpid
,
const
unsigned
int
count
,
const
__u64
lseek
,
char
**
buf
,
int
*
pbuf_type
)
unsigned
int
*
nbytes
,
char
**
buf
,
int
*
pbuf_type
)
{
{
int
rc
=
-
EACCES
;
int
rc
=
-
EACCES
;
READ_REQ
*
pSMB
=
NULL
;
READ_REQ
*
pSMB
=
NULL
;
...
@@ -1408,6 +1408,9 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
...
@@ -1408,6 +1408,9 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
if
(
rc
)
if
(
rc
)
return
rc
;
return
rc
;
pSMB
->
hdr
.
Pid
=
cpu_to_le16
((
__u16
)
netpid
);
pSMB
->
hdr
.
PidHigh
=
cpu_to_le16
((
__u16
)(
netpid
>>
16
));
/* tcon and ses pointer are checked in smb_init */
/* tcon and ses pointer are checked in smb_init */
if
(
tcon
->
ses
->
server
==
NULL
)
if
(
tcon
->
ses
->
server
==
NULL
)
return
-
ECONNABORTED
;
return
-
ECONNABORTED
;
...
@@ -1486,7 +1489,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
...
@@ -1486,7 +1489,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
int
int
CIFSSMBWrite
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
CIFSSMBWrite
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
int
netfid
,
const
unsigned
int
count
,
const
int
netfid
,
const
u
32
netpid
,
const
u
nsigned
int
count
,
const
__u64
offset
,
unsigned
int
*
nbytes
,
const
char
*
buf
,
const
__u64
offset
,
unsigned
int
*
nbytes
,
const
char
*
buf
,
const
char
__user
*
ubuf
,
const
int
long_op
)
const
char
__user
*
ubuf
,
const
int
long_op
)
{
{
...
@@ -1515,6 +1518,10 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
...
@@ -1515,6 +1518,10 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
(
void
**
)
&
pSMBr
);
(
void
**
)
&
pSMBr
);
if
(
rc
)
if
(
rc
)
return
rc
;
return
rc
;
pSMB
->
hdr
.
Pid
=
cpu_to_le16
((
__u16
)
netpid
);
pSMB
->
hdr
.
PidHigh
=
cpu_to_le16
((
__u16
)(
netpid
>>
16
));
/* tcon and ses pointer are checked in smb_init */
/* tcon and ses pointer are checked in smb_init */
if
(
tcon
->
ses
->
server
==
NULL
)
if
(
tcon
->
ses
->
server
==
NULL
)
return
-
ECONNABORTED
;
return
-
ECONNABORTED
;
...
@@ -1596,7 +1603,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
...
@@ -1596,7 +1603,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
int
int
CIFSSMBWrite2
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
CIFSSMBWrite2
(
const
int
xid
,
struct
cifsTconInfo
*
tcon
,
const
int
netfid
,
const
unsigned
int
count
,
const
int
netfid
,
const
u
32
netpid
,
const
u
nsigned
int
count
,
const
__u64
offset
,
unsigned
int
*
nbytes
,
struct
kvec
*
iov
,
const
__u64
offset
,
unsigned
int
*
nbytes
,
struct
kvec
*
iov
,
int
n_vec
,
const
int
long_op
)
int
n_vec
,
const
int
long_op
)
{
{
...
@@ -1622,6 +1629,10 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
...
@@ -1622,6 +1629,10 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
rc
=
small_smb_init
(
SMB_COM_WRITE_ANDX
,
wct
,
tcon
,
(
void
**
)
&
pSMB
);
rc
=
small_smb_init
(
SMB_COM_WRITE_ANDX
,
wct
,
tcon
,
(
void
**
)
&
pSMB
);
if
(
rc
)
if
(
rc
)
return
rc
;
return
rc
;
pSMB
->
hdr
.
Pid
=
cpu_to_le16
((
__u16
)
netpid
);
pSMB
->
hdr
.
PidHigh
=
cpu_to_le16
((
__u16
)(
netpid
>>
16
));
/* tcon and ses pointer are checked in smb_init */
/* tcon and ses pointer are checked in smb_init */
if
(
tcon
->
ses
->
server
==
NULL
)
if
(
tcon
->
ses
->
server
==
NULL
)
return
-
ECONNABORTED
;
return
-
ECONNABORTED
;
...
...
sources/2.6.30/connect.c
View file @
6b0d1001
...
@@ -97,6 +97,7 @@ struct smb_vol {
...
@@ -97,6 +97,7 @@ struct smb_vol {
bool
noblocksnd
:
1
;
bool
noblocksnd
:
1
;
bool
noautotune
:
1
;
bool
noautotune
:
1
;
bool
nostrictsync
:
1
;
/* do not force expensive SMBflush on every sync */
bool
nostrictsync
:
1
;
/* do not force expensive SMBflush on every sync */
bool
wine_mode
:
1
;
unsigned
int
rsize
;
unsigned
int
rsize
;
unsigned
int
wsize
;
unsigned
int
wsize
;
unsigned
int
sockopt
;
unsigned
int
sockopt
;
...
@@ -1293,6 +1294,10 @@ cifs_parse_mount_options(char *options, const char *devname,
...
@@ -1293,6 +1294,10 @@ cifs_parse_mount_options(char *options, const char *devname,
vol
->
server_ino
=
1
;
vol
->
server_ino
=
1
;
}
else
if
(
strnicmp
(
data
,
"noserverino"
,
9
)
==
0
)
{
}
else
if
(
strnicmp
(
data
,
"noserverino"
,
9
)
==
0
)
{
vol
->
server_ino
=
0
;
vol
->
server_ino
=
0
;
}
else
if
(
strnicmp
(
data
,
"wine"
,
4
)
==
0
)
{
vol
->
wine_mode
=
1
;
vol
->
mand_lock
=
1
;
vol
->
direct_io
=
1
;
}
else
if
(
strnicmp
(
data
,
"cifsacl"
,
7
)
==
0
)
{
}
else
if
(
strnicmp
(
data
,
"cifsacl"
,
7
)
==
0
)
{
vol
->
cifs_acl
=
1
;
vol
->
cifs_acl
=
1
;
}
else
if
(
strnicmp
(
data
,
"nocifsacl"
,
9
)
==
0
)
{
}
else
if
(
strnicmp
(
data
,
"nocifsacl"
,
9
)
==
0
)
{
...
@@ -2183,6 +2188,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
...
@@ -2183,6 +2188,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_NOSSYNC
;
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_NOSSYNC
;
if
(
pvolume_info
->
mand_lock
)
if
(
pvolume_info
->
mand_lock
)
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_NOPOSIXBRL
;
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_NOPOSIXBRL
;
if
(
pvolume_info
->
wine_mode
)
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_WINE_MODE
;
if
(
pvolume_info
->
cifs_acl
)
if
(
pvolume_info
->
cifs_acl
)
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_CIFS_ACL
;
cifs_sb
->
mnt_cifs_flags
|=
CIFS_MOUNT_CIFS_ACL
;
if
(
pvolume_info
->
override_uid
)
if
(
pvolume_info
->
override_uid
)
...
...
sources/2.6.30/dir.c
View file @
6b0d1001
...
@@ -574,7 +574,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
...
@@ -574,7 +574,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
pdev
->
minor
=
pdev
->
minor
=
cpu_to_le64
(
MINOR
(
device_number
));
cpu_to_le64
(
MINOR
(
device_number
));
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
fileHandle
,
fileHandle
,
current
->
tgid
,
sizeof
(
struct
win_dev
),
sizeof
(
struct
win_dev
),
0
,
&
bytes_written
,
(
char
*
)
pdev
,
0
,
&
bytes_written
,
(
char
*
)
pdev
,
NULL
,
0
);
NULL
,
0
);
...
@@ -585,7 +585,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
...
@@ -585,7 +585,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
pdev
->
minor
=
pdev
->
minor
=
cpu_to_le64
(
MINOR
(
device_number
));
cpu_to_le64
(
MINOR
(
device_number
));
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
fileHandle
,
fileHandle
,
current
->
tgid
,
sizeof
(
struct
win_dev
),
sizeof
(
struct
win_dev
),
0
,
&
bytes_written
,
(
char
*
)
pdev
,
0
,
&
bytes_written
,
(
char
*
)
pdev
,
NULL
,
0
);
NULL
,
0
);
...
...
sources/2.6.30/file.c
View file @
6b0d1001
...
@@ -860,9 +860,16 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
...
@@ -860,9 +860,16 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
FreeXid
(
xid
);
FreeXid
(
xid
);
return
-
EBADF
;
return
-
EBADF
;
}
}
netpid
=
((
struct
cifsFileInfo
*
)
file
->
private_data
)
->
pid
;
netfid
=
((
struct
cifsFileInfo
*
)
file
->
private_data
)
->
netfid
;
netfid
=
((
struct
cifsFileInfo
*
)
file
->
private_data
)
->
netfid
;
if
((
cmd
&
CIFS_NOPOSIXBRL_READ
)
&&
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
))
netpid
=
((
struct
cifsFileInfo
*
)
file
->
private_data
)
->
pid
;
else
netpid
=
current
->
tgid
;
cmd
&=
~
CIFS_NOPOSIXBRL_READ
;
if
((
tcon
->
ses
->
capabilities
&
CAP_UNIX
)
&&
if
((
tcon
->
ses
->
capabilities
&
CAP_UNIX
)
&&
(
CIFS_UNIX_FCNTL_CAP
&
le64_to_cpu
(
tcon
->
fsUnixInfo
.
Capability
))
&&
(
CIFS_UNIX_FCNTL_CAP
&
le64_to_cpu
(
tcon
->
fsUnixInfo
.
Capability
))
&&
((
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NOPOSIXBRL
)
==
0
))
((
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NOPOSIXBRL
)
==
0
))
...
@@ -984,11 +991,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
...
@@ -984,11 +991,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
1
,
0
,
li
->
type
,
false
);
1
,
0
,
li
->
type
,
false
);
if
(
stored_rc
)
if
(
stored_rc
)
rc
=
stored_rc
;
rc
=
stored_rc
;
else
{
list_del
(
&
li
->
llist
);
list_del
(
&
li
->
llist
);
kfree
(
li
);
kfree
(
li
);
}
}
}
}
}
mutex_unlock
(
&
fid
->
lock_mutex
);
mutex_unlock
(
&
fid
->
lock_mutex
);
}
}
}
}
...
@@ -1044,6 +1052,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
...
@@ -1044,6 +1052,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
int
xid
,
long_op
;
int
xid
,
long_op
;
struct
cifsFileInfo
*
open_file
;
struct
cifsFileInfo
*
open_file
;
struct
cifsInodeInfo
*
cifsi
=
CIFS_I
(
file
->
f_path
.
dentry
->
d_inode
);
struct
cifsInodeInfo
*
cifsi
=
CIFS_I
(
file
->
f_path
.
dentry
->
d_inode
);
__u32
netpid
;
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
...
@@ -1057,6 +1066,11 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
...
@@ -1057,6 +1066,11 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
return
-
EBADF
;
return
-
EBADF
;
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
)
netpid
=
open_file
->
pid
;
else
netpid
=
current
->
tgid
;
rc
=
generic_write_checks
(
file
,
poffset
,
&
write_size
,
0
);
rc
=
generic_write_checks
(
file
,
poffset
,
&
write_size
,
0
);
if
(
rc
)
if
(
rc
)
return
rc
;
return
rc
;
...
@@ -1094,7 +1108,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
...
@@ -1094,7 +1108,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
}
}
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
open_file
->
netfid
,
open_file
->
netfid
,
netpid
,
min_t
(
const
int
,
cifs_sb
->
wsize
,
min_t
(
const
int
,
cifs_sb
->
wsize
,
write_size
-
total_written
),
write_size
-
total_written
),
*
poffset
,
&
bytes_written
,
*
poffset
,
&
bytes_written
,
...
@@ -1147,6 +1161,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
...
@@ -1147,6 +1161,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
int
xid
,
long_op
;
int
xid
,
long_op
;
struct
cifsFileInfo
*
open_file
;
struct
cifsFileInfo
*
open_file
;
struct
cifsInodeInfo
*
cifsi
=
CIFS_I
(
file
->
f_path
.
dentry
->
d_inode
);
struct
cifsInodeInfo
*
cifsi
=
CIFS_I
(
file
->
f_path
.
dentry
->
d_inode
);
__u32
netpid
;
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
...
@@ -1159,6 +1174,11 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
...
@@ -1159,6 +1174,11 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
return
-
EBADF
;
return
-
EBADF
;
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
)
netpid
=
open_file
->
pid
;
else
netpid
=
current
->
tgid
;
xid
=
GetXid
();
xid
=
GetXid
();
long_op
=
cifs_write_timeout
(
cifsi
,
*
poffset
);
long_op
=
cifs_write_timeout
(
cifsi
,
*
poffset
);
...
@@ -1205,12 +1225,13 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
...
@@ -1205,12 +1225,13 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
total_written
;
total_written
;
iov
[
1
].
iov_len
=
len
;
iov
[
1
].
iov_len
=
len
;
rc
=
CIFSSMBWrite2
(
xid
,
pTcon
,
rc
=
CIFSSMBWrite2
(
xid
,
pTcon
,
open_file
->
netfid
,
len
,
open_file
->
netfid
,
netpid
,
len
,
*
poffset
,
&
bytes_written
,
*
poffset
,
&
bytes_written
,
iov
,
1
,
long_op
);
iov
,
1
,
long_op
);
}
else
}
else
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
open_file
->
netfid
,
open_file
->
netfid
,
netpid
,
min_t
(
const
int
,
cifs_sb
->
wsize
,
min_t
(
const
int
,
cifs_sb
->
wsize
,
write_size
-
total_written
),
write_size
-
total_written
),
*
poffset
,
&
bytes_written
,
*
poffset
,
&
bytes_written
,
...
@@ -1446,6 +1467,7 @@ static int cifs_writepages(struct address_space *mapping,
...
@@ -1446,6 +1467,7 @@ static int cifs_writepages(struct address_space *mapping,
int
rc
=
0
;
int
rc
=
0
;
int
scanned
=
0
;
int
scanned
=
0
;
int
xid
,
long_op
;
int
xid
,
long_op
;
__u32
netpid
;
cifs_sb
=
CIFS_SB
(
mapping
->
host
->
i_sb
);
cifs_sb
=
CIFS_SB
(
mapping
->
host
->
i_sb
);
...
@@ -1585,13 +1607,18 @@ retry:
...
@@ -1585,13 +1607,18 @@ retry:
* we used to still be valid
* we used to still be valid
*/
*/
open_file
=
find_writable_file
(
CIFS_I
(
mapping
->
host
));
open_file
=
find_writable_file
(
CIFS_I
(
mapping
->
host
));
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
)
netpid
=
open_file
->
pid
;
else
netpid
=
current
->
tgid
;
if
(
!
open_file
)
{
if
(
!
open_file
)
{
cERROR
(
1
,
(
"No writable handles for inode"
));
cERROR
(
1
,
(
"No writable handles for inode"
));
rc
=
-
EBADF
;
rc
=
-
EBADF
;
}
else
{
}
else
{
long_op
=
cifs_write_timeout
(
cifsi
,
offset
);
long_op
=
cifs_write_timeout
(
cifsi
,
offset
);
rc
=
CIFSSMBWrite2
(
xid
,
cifs_sb
->
tcon
,
rc
=
CIFSSMBWrite2
(
xid
,
cifs_sb
->
tcon
,
open_file
->
netfid
,
open_file
->
netfid
,
netpid
,
bytes_to_write
,
offset
,
bytes_to_write
,
offset
,
&
bytes_written
,
iov
,
n_iov
,
&
bytes_written
,
iov
,
n_iov
,
long_op
);
long_op
);
...
@@ -1836,6 +1863,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
...
@@ -1836,6 +1863,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
char
*
smb_read_data
;
char
*
smb_read_data
;
char
__user
*
current_offset
;
char
__user
*
current_offset
;
struct
smb_com_read_rsp
*
pSMBr
;
struct
smb_com_read_rsp
*
pSMBr
;
__u32
netpid
;
xid
=
GetXid
();
xid
=
GetXid
();
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
...
@@ -1847,6 +1875,11 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
...
@@ -1847,6 +1875,11 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
}
}
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
)
netpid
=
open_file
->
pid
;
else
netpid
=
current
->
tgid
;
if
((
file
->
f_flags
&
O_ACCMODE
)
==
O_WRONLY
)
if
((
file
->
f_flags
&
O_ACCMODE
)
==
O_WRONLY
)
cFYI
(
1
,
(
"attempting read on write only file instance"
));
cFYI
(
1
,
(
"attempting read on write only file instance"
));
...
@@ -1866,7 +1899,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
...
@@ -1866,7 +1899,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
break
;
break
;
}
}
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
open_file
->
netfid
,
open_file
->
netfid
,
netpid
,
current_read_size
,
*
poffset
,
current_read_size
,
*
poffset
,
&
bytes_read
,
&
smb_read_data
,
&
bytes_read
,
&
smb_read_data
,
&
buf_type
);
&
buf_type
);
...
@@ -1916,6 +1949,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
...
@@ -1916,6 +1949,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
char
*
current_offset
;
char
*
current_offset
;
struct
cifsFileInfo
*
open_file
;
struct
cifsFileInfo
*
open_file
;
int
buf_type
=
CIFS_NO_BUFFER
;
int
buf_type
=
CIFS_NO_BUFFER
;
__u32
netpid
;
xid
=
GetXid
();
xid
=
GetXid
();
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
...
@@ -1927,6 +1961,11 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
...
@@ -1927,6 +1961,11 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
}
}
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
open_file
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
)
netpid
=
open_file
->
pid
;
else
netpid
=
current
->
tgid
;
if
((
file
->
f_flags
&
O_ACCMODE
)
==
O_WRONLY
)
if
((
file
->
f_flags
&
O_ACCMODE
)
==
O_WRONLY
)
cFYI
(
1
,
(
"attempting read on write only file instance"
));
cFYI
(
1
,
(
"attempting read on write only file instance"
));
...
@@ -1951,7 +1990,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
...
@@ -1951,7 +1990,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
break
;
break
;
}
}
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
open_file
->
netfid
,
open_file
->
netfid
,
netpid
,
current_read_size
,
*
poffset
,
current_read_size
,
*
poffset
,
&
bytes_read
,
&
current_offset
,
&
bytes_read
,
&
current_offset
,
&
buf_type
);
&
buf_type
);
...
@@ -2053,6 +2092,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
...
@@ -2053,6 +2092,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
struct
pagevec
lru_pvec
;
struct
pagevec
lru_pvec
;
struct
cifsFileInfo
*
open_file
;
struct
cifsFileInfo
*
open_file
;
int
buf_type
=
CIFS_NO_BUFFER
;
int
buf_type
=
CIFS_NO_BUFFER
;
__u32
netpid
;
xid
=
GetXid
();
xid
=
GetXid
();
if
(
file
->
private_data
==
NULL
)
{
if
(
file
->
private_data
==
NULL
)
{
...
@@ -2063,6 +2103,11 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
...
@@ -2063,6 +2103,11 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
pTcon
=
cifs_sb
->
tcon
;
pTcon
=
cifs_sb
->
tcon
;
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_WINE_MODE
)
netpid
=
open_file
->
pid
;
else
netpid
=
current
->
tgid
;
pagevec_init
(
&
lru_pvec
,
0
);
pagevec_init
(
&
lru_pvec
,
0
);
cFYI
(
DBG2
,
(
"rpages: num pages %d"
,
num_pages
));
cFYI
(
DBG2
,
(
"rpages: num pages %d"
,
num_pages
));
for
(
i
=
0
;
i
<
num_pages
;
)
{
for
(
i
=
0
;
i
<
num_pages
;
)
{
...
@@ -2109,10 +2154,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
...
@@ -2109,10 +2154,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
}
}
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
open_file
->
netfid
,
open_file
->
netfid
,
netpid
,
read_size
,
offset
,
read_size
,
offset
,
&
bytes_read
,
&
bytes_read
,
&
smb_read_data
,
&
smb_read_data
,
&
buf_type
);
&
buf_type
);
/* BB more RC checks ? */
/* BB more RC checks ? */
if
(
rc
==
-
EAGAIN
)
{
if
(
rc
==
-
EAGAIN
)
{
if
(
smb_read_data
)
{
if
(
smb_read_data
)
{
...
...
sources/2.6.30/inode.c
View file @
6b0d1001
...
@@ -337,7 +337,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size,
...
@@ -337,7 +337,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size,
int
buf_type
=
CIFS_NO_BUFFER
;
int
buf_type
=
CIFS_NO_BUFFER
;
/* Read header */
/* Read header */
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
rc
=
CIFSSMBRead
(
xid
,
pTcon
,
netfid
,
netfid
,
current
->
tgid
,
24
/* length */
,
0
/* offset */
,
24
/* length */
,
0
/* offset */
,
&
bytes_read
,
&
pbuf
,
&
buf_type
);
&
bytes_read
,
&
pbuf
,
&
buf_type
);
if
((
rc
==
0
)
&&
(
bytes_read
>=
8
))
{
if
((
rc
==
0
)
&&
(
bytes_read
>=
8
))
{
...
@@ -1722,8 +1722,9 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
...
@@ -1722,8 +1722,9 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
cFYI
(
1
,
(
"SetFSize for attrs rc = %d"
,
rc
));
cFYI
(
1
,
(
"SetFSize for attrs rc = %d"
,
rc
));
if
((
rc
==
-
EINVAL
)
||
(
rc
==
-
EOPNOTSUPP
))
{
if
((
rc
==
-
EINVAL
)
||
(
rc
==
-
EOPNOTSUPP
))
{
unsigned
int
bytes_written
;
unsigned
int
bytes_written
;
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
nfid
,
0
,
attrs
->
ia_size
,
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
nfid
,
npid
,
&
bytes_written
,
NULL
,
NULL
,
1
);
0
,
attrs
->
ia_size
,
&
bytes_written
,
NULL
,
NULL
,
1
);
cFYI
(
1
,
(
"Wrt seteof rc %d"
,
rc
));
cFYI
(
1
,
(
"Wrt seteof rc %d"
,
rc
));
}
}
}
else
}
else
...
@@ -1751,7 +1752,8 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
...
@@ -1751,7 +1752,8 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
CIFS_MOUNT_MAP_SPECIAL_CHR
);
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
rc
==
0
)
{
if
(
rc
==
0
)
{
unsigned
int
bytes_written
;
unsigned
int
bytes_written
;
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
netfid
,
0
,
rc
=
CIFSSMBWrite
(
xid
,
pTcon
,
netfid
,
current
->
tgid
,
0
,
attrs
->
ia_size
,
attrs
->
ia_size
,
&
bytes_written
,
NULL
,
&
bytes_written
,
NULL
,
NULL
,
1
);
NULL
,
1
);
...
...
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