diff options
author | Bart Van Assche <bvanassche@acm.org> | 2013-10-26 08:35:59 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-11-08 17:43:16 -0500 |
commit | 8c64e4531c3c3bedf11d723196270d4a7553db45 (patch) | |
tree | 4cdd251177d7b981139f729e658fccdeb1b1ffd9 /include/scsi | |
parent | c1120f8981fe8ac8dd21092afaf664ba030a76cd (diff) |
scsi_transport_srp: Add periodic reconnect support
Add support for periodically reconnecting to an SRP target until
the dev_loss timer expires. After the tenth reconnection attempt,
gradually slow down subsequent reconnect attempts.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: David Dillow <dillowda@ornl.gov>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/scsi_transport_srp.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h index ee7001677f64..4ebf6913b7b2 100644 --- a/include/scsi/scsi_transport_srp.h +++ b/include/scsi/scsi_transport_srp.h | |||
@@ -31,7 +31,8 @@ enum srp_rport_state { | |||
31 | /** | 31 | /** |
32 | * struct srp_rport | 32 | * struct srp_rport |
33 | * @lld_data: LLD private data. | 33 | * @lld_data: LLD private data. |
34 | * @mutex: Protects against concurrent rport fast_io_fail / dev_loss_tmo. | 34 | * @mutex: Protects against concurrent rport reconnect / fast_io_fail / |
35 | * dev_loss_tmo activity. | ||
35 | */ | 36 | */ |
36 | struct srp_rport { | 37 | struct srp_rport { |
37 | /* for initiator and target drivers */ | 38 | /* for initiator and target drivers */ |
@@ -48,6 +49,9 @@ struct srp_rport { | |||
48 | struct mutex mutex; | 49 | struct mutex mutex; |
49 | enum srp_rport_state state; | 50 | enum srp_rport_state state; |
50 | bool deleted; | 51 | bool deleted; |
52 | int reconnect_delay; | ||
53 | int failed_reconnects; | ||
54 | struct delayed_work reconnect_work; | ||
51 | int fast_io_fail_tmo; | 55 | int fast_io_fail_tmo; |
52 | int dev_loss_tmo; | 56 | int dev_loss_tmo; |
53 | struct delayed_work fast_io_fail_work; | 57 | struct delayed_work fast_io_fail_work; |
@@ -60,6 +64,7 @@ struct srp_rport { | |||
60 | * dev_loss_tmo sysfs attribute for an rport. | 64 | * dev_loss_tmo sysfs attribute for an rport. |
61 | * @reset_timer_if_blocked: Whether or srp_timed_out() should reset the command | 65 | * @reset_timer_if_blocked: Whether or srp_timed_out() should reset the command |
62 | * timer if the device on which it has been queued is blocked. | 66 | * timer if the device on which it has been queued is blocked. |
67 | * @reconnect_delay: If not NULL, points to the default reconnect_delay value. | ||
63 | * @fast_io_fail_tmo: If not NULL, points to the default fast_io_fail_tmo value. | 68 | * @fast_io_fail_tmo: If not NULL, points to the default fast_io_fail_tmo value. |
64 | * @dev_loss_tmo: If not NULL, points to the default dev_loss_tmo value. | 69 | * @dev_loss_tmo: If not NULL, points to the default dev_loss_tmo value. |
65 | * @reconnect: Callback function for reconnecting to the target. See also | 70 | * @reconnect: Callback function for reconnecting to the target. See also |
@@ -71,6 +76,7 @@ struct srp_function_template { | |||
71 | /* for initiator drivers */ | 76 | /* for initiator drivers */ |
72 | bool has_rport_state; | 77 | bool has_rport_state; |
73 | bool reset_timer_if_blocked; | 78 | bool reset_timer_if_blocked; |
79 | int *reconnect_delay; | ||
74 | int *fast_io_fail_tmo; | 80 | int *fast_io_fail_tmo; |
75 | int *dev_loss_tmo; | 81 | int *dev_loss_tmo; |
76 | int (*reconnect)(struct srp_rport *rport); | 82 | int (*reconnect)(struct srp_rport *rport); |
@@ -90,7 +96,8 @@ extern void srp_rport_put(struct srp_rport *rport); | |||
90 | extern struct srp_rport *srp_rport_add(struct Scsi_Host *, | 96 | extern struct srp_rport *srp_rport_add(struct Scsi_Host *, |
91 | struct srp_rport_identifiers *); | 97 | struct srp_rport_identifiers *); |
92 | extern void srp_rport_del(struct srp_rport *); | 98 | extern void srp_rport_del(struct srp_rport *); |
93 | extern int srp_tmo_valid(int fast_io_fail_tmo, int dev_loss_tmo); | 99 | extern int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, |
100 | int dev_loss_tmo); | ||
94 | extern int srp_reconnect_rport(struct srp_rport *rport); | 101 | extern int srp_reconnect_rport(struct srp_rport *rport); |
95 | extern void srp_start_tl_fail_timers(struct srp_rport *rport); | 102 | extern void srp_start_tl_fail_timers(struct srp_rport *rport); |
96 | extern void srp_remove_host(struct Scsi_Host *); | 103 | extern void srp_remove_host(struct Scsi_Host *); |