diff options
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e152bf6afa60..e2b4ce1dad66 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -84,6 +84,8 @@ static inline int cifs_get_disposition(unsigned int flags) | |||
84 | return FILE_OVERWRITE_IF; | 84 | return FILE_OVERWRITE_IF; |
85 | else if ((flags & O_CREAT) == O_CREAT) | 85 | else if ((flags & O_CREAT) == O_CREAT) |
86 | return FILE_OPEN_IF; | 86 | return FILE_OPEN_IF; |
87 | else if ((flags & O_TRUNC) == O_TRUNC) | ||
88 | return FILE_OVERWRITE; | ||
87 | else | 89 | else |
88 | return FILE_OPEN; | 90 | return FILE_OPEN; |
89 | } | 91 | } |
@@ -656,7 +658,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
656 | else | 658 | else |
657 | posix_lock_type = CIFS_WRLCK; | 659 | posix_lock_type = CIFS_WRLCK; |
658 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 1 /* get */, | 660 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 1 /* get */, |
659 | length, pfLock->fl_start, | 661 | length, pfLock, |
660 | posix_lock_type, wait_flag); | 662 | posix_lock_type, wait_flag); |
661 | FreeXid(xid); | 663 | FreeXid(xid); |
662 | return rc; | 664 | return rc; |
@@ -704,7 +706,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
704 | return -EOPNOTSUPP; | 706 | return -EOPNOTSUPP; |
705 | } | 707 | } |
706 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 0 /* set */, | 708 | rc = CIFSSMBPosixLock(xid, pTcon, netfid, 0 /* set */, |
707 | length, pfLock->fl_start, | 709 | length, pfLock, |
708 | posix_lock_type, wait_flag); | 710 | posix_lock_type, wait_flag); |
709 | } else | 711 | } else |
710 | rc = CIFSSMBLock(xid, pTcon, netfid, length, pfLock->fl_start, | 712 | rc = CIFSSMBLock(xid, pTcon, netfid, length, pfLock->fl_start, |
@@ -904,8 +906,10 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
904 | if (rc != 0) | 906 | if (rc != 0) |
905 | break; | 907 | break; |
906 | } | 908 | } |
907 | if(experimEnabled || (pTcon->ses->server->secMode & | 909 | if(experimEnabled || (pTcon->ses->server && |
908 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0) { | 910 | ((pTcon->ses->server->secMode & |
911 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | ||
912 | == 0))) { | ||
909 | struct kvec iov[2]; | 913 | struct kvec iov[2]; |
910 | unsigned int len; | 914 | unsigned int len; |
911 | 915 | ||