aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c21
1 files changed, 18 insertions, 3 deletions
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 */