[PATCH 2/3] libfc: only restart discovery after timeout if not already running

Hannes Reinecke
2017-05-30T15:15:02Z

If a discovery is already running (ie if the 'pending' flags is set)
there is no need to restart discovery from the timeout handler.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/libfc/fc_disc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 913beb5..82b1c97 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -503,10 +503,12 @@ static void fc_disc_timeout(struct work_struct *work)
struct fc_disc,
disc_work.work);
mutex_lock(&disc->disc_mutex);
- disc->pending = 1;
- disc->requested = 0;
+ if (!disc->pending) {
+ disc->pending = 1;
+ disc->requested = 0;

- fc_disc_gpn_ft_req(disc);
+ fc_disc_gpn_ft_req(disc);
+ }