diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-04-07 09:01:34 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-04-15 05:16:13 -0400 |
commit | a228df6339e0d385b8149c860d81b6007f5e9c81 (patch) | |
tree | bf744dbc6bf8849ea7b81581818722c4e90b553e | |
parent | 5cf32524de745c56e1411d63eccf23fef1709d73 (diff) |
GFS2: Move umount flush rwsem
The rwsem, used only on umount, is in the wrong place in glock.c.
This patch moves it up a bit so that it does not get called under
a spinlock.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/glock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 3984e47d1d33..1afd9f26bcb1 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -597,7 +597,6 @@ __acquires(&gl->gl_spin) | |||
597 | 597 | ||
598 | GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)); | 598 | GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)); |
599 | 599 | ||
600 | down_read(&gfs2_umount_flush_sem); | ||
601 | if (test_bit(GLF_DEMOTE, &gl->gl_flags) && | 600 | if (test_bit(GLF_DEMOTE, &gl->gl_flags) && |
602 | gl->gl_demote_state != gl->gl_state) { | 601 | gl->gl_demote_state != gl->gl_state) { |
603 | if (find_first_holder(gl)) | 602 | if (find_first_holder(gl)) |
@@ -614,15 +613,14 @@ __acquires(&gl->gl_spin) | |||
614 | if (ret == 0) | 613 | if (ret == 0) |
615 | goto out_unlock; | 614 | goto out_unlock; |
616 | if (ret == 2) | 615 | if (ret == 2) |
617 | goto out_sem; | 616 | goto out; |
618 | gh = find_first_waiter(gl); | 617 | gh = find_first_waiter(gl); |
619 | gl->gl_target = gh->gh_state; | 618 | gl->gl_target = gh->gh_state; |
620 | if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) | 619 | if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) |
621 | do_error(gl, 0); /* Fail queued try locks */ | 620 | do_error(gl, 0); /* Fail queued try locks */ |
622 | } | 621 | } |
623 | do_xmote(gl, gh, gl->gl_target); | 622 | do_xmote(gl, gh, gl->gl_target); |
624 | out_sem: | 623 | out: |
625 | up_read(&gfs2_umount_flush_sem); | ||
626 | return; | 624 | return; |
627 | 625 | ||
628 | out_sched: | 626 | out_sched: |
@@ -631,7 +629,7 @@ out_sched: | |||
631 | gfs2_glock_put(gl); | 629 | gfs2_glock_put(gl); |
632 | out_unlock: | 630 | out_unlock: |
633 | clear_bit(GLF_LOCK, &gl->gl_flags); | 631 | clear_bit(GLF_LOCK, &gl->gl_flags); |
634 | goto out_sem; | 632 | goto out; |
635 | } | 633 | } |
636 | 634 | ||
637 | static void glock_work_func(struct work_struct *work) | 635 | static void glock_work_func(struct work_struct *work) |
@@ -641,6 +639,7 @@ static void glock_work_func(struct work_struct *work) | |||
641 | 639 | ||
642 | if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) | 640 | if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) |
643 | finish_xmote(gl, gl->gl_reply); | 641 | finish_xmote(gl, gl->gl_reply); |
642 | down_read(&gfs2_umount_flush_sem); | ||
644 | spin_lock(&gl->gl_spin); | 643 | spin_lock(&gl->gl_spin); |
645 | if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && | 644 | if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && |
646 | gl->gl_state != LM_ST_UNLOCKED && | 645 | gl->gl_state != LM_ST_UNLOCKED && |
@@ -653,6 +652,7 @@ static void glock_work_func(struct work_struct *work) | |||
653 | } | 652 | } |
654 | run_queue(gl, 0); | 653 | run_queue(gl, 0); |
655 | spin_unlock(&gl->gl_spin); | 654 | spin_unlock(&gl->gl_spin); |
655 | up_read(&gfs2_umount_flush_sem); | ||
656 | if (!delay || | 656 | if (!delay || |
657 | queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) | 657 | queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) |
658 | gfs2_glock_put(gl); | 658 | gfs2_glock_put(gl); |