aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/transport.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index c98f929315f2..5f224e999585 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -344,37 +344,38 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
344 if (long_op == CIFS_ASYNC_OP) { 344 if (long_op == CIFS_ASYNC_OP) {
345 /* oplock breaks must not be held up */ 345 /* oplock breaks must not be held up */
346 atomic_inc(&ses->server->inFlight); 346 atomic_inc(&ses->server->inFlight);
347 } else { 347 return 0;
348 spin_lock(&GlobalMid_Lock); 348 }
349 while (1) { 349
350 if (atomic_read(&ses->server->inFlight) >= 350 spin_lock(&GlobalMid_Lock);
351 cifs_max_pending){ 351 while (1) {
352 spin_unlock(&GlobalMid_Lock); 352 if (atomic_read(&ses->server->inFlight) >=
353 cifs_max_pending){
354 spin_unlock(&GlobalMid_Lock);
353#ifdef CONFIG_CIFS_STATS2 355#ifdef CONFIG_CIFS_STATS2
354 atomic_inc(&ses->server->num_waiters); 356 atomic_inc(&ses->server->num_waiters);
355#endif 357#endif
356 wait_event(ses->server->request_q, 358 wait_event(ses->server->request_q,
357 atomic_read(&ses->server->inFlight) 359 atomic_read(&ses->server->inFlight)
358 < cifs_max_pending); 360 < cifs_max_pending);
359#ifdef CONFIG_CIFS_STATS2 361#ifdef CONFIG_CIFS_STATS2
360 atomic_dec(&ses->server->num_waiters); 362 atomic_dec(&ses->server->num_waiters);
361#endif 363#endif
362 spin_lock(&GlobalMid_Lock); 364 spin_lock(&GlobalMid_Lock);
363 } else { 365 } else {
364 if (ses->server->tcpStatus == CifsExiting) { 366 if (ses->server->tcpStatus == CifsExiting) {
365 spin_unlock(&GlobalMid_Lock);
366 return -ENOENT;
367 }
368
369 /* can not count locking commands against total
370 as they are allowed to block on server */
371
372 /* update # of requests on the wire to server */
373 if (long_op != CIFS_BLOCKING_OP)
374 atomic_inc(&ses->server->inFlight);
375 spin_unlock(&GlobalMid_Lock); 367 spin_unlock(&GlobalMid_Lock);
376 break; 368 return -ENOENT;
377 } 369 }
370
371 /* can not count locking commands against total
372 as they are allowed to block on server */
373
374 /* update # of requests on the wire to server */
375 if (long_op != CIFS_BLOCKING_OP)
376 atomic_inc(&ses->server->inFlight);
377 spin_unlock(&GlobalMid_Lock);
378 break;
378 } 379 }
379 } 380 }
380 return 0; 381 return 0;