@@ -232,7 +232,7 @@ static int
232
232
small_smb_init (int smb_command , int wct , struct cifsTconInfo * tcon ,
233
233
void * * request_buf )
234
234
{
235
- int rc = 0 ;
235
+ int rc ;
236
236
237
237
rc = cifs_reconnect_tcon (tcon , smb_command );
238
238
if (rc )
@@ -250,7 +250,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
250
250
if (tcon != NULL )
251
251
cifs_stats_inc (& tcon -> num_smbs_sent );
252
252
253
- return rc ;
253
+ return 0 ;
254
254
}
255
255
256
256
int
@@ -281,16 +281,9 @@ small_smb_init_no_tc(const int smb_command, const int wct,
281
281
282
282
/* If the return code is zero, this function must fill in request_buf pointer */
283
283
static int
284
- smb_init (int smb_command , int wct , struct cifsTconInfo * tcon ,
285
- void * * request_buf /* returned */ ,
286
- void * * response_buf /* returned */ )
284
+ __smb_init (int smb_command , int wct , struct cifsTconInfo * tcon ,
285
+ void * * request_buf , void * * response_buf )
287
286
{
288
- int rc = 0 ;
289
-
290
- rc = cifs_reconnect_tcon (tcon , smb_command );
291
- if (rc )
292
- return rc ;
293
-
294
287
* request_buf = cifs_buf_get ();
295
288
if (* request_buf == NULL ) {
296
289
/* BB should we add a retry in here if not a writepage? */
@@ -309,7 +302,31 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
309
302
if (tcon != NULL )
310
303
cifs_stats_inc (& tcon -> num_smbs_sent );
311
304
312
- return rc ;
305
+ return 0 ;
306
+ }
307
+
308
+ /* If the return code is zero, this function must fill in request_buf pointer */
309
+ static int
310
+ smb_init (int smb_command , int wct , struct cifsTconInfo * tcon ,
311
+ void * * request_buf , void * * response_buf )
312
+ {
313
+ int rc ;
314
+
315
+ rc = cifs_reconnect_tcon (tcon , smb_command );
316
+ if (rc )
317
+ return rc ;
318
+
319
+ return __smb_init (smb_command , wct , tcon , request_buf , response_buf );
320
+ }
321
+
322
+ static int
323
+ smb_init_no_reconnect (int smb_command , int wct , struct cifsTconInfo * tcon ,
324
+ void * * request_buf , void * * response_buf )
325
+ {
326
+ if (tcon -> ses -> need_reconnect || tcon -> need_reconnect )
327
+ return - EHOSTDOWN ;
328
+
329
+ return __smb_init (smb_command , wct , tcon , request_buf , response_buf );
313
330
}
314
331
315
332
static int validate_t2 (struct smb_t2_rsp * pSMB )
@@ -4534,8 +4551,8 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon)
4534
4551
4535
4552
cFYI (1 , "In QFSUnixInfo" );
4536
4553
QFSUnixRetry :
4537
- rc = smb_init (SMB_COM_TRANSACTION2 , 15 , tcon , ( void * * ) & pSMB ,
4538
- (void * * ) & pSMBr );
4554
+ rc = smb_init_no_reconnect (SMB_COM_TRANSACTION2 , 15 , tcon ,
4555
+ ( void * * ) & pSMB , (void * * ) & pSMBr );
4539
4556
if (rc )
4540
4557
return rc ;
4541
4558
@@ -4604,8 +4621,8 @@ CIFSSMBSetFSUnixInfo(const int xid, struct cifsTconInfo *tcon, __u64 cap)
4604
4621
cFYI (1 , "In SETFSUnixInfo" );
4605
4622
SETFSUnixRetry :
4606
4623
/* BB switch to small buf init to save memory */
4607
- rc = smb_init (SMB_COM_TRANSACTION2 , 15 , tcon , ( void * * ) & pSMB ,
4608
- (void * * ) & pSMBr );
4624
+ rc = smb_init_no_reconnect (SMB_COM_TRANSACTION2 , 15 , tcon ,
4625
+ ( void * * ) & pSMB , (void * * ) & pSMBr );
4609
4626
if (rc )
4610
4627
return rc ;
4611
4628
0 commit comments