diff options
| -rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 20 | 
1 files changed, 10 insertions, 10 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 7c5106d01b8..51086aaf907 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -188,13 +188,11 @@ gf_del_locker (server_connection_t *conn, const char *volume,          struct _locker    *tmp = NULL;          int32_t            ret = -1;          struct list_head  *head = NULL; -        struct list_head   del;          struct _lock_table *table = NULL; +        int                found = 0;          GF_VALIDATE_OR_GOTO ("server", volume, out); -        INIT_LIST_HEAD (&del); -          pthread_mutex_lock (&conn->lock);          {                  table = conn->ltable; @@ -210,19 +208,21 @@ gf_del_locker (server_connection_t *conn, const char *volume,                                  continue;                          if (locker->fd && fd && (locker->fd == fd)) -                                list_move_tail (&locker->lockers, &del); +                                found = 1;                          else if (locker->loc.inode && loc &&                                   (locker->loc.inode == loc->inode)) -                                list_move_tail (&locker->lockers, &del); +                                found = 1; +                        if (found) { +                                list_del_init (&locker->lockers); +                                break; +                        }                  } +                if (!found) +                        locker = NULL;          }          pthread_mutex_unlock (&conn->lock); -        tmp = NULL; -        locker = NULL; - -        list_for_each_entry_safe (locker, tmp, &del, lockers) { -                list_del_init (&locker->lockers); +        if (locker) {                  if (locker->fd)                          fd_unref (locker->fd);                  else  | 
