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.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 0d9d2e6d7af6..fcbdbb6ad7bf 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -974,8 +974,8 @@ mkdir_get_info:
974 * failed to get it from the server or was set bogus */ 974 * failed to get it from the server or was set bogus */
975 if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) 975 if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2))
976 direntry->d_inode->i_nlink = 2; 976 direntry->d_inode->i_nlink = 2;
977 mode &= ~current->fs->umask;
977 if (pTcon->unix_ext) { 978 if (pTcon->unix_ext) {
978 mode &= ~current->fs->umask;
979 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 979 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
980 CIFSSMBUnixSetPerms(xid, pTcon, full_path, 980 CIFSSMBUnixSetPerms(xid, pTcon, full_path,
981 mode, 981 mode,
@@ -994,9 +994,16 @@ mkdir_get_info:
994 CIFS_MOUNT_MAP_SPECIAL_CHR); 994 CIFS_MOUNT_MAP_SPECIAL_CHR);
995 } 995 }
996 } else { 996 } else {
997 /* BB to be implemented via Windows secrty descriptors 997 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) &&
998 eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, 998 (mode & S_IWUGO) == 0) {
999 -1, -1, local_nls); */ 999 FILE_BASIC_INFO pInfo;
1000 memset(&pInfo, 0, sizeof(pInfo));
1001 pInfo.Attributes = cpu_to_le32(ATTR_READONLY);
1002 CIFSSMBSetTimes(xid, pTcon, full_path,
1003 &pInfo, cifs_sb->local_nls,
1004 cifs_sb->mnt_cifs_flags &
1005 CIFS_MOUNT_MAP_SPECIAL_CHR);
1006 }
1000 if (direntry->d_inode) { 1007 if (direntry->d_inode) {
1001 direntry->d_inode->i_mode = mode; 1008 direntry->d_inode->i_mode = mode;
1002 direntry->d_inode->i_mode |= S_IFDIR; 1009 direntry->d_inode->i_mode |= S_IFDIR;
@@ -1408,18 +1415,19 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1408 __u64 uid = 0xFFFFFFFFFFFFFFFFULL; 1415 __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
1409 __u64 gid = 0xFFFFFFFFFFFFFFFFULL; 1416 __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
1410 struct cifsInodeInfo *cifsInode; 1417 struct cifsInodeInfo *cifsInode;
1418 struct inode *inode = direntry->d_inode;
1411 1419
1412 xid = GetXid(); 1420 xid = GetXid();
1413 1421
1414 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", 1422 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x",
1415 direntry->d_name.name, attrs->ia_valid)); 1423 direntry->d_name.name, attrs->ia_valid));
1416 1424
1417 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1425 cifs_sb = CIFS_SB(inode->i_sb);
1418 pTcon = cifs_sb->tcon; 1426 pTcon = cifs_sb->tcon;
1419 1427
1420 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { 1428 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
1421 /* check if we have permission to change attrs */ 1429 /* check if we have permission to change attrs */
1422 rc = inode_change_ok(direntry->d_inode, attrs); 1430 rc = inode_change_ok(inode, attrs);
1423 if (rc < 0) { 1431 if (rc < 0) {
1424 FreeXid(xid); 1432 FreeXid(xid);
1425 return rc; 1433 return rc;
@@ -1432,7 +1440,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1432 FreeXid(xid); 1440 FreeXid(xid);
1433 return -ENOMEM; 1441 return -ENOMEM;
1434 } 1442 }
1435 cifsInode = CIFS_I(direntry->d_inode); 1443 cifsInode = CIFS_I(inode);
1436 1444
1437 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) { 1445 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) {
1438 /* 1446 /*
@@ -1443,9 +1451,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1443 will be truncated anyway? Also, should we error out here if 1451 will be truncated anyway? Also, should we error out here if
1444 the flush returns error? 1452 the flush returns error?
1445 */ 1453 */
1446 rc = filemap_write_and_wait(direntry->d_inode->i_mapping); 1454 rc = filemap_write_and_wait(inode->i_mapping);
1447 if (rc != 0) { 1455 if (rc != 0) {
1448 CIFS_I(direntry->d_inode)->write_behind_rc = rc; 1456 cifsInode->write_behind_rc = rc;
1449 rc = 0; 1457 rc = 0;
1450 } 1458 }
1451 } 1459 }
@@ -1521,9 +1529,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1521 */ 1529 */
1522 1530
1523 if (rc == 0) { 1531 if (rc == 0) {
1524 rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); 1532 rc = cifs_vmtruncate(inode, attrs->ia_size);
1525 cifs_truncate_page(direntry->d_inode->i_mapping, 1533 cifs_truncate_page(inode->i_mapping, inode->i_size);
1526 direntry->d_inode->i_size);
1527 } else 1534 } else
1528 goto cifs_setattr_exit; 1535 goto cifs_setattr_exit;
1529 } 1536 }
@@ -1557,7 +1564,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1557 rc = 0; 1564 rc = 0;
1558#ifdef CONFIG_CIFS_EXPERIMENTAL 1565#ifdef CONFIG_CIFS_EXPERIMENTAL
1559 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) 1566 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
1560 rc = mode_to_acl(direntry->d_inode, full_path, mode); 1567 rc = mode_to_acl(inode, full_path, mode);
1561 else if ((mode & S_IWUGO) == 0) { 1568 else if ((mode & S_IWUGO) == 0) {
1562#else 1569#else
1563 if ((mode & S_IWUGO) == 0) { 1570 if ((mode & S_IWUGO) == 0) {
@@ -1665,7 +1672,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1665 /* do not need local check to inode_check_ok since the server does 1672 /* do not need local check to inode_check_ok since the server does
1666 that */ 1673 that */
1667 if (!rc) 1674 if (!rc)
1668 rc = inode_setattr(direntry->d_inode, attrs); 1675 rc = inode_setattr(inode, attrs);
1669cifs_setattr_exit: 1676cifs_setattr_exit:
1670 kfree(full_path); 1677 kfree(full_path);
1671 FreeXid(xid); 1678 FreeXid(xid);