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
7ba52631
Commit
7ba52631
authored
Feb 08, 2007
by
Steve French
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CIFS] Allow update of EOF on remote extend of file
Signed-off-by:
Steve French
<
sfrench@us.ibm.com
>
parent
595dcfec
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
fs/cifs/cifsproto.h
fs/cifs/cifsproto.h
+1
-1
fs/cifs/file.c
fs/cifs/file.c
+4
-1
fs/cifs/inode.c
fs/cifs/inode.c
+3
-3
fs/cifs/readdir.c
fs/cifs/readdir.c
+3
-3
No files found.
fs/cifs/cifsproto.h
View file @
7ba52631
...
@@ -57,7 +57,7 @@ extern int SendReceiveBlockingLock(const unsigned int /* xid */ ,
...
@@ -57,7 +57,7 @@ extern int SendReceiveBlockingLock(const unsigned int /* xid */ ,
int
*
/* bytes returned */
);
int
*
/* bytes returned */
);
extern
int
checkSMB
(
struct
smb_hdr
*
smb
,
__u16
mid
,
unsigned
int
length
);
extern
int
checkSMB
(
struct
smb_hdr
*
smb
,
__u16
mid
,
unsigned
int
length
);
extern
int
is_valid_oplock_break
(
struct
smb_hdr
*
smb
,
struct
TCP_Server_Info
*
);
extern
int
is_valid_oplock_break
(
struct
smb_hdr
*
smb
,
struct
TCP_Server_Info
*
);
extern
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
);
extern
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
,
__u64
eof
);
extern
struct
cifsFileInfo
*
find_writable_file
(
struct
cifsInodeInfo
*
);
extern
struct
cifsFileInfo
*
find_writable_file
(
struct
cifsInodeInfo
*
);
extern
unsigned
int
smbCalcSize
(
struct
smb_hdr
*
ptr
);
extern
unsigned
int
smbCalcSize
(
struct
smb_hdr
*
ptr
);
extern
unsigned
int
smbCalcSize_LE
(
struct
smb_hdr
*
ptr
);
extern
unsigned
int
smbCalcSize_LE
(
struct
smb_hdr
*
ptr
);
...
...
fs/cifs/file.c
View file @
7ba52631
...
@@ -1954,7 +1954,7 @@ static int cifs_readpage(struct file *file, struct page *page)
...
@@ -1954,7 +1954,7 @@ static int cifs_readpage(struct file *file, struct page *page)
refreshing the inode only on increases in the file size
refreshing the inode only on increases in the file size
but this is tricky to do without racing with writebehind
but this is tricky to do without racing with writebehind
page caching in the current Linux kernel design */
page caching in the current Linux kernel design */
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
cifsInode
)
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
cifsInode
,
__u64
end_of_file
)
{
{
struct
cifsFileInfo
*
open_file
=
NULL
;
struct
cifsFileInfo
*
open_file
=
NULL
;
...
@@ -1976,6 +1976,9 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode)
...
@@ -1976,6 +1976,9 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode)
return
1
;
return
1
;
}
}
if
(
i_size_read
(
&
cifsInode
->
vfs_inode
)
<
end_of_file
)
return
1
;
return
0
;
return
0
;
}
else
}
else
return
1
;
return
1
;
...
...
fs/cifs/inode.c
View file @
7ba52631
...
@@ -140,7 +140,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
...
@@ -140,7 +140,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
inode
->
i_gid
=
le64_to_cpu
(
findData
.
Gid
);
inode
->
i_gid
=
le64_to_cpu
(
findData
.
Gid
);
inode
->
i_nlink
=
le64_to_cpu
(
findData
.
Nlinks
);
inode
->
i_nlink
=
le64_to_cpu
(
findData
.
Nlinks
);
if
(
is_size_safe_to_change
(
cifsInfo
))
{
if
(
is_size_safe_to_change
(
cifsInfo
,
end_of_file
))
{
/* can not safely change the file size here if the
/* can not safely change the file size here if the
client is writing to it due to potential races */
client is writing to it due to potential races */
...
@@ -491,8 +491,8 @@ int cifs_get_inode_info(struct inode **pinode,
...
@@ -491,8 +491,8 @@ int cifs_get_inode_info(struct inode **pinode,
/* BB add code here -
/* BB add code here -
validate if device or weird share or device type? */
validate if device or weird share or device type? */
}
}
if
(
is_size_safe_to_change
(
cifsInfo
))
{
if
(
is_size_safe_to_change
(
cifsInfo
,
le64_to_cpu
(
pfindData
->
EndOfFile
)
))
{
/* can not safely
change
the file size here if the
/* can not safely
shrink
the file size here if the
client is writing to it due to potential races */
client is writing to it due to potential races */
i_size_write
(
inode
,
le64_to_cpu
(
pfindData
->
EndOfFile
));
i_size_write
(
inode
,
le64_to_cpu
(
pfindData
->
EndOfFile
));
...
...
fs/cifs/readdir.c
View file @
7ba52631
...
@@ -222,7 +222,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
...
@@ -222,7 +222,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
atomic_set
(
&
cifsInfo
->
inUse
,
1
);
atomic_set
(
&
cifsInfo
->
inUse
,
1
);
}
}
if
(
is_size_safe_to_change
(
cifsInfo
))
{
if
(
is_size_safe_to_change
(
cifsInfo
,
end_of_file
))
{
/* can not safely change the file size here if the
/* can not safely change the file size here if the
client is writing to it due to potential races */
client is writing to it due to potential races */
i_size_write
(
tmp_inode
,
end_of_file
);
i_size_write
(
tmp_inode
,
end_of_file
);
...
@@ -351,10 +351,10 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
...
@@ -351,10 +351,10 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
tmp_inode
->
i_gid
=
le64_to_cpu
(
pfindData
->
Gid
);
tmp_inode
->
i_gid
=
le64_to_cpu
(
pfindData
->
Gid
);
tmp_inode
->
i_nlink
=
le64_to_cpu
(
pfindData
->
Nlinks
);
tmp_inode
->
i_nlink
=
le64_to_cpu
(
pfindData
->
Nlinks
);
if
(
is_size_safe_to_change
(
cifsInfo
))
{
if
(
is_size_safe_to_change
(
cifsInfo
,
end_of_file
))
{
/* can not safely change the file size here if the
/* can not safely change the file size here if the
client is writing to it due to potential races */
client is writing to it due to potential races */
i_size_write
(
tmp_inode
,
end_of_file
);
i_size_write
(
tmp_inode
,
end_of_file
);
/* 512 bytes (2**9) is the fake blocksize that must be used */
/* 512 bytes (2**9) is the fake blocksize that must be used */
/* for this calculation, not the real blocksize */
/* for this calculation, not the real blocksize */
...
...
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