aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 544a809819c3..722329cac98f 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1411,7 +1411,6 @@ __acquires(&lru_lock)
1411 if (demote_ok(gl)) 1411 if (demote_ok(gl))
1412 handle_callback(gl, LM_ST_UNLOCKED, 0, false); 1412 handle_callback(gl, LM_ST_UNLOCKED, 0, false);
1413 WARN_ON(!test_and_clear_bit(GLF_LOCK, &gl->gl_flags)); 1413 WARN_ON(!test_and_clear_bit(GLF_LOCK, &gl->gl_flags));
1414 smp_mb__after_clear_bit();
1415 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) 1414 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
1416 gfs2_glock_put_nolock(gl); 1415 gfs2_glock_put_nolock(gl);
1417 spin_unlock(&gl->gl_spin); 1416 spin_unlock(&gl->gl_spin);
@@ -1488,7 +1487,7 @@ static void examine_bucket(glock_examiner examiner, const struct gfs2_sbd *sdp,
1488 1487
1489 rcu_read_lock(); 1488 rcu_read_lock();
1490 hlist_bl_for_each_entry_rcu(gl, pos, head, gl_list) { 1489 hlist_bl_for_each_entry_rcu(gl, pos, head, gl_list) {
1491 if ((gl->gl_sbd == sdp) && atomic_read(&gl->gl_ref)) 1490 if ((gl->gl_sbd == sdp) && atomic_inc_not_zero(&gl->gl_ref))
1492 examiner(gl); 1491 examiner(gl);
1493 } 1492 }
1494 rcu_read_unlock(); 1493 rcu_read_unlock();
@@ -1508,18 +1507,17 @@ static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
1508 * thaw_glock - thaw out a glock which has an unprocessed reply waiting 1507 * thaw_glock - thaw out a glock which has an unprocessed reply waiting
1509 * @gl: The glock to thaw 1508 * @gl: The glock to thaw
1510 * 1509 *
1511 * N.B. When we freeze a glock, we leave a ref to the glock outstanding,
1512 * so this has to result in the ref count being dropped by one.
1513 */ 1510 */
1514 1511
1515static void thaw_glock(struct gfs2_glock *gl) 1512static void thaw_glock(struct gfs2_glock *gl)
1516{ 1513{
1517 if (!test_and_clear_bit(GLF_FROZEN, &gl->gl_flags)) 1514 if (!test_and_clear_bit(GLF_FROZEN, &gl->gl_flags))
1518 return; 1515 goto out;
1519 set_bit(GLF_REPLY_PENDING, &gl->gl_flags); 1516 set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
1520 gfs2_glock_hold(gl); 1517 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) {
1521 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) 1518out:
1522 gfs2_glock_put(gl); 1519 gfs2_glock_put(gl);
1520 }
1523} 1521}
1524 1522
1525/** 1523/**
@@ -1536,7 +1534,6 @@ static void clear_glock(struct gfs2_glock *gl)
1536 if (gl->gl_state != LM_ST_UNLOCKED) 1534 if (gl->gl_state != LM_ST_UNLOCKED)
1537 handle_callback(gl, LM_ST_UNLOCKED, 0, false); 1535 handle_callback(gl, LM_ST_UNLOCKED, 0, false);
1538 spin_unlock(&gl->gl_spin); 1536 spin_unlock(&gl->gl_spin);
1539 gfs2_glock_hold(gl);
1540 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) 1537 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
1541 gfs2_glock_put(gl); 1538 gfs2_glock_put(gl);
1542} 1539}