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 tag 'v6.14-rc7-smb3-client-fix' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fix from Steve French:
"smb3 client reconnect fix"

* tag 'v6.14-rc7-smb3-client-fix' of git://git.samba.org/sfrench/cifs-2.6:
smb: client: don't retry IO on failed negprotos with soft mounts

+69 -73
+27 -19
fs/smb/client/cifssmb.c
··· 114 114 115 115 mutex_lock(&ses->session_mutex); 116 116 /* 117 - * Recheck after acquire mutex. If another thread is negotiating 118 - * and the server never sends an answer the socket will be closed 119 - * and tcpStatus set to reconnect. 117 + * Handle the case where a concurrent thread failed to negotiate or 118 + * killed a channel. 120 119 */ 121 120 spin_lock(&server->srv_lock); 122 - if (server->tcpStatus == CifsNeedReconnect) { 121 + switch (server->tcpStatus) { 122 + case CifsExiting: 123 123 spin_unlock(&server->srv_lock); 124 124 mutex_unlock(&ses->session_mutex); 125 - 126 - if (tcon->retry) 127 - goto again; 128 - rc = -EHOSTDOWN; 129 - goto out; 125 + return -EHOSTDOWN; 126 + case CifsNeedReconnect: 127 + spin_unlock(&server->srv_lock); 128 + mutex_unlock(&ses->session_mutex); 129 + if (!tcon->retry) 130 + return -EHOSTDOWN; 131 + goto again; 132 + default: 133 + break; 130 134 } 131 135 spin_unlock(&server->srv_lock); 132 136 ··· 156 152 spin_unlock(&ses->ses_lock); 157 153 158 154 rc = cifs_negotiate_protocol(0, ses, server); 159 - if (!rc) { 160 - rc = cifs_setup_session(0, ses, server, ses->local_nls); 161 - if ((rc == -EACCES) || (rc == -EHOSTDOWN) || (rc == -EKEYREVOKED)) { 162 - /* 163 - * Try alternate password for next reconnect if an alternate 164 - * password is available. 165 - */ 166 - if (ses->password2) 167 - swap(ses->password2, ses->password); 168 - } 155 + if (rc) { 156 + mutex_unlock(&ses->session_mutex); 157 + if (!tcon->retry) 158 + return -EHOSTDOWN; 159 + goto again; 160 + } 161 + rc = cifs_setup_session(0, ses, server, ses->local_nls); 162 + if ((rc == -EACCES) || (rc == -EHOSTDOWN) || (rc == -EKEYREVOKED)) { 163 + /* 164 + * Try alternate password for next reconnect if an alternate 165 + * password is available. 166 + */ 167 + if (ses->password2) 168 + swap(ses->password2, ses->password); 169 169 } 170 170 171 171 /* do we need to reconnect tcon? */
+42 -54
fs/smb/client/smb2pdu.c
··· 300 300 301 301 mutex_lock(&ses->session_mutex); 302 302 /* 303 - * if this is called by delayed work, and the channel has been disabled 304 - * in parallel, the delayed work can continue to execute in parallel 305 - * there's a chance that this channel may not exist anymore 303 + * Handle the case where a concurrent thread failed to negotiate or 304 + * killed a channel. 306 305 */ 307 306 spin_lock(&server->srv_lock); 308 - if (server->tcpStatus == CifsExiting) { 307 + switch (server->tcpStatus) { 308 + case CifsExiting: 309 309 spin_unlock(&server->srv_lock); 310 310 mutex_unlock(&ses->session_mutex); 311 - rc = -EHOSTDOWN; 312 - goto out; 313 - } 314 - 315 - /* 316 - * Recheck after acquire mutex. If another thread is negotiating 317 - * and the server never sends an answer the socket will be closed 318 - * and tcpStatus set to reconnect. 319 - */ 320 - if (server->tcpStatus == CifsNeedReconnect) { 311 + return -EHOSTDOWN; 312 + case CifsNeedReconnect: 321 313 spin_unlock(&server->srv_lock); 322 314 mutex_unlock(&ses->session_mutex); 323 - 324 - if (tcon->retry) 325 - goto again; 326 - 327 - rc = -EHOSTDOWN; 328 - goto out; 315 + if (!tcon->retry) 316 + return -EHOSTDOWN; 317 + goto again; 318 + default: 319 + break; 329 320 } 330 321 spin_unlock(&server->srv_lock); 331 322 ··· 341 350 spin_unlock(&ses->ses_lock); 342 351 343 352 rc = cifs_negotiate_protocol(0, ses, server); 344 - if (!rc) { 345 - /* 346 - * if server stopped supporting multichannel 347 - * and the first channel reconnected, disable all the others. 348 - */ 349 - if (ses->chan_count > 1 && 350 - !(server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { 351 - rc = cifs_chan_skip_or_disable(ses, server, 352 - from_reconnect); 353 - if (rc) { 354 - mutex_unlock(&ses->session_mutex); 355 - goto out; 356 - } 357 - } 358 - 359 - rc = cifs_setup_session(0, ses, server, ses->local_nls); 360 - if ((rc == -EACCES) || (rc == -EKEYEXPIRED) || (rc == -EKEYREVOKED)) { 361 - /* 362 - * Try alternate password for next reconnect (key rotation 363 - * could be enabled on the server e.g.) if an alternate 364 - * password is available and the current password is expired, 365 - * but do not swap on non pwd related errors like host down 366 - */ 367 - if (ses->password2) 368 - swap(ses->password2, ses->password); 369 - } 370 - 371 - if ((rc == -EACCES) && !tcon->retry) { 372 - mutex_unlock(&ses->session_mutex); 373 - rc = -EHOSTDOWN; 374 - goto failed; 375 - } else if (rc) { 353 + if (rc) { 354 + mutex_unlock(&ses->session_mutex); 355 + if (!tcon->retry) 356 + return -EHOSTDOWN; 357 + goto again; 358 + } 359 + /* 360 + * if server stopped supporting multichannel 361 + * and the first channel reconnected, disable all the others. 362 + */ 363 + if (ses->chan_count > 1 && 364 + !(server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { 365 + rc = cifs_chan_skip_or_disable(ses, server, 366 + from_reconnect); 367 + if (rc) { 376 368 mutex_unlock(&ses->session_mutex); 377 369 goto out; 378 370 } 379 - } else { 371 + } 372 + 373 + rc = cifs_setup_session(0, ses, server, ses->local_nls); 374 + if ((rc == -EACCES) || (rc == -EKEYEXPIRED) || (rc == -EKEYREVOKED)) { 375 + /* 376 + * Try alternate password for next reconnect (key rotation 377 + * could be enabled on the server e.g.) if an alternate 378 + * password is available and the current password is expired, 379 + * but do not swap on non pwd related errors like host down 380 + */ 381 + if (ses->password2) 382 + swap(ses->password2, ses->password); 383 + } 384 + if (rc) { 380 385 mutex_unlock(&ses->session_mutex); 386 + if (rc == -EACCES && !tcon->retry) 387 + return -EHOSTDOWN; 381 388 goto out; 382 389 } 383 390 ··· 479 490 case SMB2_IOCTL: 480 491 rc = -EAGAIN; 481 492 } 482 - failed: 483 493 return rc; 484 494 } 485 495