summaryrefslogtreecommitdiff
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2006-01-12 14:41:28 -0800
committerSteve French <sfrench@us.ibm.com>2006-01-12 14:41:28 -0800
commitc32a0b689cb9cc160cfcd19735bbf50bb70c6ef4 (patch)
tree97addaf85d16d817d4a51d5d04d4e8ceb1edfe17 /fs/cifs/file.c
parentf3f6ec4b77f627a6427460d6f8884e1042eef134 (diff)
downloadlinux-3.10-c32a0b689cb9cc160cfcd19735bbf50bb70c6ef4.tar.gz
linux-3.10-c32a0b689cb9cc160cfcd19735bbf50bb70c6ef4.tar.bz2
linux-3.10-c32a0b689cb9cc160cfcd19735bbf50bb70c6ef4.zip
[CIFS] Allow local filesize for file that is open for write to be updated
from server when mount forcedirectio. Allowing update of file size with non forcedirectio mounts should be allowed in the fiture but requires carefully writing out the last page in the local file if it is a partial page in order to avoid corruption and careful serialization Thanks to Maximiliano Curia who suggested similar changes and provided a testcase. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index c249b628fd1..670ec1e84da 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1835,10 +1835,20 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode)
open_file = find_writable_file(cifsInode);
if(open_file) {
+ struct cifs_sb_info *cifs_sb;
+
/* there is not actually a write pending so let
this handle go free and allow it to
be closable if needed */
atomic_dec(&open_file->wrtPending);
+
+ cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb);
+ if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) {
+ /* since no page cache to corrupt on directio
+ we can change size safely */
+ return 1;
+ }
+
return 0;
} else
return 1;