Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
[CIFS] Do not attempt to close invalidated file handles
[CIFS] fix check for dead tcon in smb_init

+36 -11
+5 -1
fs/cifs/CHANGES
··· 8 8 sends, and also let tcp autotune the socket send and receive buffers. 9 9 This reduces the number of EAGAIN errors returned by TCP/IP in 10 10 high stress workloads (and the number of retries on socket writes 11 - when sending large SMBWriteX requests). 11 + when sending large SMBWriteX requests). Fix case in which a portion of 12 + data can in some cases not get written to the file on the server before the 13 + file is closed. Fix DFS parsing to properly handle path consumed field, 14 + and to handle certain codepage conversions better. Fix mount and 15 + umount race that can cause oops in mount or umount or reconnect. 12 16 13 17 Version 1.54 14 18 ------------
+9 -1
fs/cifs/cifsglob.h
··· 606 606 * changes to the tcon->tidStatus should be done while holding this lock. 607 607 */ 608 608 GLOBAL_EXTERN rwlock_t cifs_tcp_ses_lock; 609 - GLOBAL_EXTERN rwlock_t GlobalSMBSeslock; /* protects list inserts on 3 above */ 609 + 610 + /* 611 + * This lock protects the cifs_file->llist and cifs_file->flist 612 + * list operations, and updates to some flags (cifs_file->invalidHandle) 613 + * It will be moved to either use the tcon->stat_lock or equivalent later. 614 + * If cifs_tcp_ses_lock and the lock below are both needed to be held, then 615 + * the cifs_tcp_ses_lock must be grabbed first and released last. 616 + */ 617 + GLOBAL_EXTERN rwlock_t GlobalSMBSeslock; 610 618 611 619 GLOBAL_EXTERN struct list_head GlobalOplock_Q; 612 620
+1 -1
fs/cifs/cifssmb.c
··· 295 295 check for tcp and smb session status done differently 296 296 for those three - in the calling routine */ 297 297 if (tcon) { 298 - if (tcon->need_reconnect) { 298 + if (tcon->tidStatus == CifsExiting) { 299 299 /* only tree disconnect, open, and write, 300 300 (and ulogoff which does not have tcon) 301 301 are allowed as we start force umount */
+14 -7
fs/cifs/file.c
··· 488 488 pTcon = cifs_sb->tcon; 489 489 if (pSMBFile) { 490 490 struct cifsLockInfo *li, *tmp; 491 - 491 + write_lock(&GlobalSMBSeslock); 492 492 pSMBFile->closePend = true; 493 493 if (pTcon) { 494 494 /* no sense reconnecting to close a file that is 495 495 already closed */ 496 496 if (!pTcon->need_reconnect) { 497 + write_unlock(&GlobalSMBSeslock); 497 498 timeout = 2; 498 499 while ((atomic_read(&pSMBFile->wrtPending) != 0) 499 500 && (timeout <= 2048)) { ··· 511 510 timeout *= 4; 512 511 } 513 512 if (atomic_read(&pSMBFile->wrtPending)) 514 - cERROR(1, 515 - ("close with pending writes")); 516 - rc = CIFSSMBClose(xid, pTcon, 513 + cERROR(1, ("close with pending write")); 514 + if (!pTcon->need_reconnect && 515 + !pSMBFile->invalidHandle) 516 + rc = CIFSSMBClose(xid, pTcon, 517 517 pSMBFile->netfid); 518 - } 519 - } 518 + } else 519 + write_unlock(&GlobalSMBSeslock); 520 + } else 521 + write_unlock(&GlobalSMBSeslock); 520 522 521 523 /* Delete any outstanding lock records. 522 524 We'll lose them when the file is closed anyway. */ ··· 591 587 pTcon = cifs_sb->tcon; 592 588 593 589 cFYI(1, ("Freeing private data in close dir")); 590 + write_lock(&GlobalSMBSeslock); 594 591 if (!pCFileStruct->srch_inf.endOfSearch && 595 592 !pCFileStruct->invalidHandle) { 596 593 pCFileStruct->invalidHandle = true; 594 + write_unlock(&GlobalSMBSeslock); 597 595 rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); 598 596 cFYI(1, ("Closing uncompleted readdir with rc %d", 599 597 rc)); 600 598 /* not much we can do if it fails anyway, ignore rc */ 601 599 rc = 0; 602 - } 600 + } else 601 + write_unlock(&GlobalSMBSeslock); 603 602 ptmp = pCFileStruct->srch_inf.ntwrk_buf_start; 604 603 if (ptmp) { 605 604 cFYI(1, ("closedir free smb buf in srch struct"));
+3
fs/cifs/misc.c
··· 555 555 continue; 556 556 557 557 cifs_stats_inc(&tcon->num_oplock_brks); 558 + write_lock(&GlobalSMBSeslock); 558 559 list_for_each(tmp2, &tcon->openFileList) { 559 560 netfile = list_entry(tmp2, struct cifsFileInfo, 560 561 tlist); 561 562 if (pSMB->Fid != netfile->netfid) 562 563 continue; 563 564 565 + write_unlock(&GlobalSMBSeslock); 564 566 read_unlock(&cifs_tcp_ses_lock); 565 567 cFYI(1, ("file id match, oplock break")); 566 568 pCifsInode = CIFS_I(netfile->pInode); ··· 578 576 579 577 return true; 580 578 } 579 + write_unlock(&GlobalSMBSeslock); 581 580 read_unlock(&cifs_tcp_ses_lock); 582 581 cFYI(1, ("No matching file for oplock break")); 583 582 return true;
+4 -1
fs/cifs/readdir.c
··· 741 741 (index_to_find < first_entry_in_buffer)) { 742 742 /* close and restart search */ 743 743 cFYI(1, ("search backing up - close and restart search")); 744 + write_lock(&GlobalSMBSeslock); 744 745 if (!cifsFile->srch_inf.endOfSearch && 745 746 !cifsFile->invalidHandle) { 746 747 cifsFile->invalidHandle = true; 748 + write_unlock(&GlobalSMBSeslock); 747 749 CIFSFindClose(xid, pTcon, cifsFile->netfid); 748 - } 750 + } else 751 + write_unlock(&GlobalSMBSeslock); 749 752 if (cifsFile->srch_inf.ntwrk_buf_start) { 750 753 cFYI(1, ("freeing SMB ff cache buf on search rewind")); 751 754 if (cifsFile->srch_inf.smallBuf)