* 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
···88sends, and also let tcp autotune the socket send and receive buffers.99This reduces the number of EAGAIN errors returned by TCP/IP in1010high stress workloads (and the number of retries on socket writes1111-when sending large SMBWriteX requests).1111+when sending large SMBWriteX requests). Fix case in which a portion of1212+data can in some cases not get written to the file on the server before the1313+file is closed. Fix DFS parsing to properly handle path consumed field,1414+and to handle certain codepage conversions better. Fix mount and1515+umount race that can cause oops in mount or umount or reconnect.12161317Version 1.541418------------
+9-1
fs/cifs/cifsglob.h
···606606 * changes to the tcon->tidStatus should be done while holding this lock.607607 */608608GLOBAL_EXTERN rwlock_t cifs_tcp_ses_lock;609609-GLOBAL_EXTERN rwlock_t GlobalSMBSeslock; /* protects list inserts on 3 above */609609+610610+/*611611+ * This lock protects the cifs_file->llist and cifs_file->flist612612+ * list operations, and updates to some flags (cifs_file->invalidHandle)613613+ * It will be moved to either use the tcon->stat_lock or equivalent later.614614+ * If cifs_tcp_ses_lock and the lock below are both needed to be held, then615615+ * the cifs_tcp_ses_lock must be grabbed first and released last.616616+ */617617+GLOBAL_EXTERN rwlock_t GlobalSMBSeslock;610618611619GLOBAL_EXTERN struct list_head GlobalOplock_Q;612620
+1-1
fs/cifs/cifssmb.c
···295295 check for tcp and smb session status done differently296296 for those three - in the calling routine */297297 if (tcon) {298298- if (tcon->need_reconnect) {298298+ if (tcon->tidStatus == CifsExiting) {299299 /* only tree disconnect, open, and write,300300 (and ulogoff which does not have tcon)301301 are allowed as we start force umount */
+14-7
fs/cifs/file.c
···488488 pTcon = cifs_sb->tcon;489489 if (pSMBFile) {490490 struct cifsLockInfo *li, *tmp;491491-491491+ write_lock(&GlobalSMBSeslock);492492 pSMBFile->closePend = true;493493 if (pTcon) {494494 /* no sense reconnecting to close a file that is495495 already closed */496496 if (!pTcon->need_reconnect) {497497+ write_unlock(&GlobalSMBSeslock);497498 timeout = 2;498499 while ((atomic_read(&pSMBFile->wrtPending) != 0)499500 && (timeout <= 2048)) {···511510 timeout *= 4;512511 }513512 if (atomic_read(&pSMBFile->wrtPending))514514- cERROR(1,515515- ("close with pending writes"));516516- rc = CIFSSMBClose(xid, pTcon,513513+ cERROR(1, ("close with pending write"));514514+ if (!pTcon->need_reconnect &&515515+ !pSMBFile->invalidHandle)516516+ rc = CIFSSMBClose(xid, pTcon,517517 pSMBFile->netfid);518518- }519519- }518518+ } else519519+ write_unlock(&GlobalSMBSeslock);520520+ } else521521+ write_unlock(&GlobalSMBSeslock);520522521523 /* Delete any outstanding lock records.522524 We'll lose them when the file is closed anyway. */···591587 pTcon = cifs_sb->tcon;592588593589 cFYI(1, ("Freeing private data in close dir"));590590+ write_lock(&GlobalSMBSeslock);594591 if (!pCFileStruct->srch_inf.endOfSearch &&595592 !pCFileStruct->invalidHandle) {596593 pCFileStruct->invalidHandle = true;594594+ write_unlock(&GlobalSMBSeslock);597595 rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid);598596 cFYI(1, ("Closing uncompleted readdir with rc %d",599597 rc));600598 /* not much we can do if it fails anyway, ignore rc */601599 rc = 0;602602- }600600+ } else601601+ write_unlock(&GlobalSMBSeslock);603602 ptmp = pCFileStruct->srch_inf.ntwrk_buf_start;604603 if (ptmp) {605604 cFYI(1, ("closedir free smb buf in srch struct"));