@@ -250,12 +250,11 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
250
250
rpcrdma_addrstr (r_xprt ), rpcrdma_portstr (r_xprt ));
251
251
#endif
252
252
init_completion (& ia -> ri_remove_done );
253
- set_bit (RPCRDMA_IAF_REMOVING , & ia -> ri_flags );
254
253
ep -> rep_connected = - ENODEV ;
255
254
xprt_force_disconnect (xprt );
256
255
wait_for_completion (& ia -> ri_remove_done );
256
+ trace_xprtrdma_remove (r_xprt );
257
257
258
- ia -> ri_id = NULL ;
259
258
/* Return 1 to ensure the core destroys the id. */
260
259
return 1 ;
261
260
case RDMA_CM_EVENT_ESTABLISHED :
@@ -345,37 +344,6 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia)
345
344
* Exported functions.
346
345
*/
347
346
348
- /**
349
- * rpcrdma_ia_remove - Handle device driver unload
350
- * @ia: interface adapter being removed
351
- *
352
- * Divest transport H/W resources associated with this adapter,
353
- * but allow it to be restored later.
354
- *
355
- * Caller must hold the transport send lock.
356
- */
357
- void
358
- rpcrdma_ia_remove (struct rpcrdma_ia * ia )
359
- {
360
- struct rpcrdma_xprt * r_xprt = container_of (ia , struct rpcrdma_xprt ,
361
- rx_ia );
362
-
363
- if (ia -> ri_id -> qp )
364
- rpcrdma_xprt_drain (r_xprt );
365
-
366
- rpcrdma_reps_unmap (r_xprt );
367
- rpcrdma_reqs_reset (r_xprt );
368
- rpcrdma_mrs_destroy (r_xprt );
369
- rpcrdma_sendctxs_destroy (r_xprt );
370
-
371
- rpcrdma_ep_destroy (r_xprt );
372
-
373
- /* Allow waiters to continue */
374
- complete (& ia -> ri_remove_done );
375
-
376
- trace_xprtrdma_remove (r_xprt );
377
- }
378
-
379
347
static int rpcrdma_ep_create (struct rpcrdma_xprt * r_xprt )
380
348
{
381
349
struct rpcrdma_ep * ep = & r_xprt -> rx_ep ;
@@ -573,12 +541,13 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
573
541
struct rpcrdma_ep * ep = & r_xprt -> rx_ep ;
574
542
struct rpcrdma_ia * ia = & r_xprt -> rx_ia ;
575
543
struct rdma_cm_id * id = ia -> ri_id ;
576
- int rc ;
544
+ int rc , status = ep -> rep_connected ;
545
+
546
+ might_sleep ();
577
547
578
548
if (!id )
579
- goto out ;
549
+ return ;
580
550
581
- /* returns without wait if ID is not connected */
582
551
rc = rdma_disconnect (id );
583
552
if (!rc )
584
553
wait_event_interruptible (ep -> rep_connect_wait ,
@@ -589,15 +558,17 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
589
558
590
559
if (id -> qp )
591
560
rpcrdma_xprt_drain (r_xprt );
592
- out :
561
+ rpcrdma_reps_unmap ( r_xprt );
593
562
rpcrdma_reqs_reset (r_xprt );
594
563
rpcrdma_mrs_destroy (r_xprt );
595
564
rpcrdma_sendctxs_destroy (r_xprt );
596
565
597
566
rpcrdma_ep_destroy (r_xprt );
598
567
599
- if (ia -> ri_id )
600
- rdma_destroy_id (ia -> ri_id );
568
+ if (status == - ENODEV )
569
+ complete (& ia -> ri_remove_done );
570
+ else
571
+ rdma_destroy_id (id );
601
572
ia -> ri_id = NULL ;
602
573
}
603
574
@@ -815,10 +786,10 @@ void rpcrdma_mrs_refresh(struct rpcrdma_xprt *r_xprt)
815
786
struct rpcrdma_buffer * buf = & r_xprt -> rx_buf ;
816
787
struct rpcrdma_ep * ep = & r_xprt -> rx_ep ;
817
788
818
- /* If there is no underlying device , it's no use to
819
- * wake the refresh worker.
789
+ /* If there is no underlying connection , it's no use
790
+ * to wake the refresh worker.
820
791
*/
821
- if (ep -> rep_connected != - ENODEV ) {
792
+ if (ep -> rep_connected == 1 ) {
822
793
/* The work is scheduled on a WQ_MEM_RECLAIM
823
794
* workqueue in order to prevent MR allocation
824
795
* from recursing into NFS during direct reclaim.
0 commit comments