diff options
author | Steve French <sfrench@us.ibm.com> | 2007-02-08 13:14:13 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-02-08 13:14:13 -0500 |
commit | 7ba526316ae122e60c0c7a40793491f71b9ec590 (patch) | |
tree | 5cac6a04506e79823245cd2996572b48b468e736 /fs | |
parent | 595dcfecf642c8b0772989ed46f15ee03c25a205 (diff) |
[CIFS] Allow update of EOF on remote extend of file
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsproto.h | 2 | ||||
-rw-r--r-- | fs/cifs/file.c | 5 | ||||
-rw-r--r-- | fs/cifs/inode.c | 6 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 6 |
4 files changed, 11 insertions, 8 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index f1f8225102f0..1108f17bf550 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -57,7 +57,7 @@ extern int SendReceiveBlockingLock(const unsigned int /* xid */ , | |||
57 | int * /* bytes returned */); | 57 | int * /* bytes returned */); |
58 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); | 58 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); |
59 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); | 59 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); |
60 | extern int is_size_safe_to_change(struct cifsInodeInfo *); | 60 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); |
61 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); | 61 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); |
62 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); | 62 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); |
63 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); | 63 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e9dcf5ee29a2..07ff9351e9ee 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1954,7 +1954,7 @@ static int cifs_readpage(struct file *file, struct page *page) | |||
1954 | refreshing the inode only on increases in the file size | 1954 | refreshing the inode only on increases in the file size |
1955 | but this is tricky to do without racing with writebehind | 1955 | but this is tricky to do without racing with writebehind |
1956 | page caching in the current Linux kernel design */ | 1956 | page caching in the current Linux kernel design */ |
1957 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode) | 1957 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) |
1958 | { | 1958 | { |
1959 | struct cifsFileInfo *open_file = NULL; | 1959 | struct cifsFileInfo *open_file = NULL; |
1960 | 1960 | ||
@@ -1976,6 +1976,9 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode) | |||
1976 | return 1; | 1976 | return 1; |
1977 | } | 1977 | } |
1978 | 1978 | ||
1979 | if(i_size_read(&cifsInode->vfs_inode) < end_of_file) | ||
1980 | return 1; | ||
1981 | |||
1979 | return 0; | 1982 | return 0; |
1980 | } else | 1983 | } else |
1981 | return 1; | 1984 | return 1; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index c4fa91b8b62f..3f5bc83dc3d1 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -140,7 +140,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
140 | inode->i_gid = le64_to_cpu(findData.Gid); | 140 | inode->i_gid = le64_to_cpu(findData.Gid); |
141 | inode->i_nlink = le64_to_cpu(findData.Nlinks); | 141 | inode->i_nlink = le64_to_cpu(findData.Nlinks); |
142 | 142 | ||
143 | if (is_size_safe_to_change(cifsInfo)) { | 143 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
144 | /* can not safely change the file size here if the | 144 | /* can not safely change the file size here if the |
145 | client is writing to it due to potential races */ | 145 | client is writing to it due to potential races */ |
146 | 146 | ||
@@ -491,8 +491,8 @@ int cifs_get_inode_info(struct inode **pinode, | |||
491 | /* BB add code here - | 491 | /* BB add code here - |
492 | validate if device or weird share or device type? */ | 492 | validate if device or weird share or device type? */ |
493 | } | 493 | } |
494 | if (is_size_safe_to_change(cifsInfo)) { | 494 | if (is_size_safe_to_change(cifsInfo, le64_to_cpu(pfindData->EndOfFile))) { |
495 | /* can not safely change the file size here if the | 495 | /* can not safely shrink the file size here if the |
496 | client is writing to it due to potential races */ | 496 | client is writing to it due to potential races */ |
497 | i_size_write(inode,le64_to_cpu(pfindData->EndOfFile)); | 497 | i_size_write(inode,le64_to_cpu(pfindData->EndOfFile)); |
498 | 498 | ||
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 782940be550f..c6220bd27165 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -222,7 +222,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
222 | atomic_set(&cifsInfo->inUse, 1); | 222 | atomic_set(&cifsInfo->inUse, 1); |
223 | } | 223 | } |
224 | 224 | ||
225 | if (is_size_safe_to_change(cifsInfo)) { | 225 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
226 | /* can not safely change the file size here if the | 226 | /* can not safely change the file size here if the |
227 | client is writing to it due to potential races */ | 227 | client is writing to it due to potential races */ |
228 | i_size_write(tmp_inode, end_of_file); | 228 | i_size_write(tmp_inode, end_of_file); |
@@ -351,10 +351,10 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
351 | tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); | 351 | tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); |
352 | tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); | 352 | tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); |
353 | 353 | ||
354 | if (is_size_safe_to_change(cifsInfo)) { | 354 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
355 | /* can not safely change the file size here if the | 355 | /* can not safely change the file size here if the |
356 | client is writing to it due to potential races */ | 356 | client is writing to it due to potential races */ |
357 | i_size_write(tmp_inode,end_of_file); | 357 | i_size_write(tmp_inode, end_of_file); |
358 | 358 | ||
359 | /* 512 bytes (2**9) is the fake blocksize that must be used */ | 359 | /* 512 bytes (2**9) is the fake blocksize that must be used */ |
360 | /* for this calculation, not the real blocksize */ | 360 | /* for this calculation, not the real blocksize */ |