summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/entrylk.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/locks/src/entrylk.c')
-rw-r--r--xlators/features/locks/src/entrylk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c
index ea78f92d200..60e7bed2a44 100644
--- a/xlators/features/locks/src/entrylk.c
+++ b/xlators/features/locks/src/entrylk.c
@@ -115,7 +115,6 @@ __stale_entrylk(xlator_t *this, pl_entry_lock_t *candidate_lock,
{
posix_locks_private_t *priv = NULL;
struct timeval curr;
- gettimeofday(&curr, NULL);
priv = this->private;
@@ -123,6 +122,7 @@ __stale_entrylk(xlator_t *this, pl_entry_lock_t *candidate_lock,
* chance? Or just the locks we are attempting to acquire?
*/
if (names_conflict(candidate_lock->basename, requested_lock->basename)) {
+ gettimeofday(&curr, NULL);
*lock_age_sec = curr.tv_sec - candidate_lock->granted_time.tv_sec;
if (*lock_age_sec > priv->revocation_secs)
return _gf_true;
@@ -541,11 +541,11 @@ __lock_blocked_add(xlator_t *this, pl_inode_t *pinode, pl_dom_list_t *dom,
{
struct timeval now;
- gettimeofday(&now, NULL);
-
if (nonblock)
goto out;
+ gettimeofday(&now, NULL);
+
lock->blkd_time = now;
list_add_tail(&lock->blocked_locks, &dom->blocked_entrylks);