diff options
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 6b90ef98e4cf..1ad8c9fcc742 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -337,6 +337,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
337 | pfindData = (FILE_ALL_INFO *)buf; | 337 | pfindData = (FILE_ALL_INFO *)buf; |
338 | /* could do find first instead but this returns more info */ | 338 | /* could do find first instead but this returns more info */ |
339 | rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData, | 339 | rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData, |
340 | 0 /* not legacy */, | ||
340 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 341 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & |
341 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 342 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
342 | /* BB optimize code so we do not make the above call | 343 | /* BB optimize code so we do not make the above call |
@@ -384,8 +385,10 @@ int cifs_get_inode_info(struct inode **pinode, | |||
384 | /* get new inode */ | 385 | /* get new inode */ |
385 | if (*pinode == NULL) { | 386 | if (*pinode == NULL) { |
386 | *pinode = new_inode(sb); | 387 | *pinode = new_inode(sb); |
387 | if (*pinode == NULL) | 388 | if (*pinode == NULL) { |
389 | kfree(buf); | ||
388 | return -ENOMEM; | 390 | return -ENOMEM; |
391 | } | ||
389 | /* Is an i_ino of zero legal? Can we use that to check | 392 | /* Is an i_ino of zero legal? Can we use that to check |
390 | if the server supports returning inode numbers? Are | 393 | if the server supports returning inode numbers? Are |
391 | there other sanity checks we can use to ensure that | 394 | there other sanity checks we can use to ensure that |
@@ -431,8 +434,11 @@ int cifs_get_inode_info(struct inode **pinode, | |||
431 | (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ | 434 | (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ |
432 | 435 | ||
433 | /* Linux can not store file creation time so ignore it */ | 436 | /* Linux can not store file creation time so ignore it */ |
434 | inode->i_atime = | 437 | if(pfindData->LastAccessTime) |
435 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastAccessTime)); | 438 | inode->i_atime = cifs_NTtimeToUnix |
439 | (le64_to_cpu(pfindData->LastAccessTime)); | ||
440 | else /* do not need to use current_fs_time - time not stored */ | ||
441 | inode->i_atime = CURRENT_TIME; | ||
436 | inode->i_mtime = | 442 | inode->i_mtime = |
437 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); | 443 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); |
438 | inode->i_ctime = | 444 | inode->i_ctime = |
@@ -879,10 +885,14 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, | |||
879 | kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); | 885 | kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); |
880 | if (info_buf_source != NULL) { | 886 | if (info_buf_source != NULL) { |
881 | info_buf_target = info_buf_source + 1; | 887 | info_buf_target = info_buf_source + 1; |
882 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, | 888 | if (pTcon->ses->capabilities & CAP_UNIX) |
883 | info_buf_source, cifs_sb_source->local_nls, | 889 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, |
884 | cifs_sb_source->mnt_cifs_flags & | 890 | info_buf_source, |
885 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 891 | cifs_sb_source->local_nls, |
892 | cifs_sb_source->mnt_cifs_flags & | ||
893 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
894 | /* else rc is still EEXIST so will fall through to | ||
895 | unlink the target and retry rename */ | ||
886 | if (rc == 0) { | 896 | if (rc == 0) { |
887 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName, | 897 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName, |
888 | info_buf_target, | 898 | info_buf_target, |
@@ -931,7 +941,7 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, | |||
931 | cifs_sb_source->mnt_cifs_flags & | 941 | cifs_sb_source->mnt_cifs_flags & |
932 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 942 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
933 | if (rc==0) { | 943 | if (rc==0) { |
934 | CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, | 944 | rc = CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, |
935 | cifs_sb_source->local_nls, | 945 | cifs_sb_source->local_nls, |
936 | cifs_sb_source->mnt_cifs_flags & | 946 | cifs_sb_source->mnt_cifs_flags & |
937 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 947 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
@@ -1079,8 +1089,10 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1079 | struct kstat *stat) | 1089 | struct kstat *stat) |
1080 | { | 1090 | { |
1081 | int err = cifs_revalidate(dentry); | 1091 | int err = cifs_revalidate(dentry); |
1082 | if (!err) | 1092 | if (!err) { |
1083 | generic_fillattr(dentry->d_inode, stat); | 1093 | generic_fillattr(dentry->d_inode, stat); |
1094 | stat->blksize = CIFS_MAX_MSGSIZE; | ||
1095 | } | ||
1084 | return err; | 1096 | return err; |
1085 | } | 1097 | } |
1086 | 1098 | ||