Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

+49 -41
+2 -2
fs/cifs/README
··· 371 371 on newly created files, directories, and devices (create, 372 372 mkdir, mknod) which will result in the server setting the 373 373 uid and gid to the default (usually the server uid of the 374 - usern who mounted the share). Letting the server (rather than 374 + user who mounted the share). Letting the server (rather than 375 375 the client) set the uid and gid is the default. This 376 376 parameter has no effect if the CIFS Unix Extensions are not 377 377 negotiated. ··· 384 384 client (e.g. when the application is doing large sequential 385 385 reads bigger than page size without rereading the same data) 386 386 this can provide better performance than the default 387 - behavior which caches reads (reaadahead) and writes 387 + behavior which caches reads (readahead) and writes 388 388 (writebehind) through the local Linux client pagecache 389 389 if oplock (caching token) is granted and held. Note that 390 390 direct allows write operations larger than page size
+1 -1
fs/cifs/cifsproto.h
··· 228 228 const struct nls_table *nls_codepage, 229 229 int remap_special_chars); 230 230 #endif /* CONFIG_CIFS_EXPERIMENTAL */ 231 - extern int cifs_convertUCSpath(char *target, const __u16 *source, int maxlen, 231 + extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen, 232 232 const struct nls_table * codepage); 233 233 extern int cifsConvertToUCS(__le16 * target, const char *source, int maxlen, 234 234 const struct nls_table * cp, int mapChars);
+28 -28
fs/cifs/cifssmb.c
··· 567 567 568 568 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 569 569 name_len = 570 - cifsConvertToUCS((__u16 *) pSMB->fileName, fileName, 570 + cifsConvertToUCS((__le16 *) pSMB->fileName, fileName, 571 571 PATH_MAX, nls_codepage, remap); 572 572 name_len++; /* trailing null */ 573 573 name_len *= 2; ··· 665 665 return rc; 666 666 667 667 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 668 - name_len = cifsConvertToUCS((__u16 *) pSMB->DirName, name, 668 + name_len = cifsConvertToUCS((__le16 *) pSMB->DirName, name, 669 669 PATH_MAX, nls_codepage, remap); 670 670 name_len++; /* trailing null */ 671 671 name_len *= 2; ··· 719 719 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 720 720 count = 1; /* account for one byte pad to word boundary */ 721 721 name_len = 722 - cifsConvertToUCS((__u16 *) (pSMB->fileName + 1), 722 + cifsConvertToUCS((__le16 *) (pSMB->fileName + 1), 723 723 fileName, PATH_MAX, nls_codepage, remap); 724 724 name_len++; /* trailing null */ 725 725 name_len *= 2; ··· 1141 1141 1142 1142 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1143 1143 name_len = 1144 - cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName, 1144 + cifsConvertToUCS((__le16 *) pSMB->OldFileName, fromName, 1145 1145 PATH_MAX, nls_codepage, remap); 1146 1146 name_len++; /* trailing null */ 1147 1147 name_len *= 2; ··· 1149 1149 /* protocol requires ASCII signature byte on Unicode string */ 1150 1150 pSMB->OldFileName[name_len + 1] = 0x00; 1151 1151 name_len2 = 1152 - cifsConvertToUCS((__u16 *) &pSMB->OldFileName[name_len + 2], 1152 + cifsConvertToUCS((__le16 *) &pSMB->OldFileName[name_len + 2], 1153 1153 toName, PATH_MAX, nls_codepage, remap); 1154 1154 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1155 1155 name_len2 *= 2; /* convert to bytes */ ··· 1236 1236 /* unicode only call */ 1237 1237 if(target_name == NULL) { 1238 1238 sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid); 1239 - len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name, 1239 + len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name, 1240 1240 dummy_string, 24, nls_codepage, remap); 1241 1241 } else { 1242 - len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name, 1242 + len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name, 1243 1243 target_name, PATH_MAX, nls_codepage, remap); 1244 1244 } 1245 1245 rename_info->target_name_len = cpu_to_le32(2 * len_of_str); ··· 1296 1296 pSMB->Flags = cpu_to_le16(flags & COPY_TREE); 1297 1297 1298 1298 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1299 - name_len = cifsConvertToUCS((__u16 *) pSMB->OldFileName, 1299 + name_len = cifsConvertToUCS((__le16 *) pSMB->OldFileName, 1300 1300 fromName, PATH_MAX, nls_codepage, 1301 1301 remap); 1302 1302 name_len++; /* trailing null */ ··· 1304 1304 pSMB->OldFileName[name_len] = 0x04; /* pad */ 1305 1305 /* protocol requires ASCII signature byte on Unicode string */ 1306 1306 pSMB->OldFileName[name_len + 1] = 0x00; 1307 - name_len2 = cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2], 1307 + name_len2 = cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2], 1308 1308 toName, PATH_MAX, nls_codepage, remap); 1309 1309 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1310 1310 name_len2 *= 2; /* convert to bytes */ ··· 1453 1453 return rc; 1454 1454 1455 1455 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1456 - name_len = cifsConvertToUCS((__u16 *) pSMB->FileName, toName, 1456 + name_len = cifsConvertToUCS((__le16 *) pSMB->FileName, toName, 1457 1457 PATH_MAX, nls_codepage, remap); 1458 1458 name_len++; /* trailing null */ 1459 1459 name_len *= 2; ··· 1476 1476 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 1477 1477 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1478 1478 name_len_target = 1479 - cifsConvertToUCS((__u16 *) data_offset, fromName, PATH_MAX, 1479 + cifsConvertToUCS((__le16 *) data_offset, fromName, PATH_MAX, 1480 1480 nls_codepage, remap); 1481 1481 name_len_target++; /* trailing null */ 1482 1482 name_len_target *= 2; ··· 1546 1546 1547 1547 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1548 1548 name_len = 1549 - cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName, 1549 + cifsConvertToUCS((__le16 *) pSMB->OldFileName, fromName, 1550 1550 PATH_MAX, nls_codepage, remap); 1551 1551 name_len++; /* trailing null */ 1552 1552 name_len *= 2; 1553 1553 pSMB->OldFileName[name_len] = 0; /* pad */ 1554 1554 pSMB->OldFileName[name_len + 1] = 0x04; 1555 1555 name_len2 = 1556 - cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2], 1556 + cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2], 1557 1557 toName, PATH_MAX, nls_codepage, remap); 1558 1558 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1559 1559 name_len2 *= 2; /* convert to bytes */ ··· 1939 1939 1940 1940 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1941 1941 name_len = 1942 - cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 1942 + cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 1943 1943 PATH_MAX, nls_codepage, remap); 1944 1944 name_len++; /* trailing null */ 1945 1945 name_len *= 2; ··· 2024 2024 return rc; 2025 2025 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2026 2026 name_len = 2027 - cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 2027 + cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 2028 2028 PATH_MAX, nls_codepage, remap); 2029 2029 name_len++; /* trailing null */ 2030 2030 name_len *= 2; ··· 2188 2188 2189 2189 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2190 2190 name_len = 2191 - cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 2191 + cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 2192 2192 PATH_MAX, nls_codepage, remap); 2193 2193 name_len++; /* trailing null */ 2194 2194 name_len *= 2; ··· 2269 2269 2270 2270 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2271 2271 name_len = 2272 - cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 2272 + cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 2273 2273 PATH_MAX, nls_codepage, remap); 2274 2274 name_len++; /* trailing null */ 2275 2275 name_len *= 2; ··· 2350 2350 2351 2351 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2352 2352 name_len = 2353 - cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2353 + cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, PATH_MAX 2354 2354 /* find define for this maxpathcomponent */ 2355 2355 , nls_codepage); 2356 2356 name_len++; /* trailing null */ ··· 2435 2435 2436 2436 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2437 2437 name_len = 2438 - cifsConvertToUCS((__u16 *) pSMB->FileName,searchName, 2438 + cifsConvertToUCS((__le16 *) pSMB->FileName,searchName, 2439 2439 PATH_MAX, nls_codepage, remap); 2440 2440 /* We can not add the asterik earlier in case 2441 2441 it got remapped to 0xF03A as if it were part of the ··· 2726 2726 2727 2727 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2728 2728 name_len = 2729 - cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 2729 + cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 2730 2730 PATH_MAX,nls_codepage, remap); 2731 2731 name_len++; /* trailing null */ 2732 2732 name_len *= 2; ··· 2837 2837 if (ses->capabilities & CAP_UNICODE) { 2838 2838 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; 2839 2839 name_len = 2840 - cifsConvertToUCS((__u16 *) pSMB->RequestFileName, 2840 + cifsConvertToUCS((__le16 *) pSMB->RequestFileName, 2841 2841 searchName, PATH_MAX, nls_codepage, remap); 2842 2842 name_len++; /* trailing null */ 2843 2843 name_len *= 2; ··· 3369 3369 3370 3370 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3371 3371 name_len = 3372 - cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 3372 + cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 3373 3373 PATH_MAX, nls_codepage, remap); 3374 3374 name_len++; /* trailing null */ 3375 3375 name_len *= 2; ··· 3627 3627 3628 3628 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3629 3629 name_len = 3630 - cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 3630 + cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 3631 3631 PATH_MAX, nls_codepage, remap); 3632 3632 name_len++; /* trailing null */ 3633 3633 name_len *= 2; ··· 3708 3708 3709 3709 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3710 3710 name_len = 3711 - ConvertToUCS((wchar_t *) pSMB->fileName, fileName, 3711 + ConvertToUCS((__le16 *) pSMB->fileName, fileName, 3712 3712 PATH_MAX, nls_codepage); 3713 3713 name_len++; /* trailing null */ 3714 3714 name_len *= 2; ··· 3759 3759 3760 3760 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3761 3761 name_len = 3762 - cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 3762 + cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 3763 3763 PATH_MAX, nls_codepage, remap); 3764 3764 name_len++; /* trailing null */ 3765 3765 name_len *= 2; ··· 3904 3904 3905 3905 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3906 3906 name_len = 3907 - cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName, 3907 + cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 3908 3908 PATH_MAX, nls_codepage, remap); 3909 3909 name_len++; /* trailing null */ 3910 3910 name_len *= 2; ··· 4047 4047 4048 4048 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4049 4049 name_len = 4050 - cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 4050 + cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 4051 4051 PATH_MAX, nls_codepage, remap); 4052 4052 name_len++; /* trailing null */ 4053 4053 name_len *= 2; ··· 4194 4194 4195 4195 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4196 4196 name_len = 4197 - cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 4197 + cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 4198 4198 PATH_MAX, nls_codepage, remap); 4199 4199 name_len++; /* trailing null */ 4200 4200 name_len *= 2;
+2 -1
fs/cifs/dir.c
··· 392 392 rc = 0; 393 393 d_add(direntry, NULL); 394 394 } else { 395 - cERROR(1,("Error 0x%x or on cifs_get_inode_info in lookup",rc)); 395 + cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s", 396 + rc,full_path)); 396 397 /* BB special case check for Access Denied - watch security 397 398 exposure of returning dir info implicitly via different rc 398 399 if file exists or not but no access BB */
+15 -9
fs/cifs/inode.c
··· 422 422 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 423 423 424 424 if (!rc) { 425 - direntry->d_inode->i_nlink--; 425 + if(direntry->d_inode) 426 + direntry->d_inode->i_nlink--; 426 427 } else if (rc == -ENOENT) { 427 428 d_drop(direntry); 428 429 } else if (rc == -ETXTBSY) { ··· 441 440 cifs_sb->mnt_cifs_flags & 442 441 CIFS_MOUNT_MAP_SPECIAL_CHR); 443 442 CIFSSMBClose(xid, pTcon, netfid); 444 - direntry->d_inode->i_nlink--; 443 + if(direntry->d_inode) 444 + direntry->d_inode->i_nlink--; 445 445 } 446 446 } else if (rc == -EACCES) { 447 447 /* try only if r/o attribute set in local lookup data? */ ··· 496 494 cifs_sb->mnt_cifs_flags & 497 495 CIFS_MOUNT_MAP_SPECIAL_CHR); 498 496 if (!rc) { 499 - direntry->d_inode->i_nlink--; 497 + if(direntry->d_inode) 498 + direntry->d_inode->i_nlink--; 500 499 } else if (rc == -ETXTBSY) { 501 500 int oplock = FALSE; 502 501 __u16 netfid; ··· 517 514 cifs_sb->mnt_cifs_flags & 518 515 CIFS_MOUNT_MAP_SPECIAL_CHR); 519 516 CIFSSMBClose(xid, pTcon, netfid); 520 - direntry->d_inode->i_nlink--; 517 + if(direntry->d_inode) 518 + direntry->d_inode->i_nlink--; 521 519 } 522 520 /* BB if rc = -ETXTBUSY goto the rename logic BB */ 523 521 } 524 522 } 525 523 } 526 - cifsInode = CIFS_I(direntry->d_inode); 527 - cifsInode->time = 0; /* will force revalidate to get info when 528 - needed */ 529 - direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = 530 - current_fs_time(inode->i_sb); 524 + if(direntry->d_inode) { 525 + cifsInode = CIFS_I(direntry->d_inode); 526 + cifsInode->time = 0; /* will force revalidate to get info 527 + when needed */ 528 + direntry->d_inode->i_ctime = current_fs_time(inode->i_sb); 529 + } 530 + inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb); 531 531 cifsInode = CIFS_I(inode); 532 532 cifsInode->time = 0; /* force revalidate of dir as well */ 533 533
+1
fs/cifs/misc.c
··· 571 571 break; 572 572 case UNI_LESSTHAN: 573 573 target[j] = '<'; 574 + break; 574 575 default: 575 576 len = cp->uni2char(src_char, &target[j], 576 577 NLS_MAX_CHARSET_SIZE);