diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/CHANGES | 6 | ||||
-rw-r--r-- | fs/cifs/cifspdu.h | 10 | ||||
-rw-r--r-- | fs/cifs/inode.c | 21 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 4 |
4 files changed, 36 insertions, 5 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 6247628bdaed..5d1f4873d701 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -4,6 +4,12 @@ Fix mtime bouncing around from local idea of last write times to remote time. | |||
4 | Fix hang (in i_size_read) when simultaneous size update of same remote file | 4 | Fix hang (in i_size_read) when simultaneous size update of same remote file |
5 | on smp system corrupts sequence number. Do not reread unnecessarily partial page | 5 | on smp system corrupts sequence number. Do not reread unnecessarily partial page |
6 | (which we are about to overwrite anyway) when writing out file opened rw. | 6 | (which we are about to overwrite anyway) when writing out file opened rw. |
7 | When DOS attribute of file on non-Unix server's file changes on the server side | ||
8 | from read-only back to read-write, reflect this change in default file mode | ||
9 | (we had been leaving a file's mode read-only until the inode were reloaded). | ||
10 | Allow setting of attribute back to ATTR_NORMAL (removing readonly dos attribute | ||
11 | when archive dos attribute not set and we are changing mode back to writeable | ||
12 | on server which does not support the Unix Extensions). | ||
7 | 13 | ||
8 | Version 1.47 | 14 | Version 1.47 |
9 | ------------ | 15 | ------------ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 0efdf35aab2c..4d8948e8762c 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -220,7 +220,7 @@ | |||
220 | */ | 220 | */ |
221 | #define CIFS_NO_HANDLE 0xFFFF | 221 | #define CIFS_NO_HANDLE 0xFFFF |
222 | 222 | ||
223 | #define NO_CHANGE_64 0xFFFFFFFFFFFFFFFFULL | 223 | #define NO_CHANGE_64 cpu_to_le64(0xFFFFFFFFFFFFFFFFULL) |
224 | #define NO_CHANGE_32 0xFFFFFFFFUL | 224 | #define NO_CHANGE_32 0xFFFFFFFFUL |
225 | 225 | ||
226 | /* IPC$ in ASCII */ | 226 | /* IPC$ in ASCII */ |
@@ -1887,7 +1887,13 @@ typedef struct { | |||
1887 | calls including posix open | 1887 | calls including posix open |
1888 | and posix unlink */ | 1888 | and posix unlink */ |
1889 | #ifdef CONFIG_CIFS_POSIX | 1889 | #ifdef CONFIG_CIFS_POSIX |
1890 | #define CIFS_UNIX_CAP_MASK 0x0000003b | 1890 | /* Can not set pathnames cap yet until we send new posix create SMB since |
1891 | otherwise server can treat such handles opened with older ntcreatex | ||
1892 | (by a new client which knows how to send posix path ops) | ||
1893 | as non-posix handles (can affect write behavior with byte range locks. | ||
1894 | We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */ | ||
1895 | /* #define CIFS_UNIX_CAP_MASK 0x0000003b */ | ||
1896 | #define CIFS_UNIX_CAP_MASK 0x0000001b | ||
1891 | #else | 1897 | #else |
1892 | #define CIFS_UNIX_CAP_MASK 0x00000013 | 1898 | #define CIFS_UNIX_CAP_MASK 0x00000013 |
1893 | #endif /* CONFIG_CIFS_POSIX */ | 1899 | #endif /* CONFIG_CIFS_POSIX */ |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 86b9dbbd8441..f414526e476a 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -494,6 +494,12 @@ int cifs_get_inode_info(struct inode **pinode, | |||
494 | mode e.g. 555 */ | 494 | mode e.g. 555 */ |
495 | if (cifsInfo->cifsAttrs & ATTR_READONLY) | 495 | if (cifsInfo->cifsAttrs & ATTR_READONLY) |
496 | inode->i_mode &= ~(S_IWUGO); | 496 | inode->i_mode &= ~(S_IWUGO); |
497 | else if ((inode->i_mode & S_IWUGO) == 0) | ||
498 | /* the ATTR_READONLY flag may have been */ | ||
499 | /* changed on server -- set any w bits */ | ||
500 | /* allowed by mnt_file_mode */ | ||
501 | inode->i_mode |= (S_IWUGO & | ||
502 | cifs_sb->mnt_file_mode); | ||
497 | /* BB add code here - | 503 | /* BB add code here - |
498 | validate if device or weird share or device type? */ | 504 | validate if device or weird share or device type? */ |
499 | } | 505 | } |
@@ -1190,6 +1196,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1190 | struct cifsFileInfo *open_file = NULL; | 1196 | struct cifsFileInfo *open_file = NULL; |
1191 | FILE_BASIC_INFO time_buf; | 1197 | FILE_BASIC_INFO time_buf; |
1192 | int set_time = FALSE; | 1198 | int set_time = FALSE; |
1199 | int set_dosattr = FALSE; | ||
1193 | __u64 mode = 0xFFFFFFFFFFFFFFFFULL; | 1200 | __u64 mode = 0xFFFFFFFFFFFFFFFFULL; |
1194 | __u64 uid = 0xFFFFFFFFFFFFFFFFULL; | 1201 | __u64 uid = 0xFFFFFFFFFFFFFFFFULL; |
1195 | __u64 gid = 0xFFFFFFFFFFFFFFFFULL; | 1202 | __u64 gid = 0xFFFFFFFFFFFFFFFFULL; |
@@ -1326,15 +1333,23 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1326 | else if (attrs->ia_valid & ATTR_MODE) { | 1333 | else if (attrs->ia_valid & ATTR_MODE) { |
1327 | rc = 0; | 1334 | rc = 0; |
1328 | if ((mode & S_IWUGO) == 0) /* not writeable */ { | 1335 | if ((mode & S_IWUGO) == 0) /* not writeable */ { |
1329 | if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) | 1336 | if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) { |
1337 | set_dosattr = TRUE; | ||
1330 | time_buf.Attributes = | 1338 | time_buf.Attributes = |
1331 | cpu_to_le32(cifsInode->cifsAttrs | | 1339 | cpu_to_le32(cifsInode->cifsAttrs | |
1332 | ATTR_READONLY); | 1340 | ATTR_READONLY); |
1341 | } | ||
1333 | } else if ((mode & S_IWUGO) == S_IWUGO) { | 1342 | } else if ((mode & S_IWUGO) == S_IWUGO) { |
1334 | if (cifsInode->cifsAttrs & ATTR_READONLY) | 1343 | if (cifsInode->cifsAttrs & ATTR_READONLY) { |
1344 | set_dosattr = TRUE; | ||
1335 | time_buf.Attributes = | 1345 | time_buf.Attributes = |
1336 | cpu_to_le32(cifsInode->cifsAttrs & | 1346 | cpu_to_le32(cifsInode->cifsAttrs & |
1337 | (~ATTR_READONLY)); | 1347 | (~ATTR_READONLY)); |
1348 | /* Windows ignores set to zero */ | ||
1349 | if(time_buf.Attributes == 0) | ||
1350 | time_buf.Attributes |= | ||
1351 | cpu_to_le32(ATTR_NORMAL); | ||
1352 | } | ||
1338 | } | 1353 | } |
1339 | /* BB to be implemented - | 1354 | /* BB to be implemented - |
1340 | via Windows security descriptors or streams */ | 1355 | via Windows security descriptors or streams */ |
@@ -1372,7 +1387,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1372 | } else | 1387 | } else |
1373 | time_buf.ChangeTime = 0; | 1388 | time_buf.ChangeTime = 0; |
1374 | 1389 | ||
1375 | if (set_time || time_buf.Attributes) { | 1390 | if (set_time || set_dosattr) { |
1376 | time_buf.CreationTime = 0; /* do not change */ | 1391 | time_buf.CreationTime = 0; /* do not change */ |
1377 | /* In the future we should experiment - try setting timestamps | 1392 | /* In the future we should experiment - try setting timestamps |
1378 | via Handle (SetFileInfo) instead of by path */ | 1393 | via Handle (SetFileInfo) instead of by path */ |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 44cfb528797d..2a374d5215ab 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -219,6 +219,10 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
219 | tmp_inode->i_mode |= S_IFREG; | 219 | tmp_inode->i_mode |= S_IFREG; |
220 | if (attr & ATTR_READONLY) | 220 | if (attr & ATTR_READONLY) |
221 | tmp_inode->i_mode &= ~(S_IWUGO); | 221 | tmp_inode->i_mode &= ~(S_IWUGO); |
222 | else if ((tmp_inode->i_mode & S_IWUGO) == 0) | ||
223 | /* the ATTR_READONLY flag may have been changed on */ | ||
224 | /* server -- set any w bits allowed by mnt_file_mode */ | ||
225 | tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode); | ||
222 | } /* could add code here - to validate if device or weird share type? */ | 226 | } /* could add code here - to validate if device or weird share type? */ |
223 | 227 | ||
224 | /* can not fill in nlink here as in qpathinfo version and Unx search */ | 228 | /* can not fill in nlink here as in qpathinfo version and Unx search */ |