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
a92129e1
Commit
a92129e1
authored
May 28, 2014
by
Pavel Shilovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 3.10 sources from stable (v3.10.40)
parent
b54f71cf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
141 additions
and
47 deletions
+141
-47
cifsacl.c
sources/3.10/cifsacl.c
+24
-4
cifsglob.h
sources/3.10/cifsglob.h
+10
-0
cifssmb.c
sources/3.10/cifssmb.c
+5
-3
file.c
sources/3.10/file.c
+34
-3
inode.c
sources/3.10/inode.c
+9
-4
smb1ops.c
sources/3.10/smb1ops.c
+8
-0
smb2glob.h
sources/3.10/smb2glob.h
+3
-0
smb2ops.c
sources/3.10/smb2ops.c
+4
-10
smb2pdu.c
sources/3.10/smb2pdu.c
+3
-0
xattr.c
sources/3.10/xattr.c
+41
-23
No files found.
sources/3.10/cifsacl.c
View file @
a92129e1
...
...
@@ -1029,15 +1029,30 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
__u32
secdesclen
=
0
;
struct
cifs_ntsd
*
pntsd
=
NULL
;
/* acl obtained from server */
struct
cifs_ntsd
*
pnntsd
=
NULL
;
/* modified acl to be sent to server */
struct
cifs_sb_info
*
cifs_sb
=
CIFS_SB
(
inode
->
i_sb
);
struct
tcon_link
*
tlink
=
cifs_sb_tlink
(
cifs_sb
);
struct
cifs_tcon
*
tcon
;
if
(
IS_ERR
(
tlink
))
return
PTR_ERR
(
tlink
);
tcon
=
tlink_tcon
(
tlink
);
cifs_dbg
(
NOISY
,
"set ACL from mode for %s
\n
"
,
path
);
/* Get the security descriptor */
pntsd
=
get_cifs_acl
(
CIFS_SB
(
inode
->
i_sb
),
inode
,
path
,
&
secdesclen
);
if
(
tcon
->
ses
->
server
->
ops
->
get_acl
==
NULL
)
{
cifs_put_tlink
(
tlink
);
return
-
EOPNOTSUPP
;
}
pntsd
=
tcon
->
ses
->
server
->
ops
->
get_acl
(
cifs_sb
,
inode
,
path
,
&
secdesclen
);
if
(
IS_ERR
(
pntsd
))
{
rc
=
PTR_ERR
(
pntsd
);
cifs_dbg
(
VFS
,
"%s: error %d getting sec desc
\n
"
,
__func__
,
rc
);
goto
out
;
cifs_put_tlink
(
tlink
);
return
rc
;
}
/*
...
...
@@ -1050,6 +1065,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
pnntsd
=
kmalloc
(
secdesclen
,
GFP_KERNEL
);
if
(
!
pnntsd
)
{
kfree
(
pntsd
);
cifs_put_tlink
(
tlink
);
return
-
ENOMEM
;
}
...
...
@@ -1058,14 +1074,18 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
cifs_dbg
(
NOISY
,
"build_sec_desc rc: %d
\n
"
,
rc
);
if
(
tcon
->
ses
->
server
->
ops
->
set_acl
==
NULL
)
rc
=
-
EOPNOTSUPP
;
if
(
!
rc
)
{
/* Set the security descriptor */
rc
=
set_cifs_acl
(
pnntsd
,
secdesclen
,
inode
,
path
,
aclflag
);
rc
=
tcon
->
ses
->
server
->
ops
->
set_acl
(
pnntsd
,
secdesclen
,
inode
,
path
,
aclflag
);
cifs_dbg
(
NOISY
,
"set_cifs_acl rc: %d
\n
"
,
rc
);
}
cifs_put_tlink
(
tlink
);
kfree
(
pnntsd
);
kfree
(
pntsd
);
out:
return
rc
;
}
sources/3.10/cifsglob.h
View file @
a92129e1
...
...
@@ -370,6 +370,16 @@ struct smb_version_operations {
void
(
*
new_lease_key
)(
struct
cifs_fid
*
fid
);
int
(
*
calc_signature
)(
struct
smb_rqst
*
rqst
,
struct
TCP_Server_Info
*
server
);
ssize_t
(
*
query_all_EAs
)(
const
unsigned
int
,
struct
cifs_tcon
*
,
const
unsigned
char
*
,
const
unsigned
char
*
,
char
*
,
size_t
,
const
struct
nls_table
*
,
int
);
int
(
*
set_EA
)(
const
unsigned
int
,
struct
cifs_tcon
*
,
const
char
*
,
const
char
*
,
const
void
*
,
const
__u16
,
const
struct
nls_table
*
,
int
);
struct
cifs_ntsd
*
(
*
get_acl
)(
struct
cifs_sb_info
*
,
struct
inode
*
,
const
char
*
,
u32
*
);
int
(
*
set_acl
)(
struct
cifs_ntsd
*
,
__u32
,
struct
inode
*
,
const
char
*
,
int
);
};
struct
smb_version_values
{
...
...
sources/3.10/cifssmb.c
View file @
a92129e1
...
...
@@ -3313,11 +3313,13 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
return
0
;
}
cifs_acl
->
version
=
cpu_to_le16
(
1
);
if
(
acl_type
==
ACL_TYPE_ACCESS
)
if
(
acl_type
==
ACL_TYPE_ACCESS
)
{
cifs_acl
->
access_entry_count
=
cpu_to_le16
(
count
);
else
if
(
acl_type
==
ACL_TYPE_DEFAULT
)
cifs_acl
->
default_entry_count
=
__constant_cpu_to_le16
(
0xFFFF
);
}
else
if
(
acl_type
==
ACL_TYPE_DEFAULT
)
{
cifs_acl
->
default_entry_count
=
cpu_to_le16
(
count
);
else
{
cifs_acl
->
access_entry_count
=
__constant_cpu_to_le16
(
0xFFFF
);
}
else
{
cifs_dbg
(
FYI
,
"unknown ACL type %d
\n
"
,
acl_type
);
return
0
;
}
...
...
sources/3.10/file.c
View file @
a92129e1
...
...
@@ -2359,7 +2359,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
unsigned
long
nr_segs
,
loff_t
*
poffset
)
{
unsigned
long
nr_pages
,
i
;
size_t
copied
,
len
,
cur_len
;
size_t
bytes
,
copied
,
len
,
cur_len
;
ssize_t
total_written
=
0
;
loff_t
offset
;
struct
iov_iter
it
;
...
...
@@ -2414,14 +2414,45 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
save_len
=
cur_len
;
for
(
i
=
0
;
i
<
nr_pages
;
i
++
)
{
copied
=
min_t
(
const
size_t
,
cur_len
,
PAGE_SIZE
);
bytes
=
min_t
(
const
size_t
,
cur_len
,
PAGE_SIZE
);
copied
=
iov_iter_copy_from_user
(
wdata
->
pages
[
i
],
&
it
,
0
,
copied
);
0
,
bytes
);
cur_len
-=
copied
;
iov_iter_advance
(
&
it
,
copied
);
/*
* If we didn't copy as much as we expected, then that
* may mean we trod into an unmapped area. Stop copying
* at that point. On the next pass through the big
* loop, we'll likely end up getting a zero-length
* write and bailing out of it.
*/
if
(
copied
<
bytes
)
break
;
}
cur_len
=
save_len
-
cur_len
;
/*
* If we have no data to send, then that probably means that
* the copy above failed altogether. That's most likely because
* the address in the iovec was bogus. Set the rc to -EFAULT,
* free anything we allocated and bail out.
*/
if
(
!
cur_len
)
{
for
(
i
=
0
;
i
<
nr_pages
;
i
++
)
put_page
(
wdata
->
pages
[
i
]);
kfree
(
wdata
);
rc
=
-
EFAULT
;
break
;
}
/*
* i + 1 now represents the number of pages we actually used in
* the copy phase above. Bring nr_pages down to that, and free
* any pages that we didn't use.
*/
for
(
;
nr_pages
>
i
+
1
;
nr_pages
--
)
put_page
(
wdata
->
pages
[
nr_pages
-
1
]);
wdata
->
sync_mode
=
WB_SYNC_ALL
;
wdata
->
nr_pages
=
nr_pages
;
wdata
->
offset
=
(
__u64
)
offset
;
...
...
sources/3.10/inode.c
View file @
a92129e1
...
...
@@ -490,10 +490,15 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
return
PTR_ERR
(
tlink
);
tcon
=
tlink_tcon
(
tlink
);
rc
=
CIFSSMBQAllEAs
(
xid
,
tcon
,
path
,
"SETFILEBITS"
,
ea_value
,
4
/* size of buf */
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
tcon
->
ses
->
server
->
ops
->
query_all_EAs
==
NULL
)
{
cifs_put_tlink
(
tlink
);
return
-
EOPNOTSUPP
;
}
rc
=
tcon
->
ses
->
server
->
ops
->
query_all_EAs
(
xid
,
tcon
,
path
,
"SETFILEBITS"
,
ea_value
,
4
/* size of buf */
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
cifs_put_tlink
(
tlink
);
if
(
rc
<
0
)
return
(
int
)
rc
;
...
...
sources/3.10/smb1ops.c
View file @
a92129e1
...
...
@@ -949,6 +949,14 @@ struct smb_version_operations smb1_operations = {
.
mand_lock
=
cifs_mand_lock
,
.
mand_unlock_range
=
cifs_unlock_range
,
.
push_mand_locks
=
cifs_push_mandatory_locks
,
#ifdef CONFIG_CIFS_XATTR
.
query_all_EAs
=
CIFSSMBQAllEAs
,
.
set_EA
=
CIFSSMBSetEA
,
#endif
/* CIFS_XATTR */
#ifdef CONFIG_CIFS_ACL
.
get_acl
=
get_cifs_acl
,
.
set_acl
=
set_cifs_acl
,
#endif
/* CIFS_ACL */
};
struct
smb_version_values
smb1_values
=
{
...
...
sources/3.10/smb2glob.h
View file @
a92129e1
...
...
@@ -55,4 +55,7 @@
#define SMB2_NTLMV2_SESSKEY_SIZE (16)
#define SMB2_HMACSHA256_SIZE (32)
/* Maximum buffer size value we can send with 1 credit */
#define SMB2_MAX_BUFFER_SIZE 65536
#endif
/* _SMB2_GLOB_H */
sources/3.10/smb2ops.c
View file @
a92129e1
...
...
@@ -181,11 +181,8 @@ smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
/* start with specified wsize, or default */
wsize
=
volume_info
->
wsize
?
volume_info
->
wsize
:
CIFS_DEFAULT_IOSIZE
;
wsize
=
min_t
(
unsigned
int
,
wsize
,
server
->
max_write
);
/*
* limit write size to 2 ** 16, because we don't support multicredit
* requests now.
*/
wsize
=
min_t
(
unsigned
int
,
wsize
,
2
<<
15
);
/* set it to the maximum buffer size value we can send with 1 credit */
wsize
=
min_t
(
unsigned
int
,
wsize
,
SMB2_MAX_BUFFER_SIZE
);
return
wsize
;
}
...
...
@@ -199,11 +196,8 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
/* start with specified rsize, or default */
rsize
=
volume_info
->
rsize
?
volume_info
->
rsize
:
CIFS_DEFAULT_IOSIZE
;
rsize
=
min_t
(
unsigned
int
,
rsize
,
server
->
max_read
);
/*
* limit write size to 2 ** 16, because we don't support multicredit
* requests now.
*/
rsize
=
min_t
(
unsigned
int
,
rsize
,
2
<<
15
);
/* set it to the maximum buffer size value we can send with 1 credit */
rsize
=
min_t
(
unsigned
int
,
rsize
,
SMB2_MAX_BUFFER_SIZE
);
return
rsize
;
}
...
...
sources/3.10/smb2pdu.c
View file @
a92129e1
...
...
@@ -408,6 +408,9 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
server
->
dialect
=
le16_to_cpu
(
rsp
->
DialectRevision
);
server
->
maxBuf
=
le32_to_cpu
(
rsp
->
MaxTransactSize
);
/* set it to the maximum buffer size value we can send with 1 credit */
server
->
maxBuf
=
min_t
(
unsigned
int
,
le32_to_cpu
(
rsp
->
MaxTransactSize
),
SMB2_MAX_BUFFER_SIZE
);
server
->
max_read
=
le32_to_cpu
(
rsp
->
MaxReadSize
);
server
->
max_write
=
le32_to_cpu
(
rsp
->
MaxWriteSize
);
/* BB Do we need to validate the SecurityMode? */
...
...
sources/3.10/xattr.c
View file @
a92129e1
...
...
@@ -82,9 +82,11 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
goto
remove_ea_exit
;
ea_name
+=
XATTR_USER_PREFIX_LEN
;
/* skip past user. prefix */
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
NULL
,
(
__u16
)
0
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
pTcon
->
ses
->
server
->
ops
->
set_EA
)
rc
=
pTcon
->
ses
->
server
->
ops
->
set_EA
(
xid
,
pTcon
,
full_path
,
ea_name
,
NULL
,
(
__u16
)
0
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
remove_ea_exit:
kfree
(
full_path
);
...
...
@@ -149,18 +151,22 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
cifs_dbg
(
FYI
,
"attempt to set cifs inode metadata
\n
"
);
ea_name
+=
XATTR_USER_PREFIX_LEN
;
/* skip past user. prefix */
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
pTcon
->
ses
->
server
->
ops
->
set_EA
)
rc
=
pTcon
->
ses
->
server
->
ops
->
set_EA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
if
(
strncmp
(
ea_name
,
XATTR_OS2_PREFIX
,
XATTR_OS2_PREFIX_LEN
)
==
0
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
goto
set_ea_exit
;
ea_name
+=
XATTR_OS2_PREFIX_LEN
;
/* skip past os2. prefix */
rc
=
CIFSSMBSetEA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
pTcon
->
ses
->
server
->
ops
->
set_EA
)
rc
=
pTcon
->
ses
->
server
->
ops
->
set_EA
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
(
__u16
)
value_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
if
(
strncmp
(
ea_name
,
CIFS_XATTR_CIFS_ACL
,
strlen
(
CIFS_XATTR_CIFS_ACL
))
==
0
)
{
#ifdef CONFIG_CIFS_ACL
...
...
@@ -170,8 +176,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
rc
=
-
ENOMEM
;
}
else
{
memcpy
(
pacl
,
ea_value
,
value_size
);
rc
=
set_cifs_acl
(
pacl
,
value_size
,
direntry
->
d_inode
,
full_path
,
CIFS_ACL_DACL
);
if
(
pTcon
->
ses
->
server
->
ops
->
set_acl
)
rc
=
pTcon
->
ses
->
server
->
ops
->
set_acl
(
pacl
,
value_size
,
direntry
->
d_inode
,
full_path
,
CIFS_ACL_DACL
);
else
rc
=
-
EOPNOTSUPP
;
if
(
rc
==
0
)
/* force revalidate of the inode */
CIFS_I
(
direntry
->
d_inode
)
->
time
=
0
;
kfree
(
pacl
);
...
...
@@ -272,17 +282,21 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
/* revalidate/getattr then populate from inode */
}
/* BB add else when above is implemented */
ea_name
+=
XATTR_USER_PREFIX_LEN
;
/* skip past user. prefix */
rc
=
CIFSSMBQAllEAs
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
pTcon
->
ses
->
server
->
ops
->
query_all_EAs
)
rc
=
pTcon
->
ses
->
server
->
ops
->
query_all_EAs
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
if
(
strncmp
(
ea_name
,
XATTR_OS2_PREFIX
,
XATTR_OS2_PREFIX_LEN
)
==
0
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_XATTR
)
goto
get_ea_exit
;
ea_name
+=
XATTR_OS2_PREFIX_LEN
;
/* skip past os2. prefix */
rc
=
CIFSSMBQAllEAs
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
pTcon
->
ses
->
server
->
ops
->
query_all_EAs
)
rc
=
pTcon
->
ses
->
server
->
ops
->
query_all_EAs
(
xid
,
pTcon
,
full_path
,
ea_name
,
ea_value
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
}
else
if
(
strncmp
(
ea_name
,
POSIX_ACL_XATTR_ACCESS
,
strlen
(
POSIX_ACL_XATTR_ACCESS
))
==
0
)
{
#ifdef CONFIG_CIFS_POSIX
...
...
@@ -313,8 +327,11 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
u32
acllen
;
struct
cifs_ntsd
*
pacl
;
pacl
=
get_cifs_acl
(
cifs_sb
,
direntry
->
d_inode
,
full_path
,
&
acllen
);
if
(
pTcon
->
ses
->
server
->
ops
->
get_acl
==
NULL
)
goto
get_ea_exit
;
/* rc already EOPNOTSUPP */
pacl
=
pTcon
->
ses
->
server
->
ops
->
get_acl
(
cifs_sb
,
direntry
->
d_inode
,
full_path
,
&
acllen
);
if
(
IS_ERR
(
pacl
))
{
rc
=
PTR_ERR
(
pacl
);
cifs_dbg
(
VFS
,
"%s: error %zd getting sec desc
\n
"
,
...
...
@@ -400,11 +417,12 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
/* if proc/fs/cifs/streamstoxattr is set then
search server for EAs or streams to
returns as xattrs */
rc
=
CIFSSMBQAllEAs
(
xid
,
pTcon
,
full_path
,
NULL
,
data
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
if
(
pTcon
->
ses
->
server
->
ops
->
query_all_EAs
)
rc
=
pTcon
->
ses
->
server
->
ops
->
query_all_EAs
(
xid
,
pTcon
,
full_path
,
NULL
,
data
,
buf_size
,
cifs_sb
->
local_nls
,
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_MAP_SPECIAL_CHR
);
list_ea_exit:
kfree
(
full_path
);
free_xid
(
xid
);
...
...
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