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.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index d34325c887c..053c1cadf70 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -710,7 +710,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
710 char *full_path = NULL; 710 char *full_path = NULL;
711 struct inode *newinode = NULL; 711 struct inode *newinode = NULL;
712 712
713 cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p ", mode, inode)); 713 cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode));
714 714
715 xid = GetXid(); 715 xid = GetXid();
716 716
@@ -768,7 +768,16 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
768 /* BB to be implemented via Windows secrty descriptors 768 /* BB to be implemented via Windows secrty descriptors
769 eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, 769 eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode,
770 -1, -1, local_nls); */ 770 -1, -1, local_nls); */
771 } 771 if(direntry->d_inode) {
772 direntry->d_inode->i_mode = mode;
773 if(cifs_sb->mnt_cifs_flags &
774 CIFS_MOUNT_SET_UID) {
775 direntry->d_inode->i_uid =
776 current->fsuid;
777 direntry->d_inode->i_gid =
778 current->fsgid;
779 }
780 }
772 } 781 }
773 kfree(full_path); 782 kfree(full_path);
774 FreeXid(xid); 783 FreeXid(xid);
@@ -1111,9 +1120,20 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1111 1120
1112 cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ", 1121 cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ",
1113 direntry->d_name.name, attrs->ia_valid)); 1122 direntry->d_name.name, attrs->ia_valid));
1123
1114 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1124 cifs_sb = CIFS_SB(direntry->d_inode->i_sb);
1115 pTcon = cifs_sb->tcon; 1125 pTcon = cifs_sb->tcon;
1116 1126
1127 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM == 0) {
1128 /* check if we have permission to change attrs */
1129 rc = inode_change_ok(direntry->d_inode, attrs);
1130 if(rc < 0) {
1131 FreeXid(xid);
1132 return rc;
1133 } else
1134 rc = 0;
1135 }
1136
1117 down(&direntry->d_sb->s_vfs_rename_sem); 1137 down(&direntry->d_sb->s_vfs_rename_sem);
1118 full_path = build_path_from_dentry(direntry); 1138 full_path = build_path_from_dentry(direntry);
1119 up(&direntry->d_sb->s_vfs_rename_sem); 1139 up(&direntry->d_sb->s_vfs_rename_sem);
@@ -1153,7 +1173,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1153 1 /* 45 seconds */); 1173 1 /* 45 seconds */);
1154 cFYI(1,("Wrt seteof rc %d", rc)); 1174 cFYI(1,("Wrt seteof rc %d", rc));
1155 } 1175 }
1156 } 1176 } else
1177 rc = -EINVAL;
1178
1157 if (rc != 0) { 1179 if (rc != 0) {
1158 /* Set file size by pathname rather than by handle 1180 /* Set file size by pathname rather than by handle
1159 either because no valid, writeable file handle for 1181 either because no valid, writeable file handle for