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.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 05b525812adb..411c1f7f84da 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,6 +768,17 @@ 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 if(direntry->d_inode) {
772 direntry->d_inode->i_mode = mode;
773 direntry->d_inode->i_mode |= S_IFDIR;
774 if(cifs_sb->mnt_cifs_flags &
775 CIFS_MOUNT_SET_UID) {
776 direntry->d_inode->i_uid =
777 current->fsuid;
778 direntry->d_inode->i_gid =
779 current->fsgid;
780 }
781 }
771 } 782 }
772 } 783 }
773 kfree(full_path); 784 kfree(full_path);
@@ -1039,14 +1050,20 @@ int cifs_revalidate(struct dentry *direntry)
1039 filemap_fdatawrite(direntry->d_inode->i_mapping); 1050 filemap_fdatawrite(direntry->d_inode->i_mapping);
1040 } 1051 }
1041 if (invalidate_inode) { 1052 if (invalidate_inode) {
1042 if (direntry->d_inode->i_mapping) 1053 /* shrink_dcache not necessary now that cifs dentry ops
1043 filemap_fdatawait(direntry->d_inode->i_mapping); 1054 are exported for negative dentries */
1044 /* may eventually have to do this for open files too */ 1055/* if(S_ISDIR(direntry->d_inode->i_mode))
1045 if (list_empty(&(cifsInode->openFileList))) { 1056 shrink_dcache_parent(direntry); */
1046 /* Has changed on server - flush read ahead pages */ 1057 if (S_ISREG(direntry->d_inode->i_mode)) {
1047 cFYI(1, ("Invalidating read ahead data on " 1058 if (direntry->d_inode->i_mapping)
1048 "closed file")); 1059 filemap_fdatawait(direntry->d_inode->i_mapping);
1049 invalidate_remote_inode(direntry->d_inode); 1060 /* may eventually have to do this for open files too */
1061 if (list_empty(&(cifsInode->openFileList))) {
1062 /* changed on server - flush read ahead pages */
1063 cFYI(1, ("Invalidating read ahead data on "
1064 "closed file"));
1065 invalidate_remote_inode(direntry->d_inode);
1066 }
1050 } 1067 }
1051 } 1068 }
1052/* up(&direntry->d_inode->i_sem); */ 1069/* up(&direntry->d_inode->i_sem); */
@@ -1105,9 +1122,20 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1105 1122
1106 cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ", 1123 cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ",
1107 direntry->d_name.name, attrs->ia_valid)); 1124 direntry->d_name.name, attrs->ia_valid));
1125
1108 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1126 cifs_sb = CIFS_SB(direntry->d_inode->i_sb);
1109 pTcon = cifs_sb->tcon; 1127 pTcon = cifs_sb->tcon;
1110 1128
1129 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
1130 /* check if we have permission to change attrs */
1131 rc = inode_change_ok(direntry->d_inode, attrs);
1132 if(rc < 0) {
1133 FreeXid(xid);
1134 return rc;
1135 } else
1136 rc = 0;
1137 }
1138
1111 down(&direntry->d_sb->s_vfs_rename_sem); 1139 down(&direntry->d_sb->s_vfs_rename_sem);
1112 full_path = build_path_from_dentry(direntry); 1140 full_path = build_path_from_dentry(direntry);
1113 up(&direntry->d_sb->s_vfs_rename_sem); 1141 up(&direntry->d_sb->s_vfs_rename_sem);
@@ -1147,7 +1175,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1147 1 /* 45 seconds */); 1175 1 /* 45 seconds */);
1148 cFYI(1,("Wrt seteof rc %d", rc)); 1176 cFYI(1,("Wrt seteof rc %d", rc));
1149 } 1177 }
1150 } 1178 } else
1179 rc = -EINVAL;
1180
1151 if (rc != 0) { 1181 if (rc != 0) {
1152 /* Set file size by pathname rather than by handle 1182 /* Set file size by pathname rather than by handle
1153 either because no valid, writeable file handle for 1183 either because no valid, writeable file handle for