[CIFS] report rename failure when target file is locked by Windows

Fixes Samba bugzilla bug # 4182

Rename by handle failures (retry after rename by path) were not
being returned back.

Signed-off-by: Steve French <sfrench@us.ibm.com>

+12 -6
+3 -1
fs/cifs/CHANGES
··· 3 Support deep tree mounts. Better support OS/2, Win9x (DOS) time stamps. 4 Allow null user to be specified on mount ("username="). Do not return 5 EINVAL on readdir when filldir fails due to overwritten blocksize 6 - (fixes FC problem) 7 8 Version 1.45 9 ------------
··· 3 Support deep tree mounts. Better support OS/2, Win9x (DOS) time stamps. 4 Allow null user to be specified on mount ("username="). Do not return 5 EINVAL on readdir when filldir fails due to overwritten blocksize 6 + (fixes FC problem). Return error in rename 2nd attempt retry (ie report 7 + if rename by handle also fails, after rename by path fails, we were 8 + not reporting whether the retry worked or not). 9 10 Version 1.45 11 ------------
+9 -5
fs/cifs/inode.c
··· 885 kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); 886 if (info_buf_source != NULL) { 887 info_buf_target = info_buf_source + 1; 888 - rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, 889 - info_buf_source, cifs_sb_source->local_nls, 890 - cifs_sb_source->mnt_cifs_flags & 891 - CIFS_MOUNT_MAP_SPECIAL_CHR); 892 if (rc == 0) { 893 rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName, 894 info_buf_target, ··· 941 cifs_sb_source->mnt_cifs_flags & 942 CIFS_MOUNT_MAP_SPECIAL_CHR); 943 if (rc==0) { 944 - CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, 945 cifs_sb_source->local_nls, 946 cifs_sb_source->mnt_cifs_flags & 947 CIFS_MOUNT_MAP_SPECIAL_CHR);
··· 885 kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); 886 if (info_buf_source != NULL) { 887 info_buf_target = info_buf_source + 1; 888 + if (pTcon->ses->capabilities & CAP_UNIX) 889 + rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, 890 + info_buf_source, 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 */ 896 if (rc == 0) { 897 rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName, 898 info_buf_target, ··· 937 cifs_sb_source->mnt_cifs_flags & 938 CIFS_MOUNT_MAP_SPECIAL_CHR); 939 if (rc==0) { 940 + rc = CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, 941 cifs_sb_source->local_nls, 942 cifs_sb_source->mnt_cifs_flags & 943 CIFS_MOUNT_MAP_SPECIAL_CHR);