aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r--fs/cifs/dir.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index fb69c1fa85c9..634cf330fe04 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -226,23 +226,26 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
226 /* If Open reported that we actually created a file 226 /* If Open reported that we actually created a file
227 then we now have to set the mode if possible */ 227 then we now have to set the mode if possible */
228 if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { 228 if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
229 struct cifs_unix_set_info_args args = {
230 .mode = mode,
231 .ctime = NO_CHANGE_64,
232 .atime = NO_CHANGE_64,
233 .mtime = NO_CHANGE_64,
234 .device = 0,
235 };
236
229 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 237 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
230 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, 238 args.uid = (__u64) current->fsuid;
231 (__u64)current->fsuid, 239 args.gid = (__u64) current->fsgid;
232 (__u64)current->fsgid,
233 0 /* dev */,
234 cifs_sb->local_nls,
235 cifs_sb->mnt_cifs_flags &
236 CIFS_MOUNT_MAP_SPECIAL_CHR);
237 } else { 240 } else {
238 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, 241 args.uid = NO_CHANGE_64;
239 (__u64)-1, 242 args.gid = NO_CHANGE_64;
240 (__u64)-1,
241 0 /* dev */,
242 cifs_sb->local_nls,
243 cifs_sb->mnt_cifs_flags &
244 CIFS_MOUNT_MAP_SPECIAL_CHR);
245 } 243 }
244
245 CIFSSMBUnixSetInfo(xid, pTcon, full_path, &args,
246 cifs_sb->local_nls,
247 cifs_sb->mnt_cifs_flags &
248 CIFS_MOUNT_MAP_SPECIAL_CHR);
246 } else { 249 } else {
247 /* BB implement mode setting via Windows security 250 /* BB implement mode setting via Windows security
248 descriptors e.g. */ 251 descriptors e.g. */
@@ -357,21 +360,24 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
357 if (full_path == NULL) 360 if (full_path == NULL)
358 rc = -ENOMEM; 361 rc = -ENOMEM;
359 else if (pTcon->unix_ext) { 362 else if (pTcon->unix_ext) {
360 mode &= ~current->fs->umask; 363 struct cifs_unix_set_info_args args = {
364 .mode = mode & ~current->fs->umask,
365 .ctime = NO_CHANGE_64,
366 .atime = NO_CHANGE_64,
367 .mtime = NO_CHANGE_64,
368 .device = device_number,
369 };
361 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 370 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
362 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, 371 args.uid = (__u64) current->fsuid;
363 mode, (__u64)current->fsuid, 372 args.gid = (__u64) current->fsgid;
364 (__u64)current->fsgid,
365 device_number, cifs_sb->local_nls,
366 cifs_sb->mnt_cifs_flags &
367 CIFS_MOUNT_MAP_SPECIAL_CHR);
368 } else { 373 } else {
369 rc = CIFSSMBUnixSetPerms(xid, pTcon, 374 args.uid = NO_CHANGE_64;
370 full_path, mode, (__u64)-1, (__u64)-1, 375 args.gid = NO_CHANGE_64;
371 device_number, cifs_sb->local_nls,
372 cifs_sb->mnt_cifs_flags &
373 CIFS_MOUNT_MAP_SPECIAL_CHR);
374 } 376 }
377 rc = CIFSSMBUnixSetInfo(xid, pTcon, full_path,
378 &args, cifs_sb->local_nls,
379 cifs_sb->mnt_cifs_flags &
380 CIFS_MOUNT_MAP_SPECIAL_CHR);
375 381
376 if (!rc) { 382 if (!rc) {
377 rc = cifs_get_inode_info_unix(&newinode, full_path, 383 rc = cifs_get_inode_info_unix(&newinode, full_path,