diff options
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 188 |
1 files changed, 110 insertions, 78 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 7175a4d06435..d636b3e80f5d 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This copyrighted material is made available to anyone wishing to use, | 5 | * This copyrighted material is made available to anyone wishing to use, |
6 | * modify, copy, or redistribute it subject to the terms and conditions | 6 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -35,7 +35,6 @@ | |||
35 | #include "glock.h" | 35 | #include "glock.h" |
36 | #include "glops.h" | 36 | #include "glops.h" |
37 | #include "inode.h" | 37 | #include "inode.h" |
38 | #include "lm.h" | ||
39 | #include "lops.h" | 38 | #include "lops.h" |
40 | #include "meta_io.h" | 39 | #include "meta_io.h" |
41 | #include "quota.h" | 40 | #include "quota.h" |
@@ -183,7 +182,8 @@ static void glock_free(struct gfs2_glock *gl) | |||
183 | struct gfs2_sbd *sdp = gl->gl_sbd; | 182 | struct gfs2_sbd *sdp = gl->gl_sbd; |
184 | struct inode *aspace = gl->gl_aspace; | 183 | struct inode *aspace = gl->gl_aspace; |
185 | 184 | ||
186 | gfs2_lm_put_lock(sdp, gl->gl_lock); | 185 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
186 | sdp->sd_lockstruct.ls_ops->lm_put_lock(gl->gl_lock); | ||
187 | 187 | ||
188 | if (aspace) | 188 | if (aspace) |
189 | gfs2_aspace_put(aspace); | 189 | gfs2_aspace_put(aspace); |
@@ -197,7 +197,7 @@ static void glock_free(struct gfs2_glock *gl) | |||
197 | * | 197 | * |
198 | */ | 198 | */ |
199 | 199 | ||
200 | void gfs2_glock_hold(struct gfs2_glock *gl) | 200 | static void gfs2_glock_hold(struct gfs2_glock *gl) |
201 | { | 201 | { |
202 | atomic_inc(&gl->gl_ref); | 202 | atomic_inc(&gl->gl_ref); |
203 | } | 203 | } |
@@ -293,6 +293,16 @@ static void glock_work_func(struct work_struct *work) | |||
293 | gfs2_glock_put(gl); | 293 | gfs2_glock_put(gl); |
294 | } | 294 | } |
295 | 295 | ||
296 | static int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name, | ||
297 | void **lockp) | ||
298 | { | ||
299 | int error = -EIO; | ||
300 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | ||
301 | error = sdp->sd_lockstruct.ls_ops->lm_get_lock( | ||
302 | sdp->sd_lockstruct.ls_lockspace, name, lockp); | ||
303 | return error; | ||
304 | } | ||
305 | |||
296 | /** | 306 | /** |
297 | * gfs2_glock_get() - Get a glock, or create one if one doesn't exist | 307 | * gfs2_glock_get() - Get a glock, or create one if one doesn't exist |
298 | * @sdp: The GFS2 superblock | 308 | * @sdp: The GFS2 superblock |
@@ -338,8 +348,6 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
338 | gl->gl_ip = 0; | 348 | gl->gl_ip = 0; |
339 | gl->gl_ops = glops; | 349 | gl->gl_ops = glops; |
340 | gl->gl_req_gh = NULL; | 350 | gl->gl_req_gh = NULL; |
341 | gl->gl_req_bh = NULL; | ||
342 | gl->gl_vn = 0; | ||
343 | gl->gl_stamp = jiffies; | 351 | gl->gl_stamp = jiffies; |
344 | gl->gl_tchange = jiffies; | 352 | gl->gl_tchange = jiffies; |
345 | gl->gl_object = NULL; | 353 | gl->gl_object = NULL; |
@@ -595,11 +603,12 @@ static void run_queue(struct gfs2_glock *gl) | |||
595 | blocked = rq_mutex(gh); | 603 | blocked = rq_mutex(gh); |
596 | } else if (test_bit(GLF_DEMOTE, &gl->gl_flags)) { | 604 | } else if (test_bit(GLF_DEMOTE, &gl->gl_flags)) { |
597 | blocked = rq_demote(gl); | 605 | blocked = rq_demote(gl); |
598 | if (gl->gl_waiters2 && !blocked) { | 606 | if (test_bit(GLF_WAITERS2, &gl->gl_flags) && |
607 | !blocked) { | ||
599 | set_bit(GLF_DEMOTE, &gl->gl_flags); | 608 | set_bit(GLF_DEMOTE, &gl->gl_flags); |
600 | gl->gl_demote_state = LM_ST_UNLOCKED; | 609 | gl->gl_demote_state = LM_ST_UNLOCKED; |
601 | } | 610 | } |
602 | gl->gl_waiters2 = 0; | 611 | clear_bit(GLF_WAITERS2, &gl->gl_flags); |
603 | } else if (!list_empty(&gl->gl_waiters3)) { | 612 | } else if (!list_empty(&gl->gl_waiters3)) { |
604 | gh = list_entry(gl->gl_waiters3.next, | 613 | gh = list_entry(gl->gl_waiters3.next, |
605 | struct gfs2_holder, gh_list); | 614 | struct gfs2_holder, gh_list); |
@@ -710,7 +719,7 @@ static void handle_callback(struct gfs2_glock *gl, unsigned int state, | |||
710 | } else if (gl->gl_demote_state != LM_ST_UNLOCKED && | 719 | } else if (gl->gl_demote_state != LM_ST_UNLOCKED && |
711 | gl->gl_demote_state != state) { | 720 | gl->gl_demote_state != state) { |
712 | if (test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) | 721 | if (test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) |
713 | gl->gl_waiters2 = 1; | 722 | set_bit(GLF_WAITERS2, &gl->gl_flags); |
714 | else | 723 | else |
715 | gl->gl_demote_state = LM_ST_UNLOCKED; | 724 | gl->gl_demote_state = LM_ST_UNLOCKED; |
716 | } | 725 | } |
@@ -743,6 +752,43 @@ static void state_change(struct gfs2_glock *gl, unsigned int new_state) | |||
743 | } | 752 | } |
744 | 753 | ||
745 | /** | 754 | /** |
755 | * drop_bh - Called after a lock module unlock completes | ||
756 | * @gl: the glock | ||
757 | * @ret: the return status | ||
758 | * | ||
759 | * Doesn't wake up the process waiting on the struct gfs2_holder (if any) | ||
760 | * Doesn't drop the reference on the glock the top half took out | ||
761 | * | ||
762 | */ | ||
763 | |||
764 | static void drop_bh(struct gfs2_glock *gl, unsigned int ret) | ||
765 | { | ||
766 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
767 | struct gfs2_holder *gh = gl->gl_req_gh; | ||
768 | |||
769 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | ||
770 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | ||
771 | gfs2_assert_warn(sdp, !ret); | ||
772 | |||
773 | state_change(gl, LM_ST_UNLOCKED); | ||
774 | |||
775 | if (test_and_clear_bit(GLF_CONV_DEADLK, &gl->gl_flags)) { | ||
776 | spin_lock(&gl->gl_spin); | ||
777 | gh->gh_error = 0; | ||
778 | spin_unlock(&gl->gl_spin); | ||
779 | gfs2_glock_xmote_th(gl, gl->gl_req_gh); | ||
780 | gfs2_glock_put(gl); | ||
781 | return; | ||
782 | } | ||
783 | |||
784 | spin_lock(&gl->gl_spin); | ||
785 | gfs2_demote_wake(gl); | ||
786 | clear_bit(GLF_LOCK, &gl->gl_flags); | ||
787 | spin_unlock(&gl->gl_spin); | ||
788 | gfs2_glock_put(gl); | ||
789 | } | ||
790 | |||
791 | /** | ||
746 | * xmote_bh - Called after the lock module is done acquiring a lock | 792 | * xmote_bh - Called after the lock module is done acquiring a lock |
747 | * @gl: The glock in question | 793 | * @gl: The glock in question |
748 | * @ret: the int returned from the lock module | 794 | * @ret: the int returned from the lock module |
@@ -754,25 +800,19 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) | |||
754 | struct gfs2_sbd *sdp = gl->gl_sbd; | 800 | struct gfs2_sbd *sdp = gl->gl_sbd; |
755 | const struct gfs2_glock_operations *glops = gl->gl_ops; | 801 | const struct gfs2_glock_operations *glops = gl->gl_ops; |
756 | struct gfs2_holder *gh = gl->gl_req_gh; | 802 | struct gfs2_holder *gh = gl->gl_req_gh; |
757 | int prev_state = gl->gl_state; | ||
758 | int op_done = 1; | 803 | int op_done = 1; |
759 | 804 | ||
805 | if (!gh && (ret & LM_OUT_ST_MASK) == LM_ST_UNLOCKED) { | ||
806 | drop_bh(gl, ret); | ||
807 | return; | ||
808 | } | ||
809 | |||
760 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | 810 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); |
761 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | 811 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); |
762 | gfs2_assert_warn(sdp, !(ret & LM_OUT_ASYNC)); | 812 | gfs2_assert_warn(sdp, !(ret & LM_OUT_ASYNC)); |
763 | 813 | ||
764 | state_change(gl, ret & LM_OUT_ST_MASK); | 814 | state_change(gl, ret & LM_OUT_ST_MASK); |
765 | 815 | ||
766 | if (prev_state != LM_ST_UNLOCKED && !(ret & LM_OUT_CACHEABLE)) { | ||
767 | if (glops->go_inval) | ||
768 | glops->go_inval(gl, DIO_METADATA); | ||
769 | } else if (gl->gl_state == LM_ST_DEFERRED) { | ||
770 | /* We might not want to do this here. | ||
771 | Look at moving to the inode glops. */ | ||
772 | if (glops->go_inval) | ||
773 | glops->go_inval(gl, 0); | ||
774 | } | ||
775 | |||
776 | /* Deal with each possible exit condition */ | 816 | /* Deal with each possible exit condition */ |
777 | 817 | ||
778 | if (!gh) { | 818 | if (!gh) { |
@@ -782,7 +822,6 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) | |||
782 | } else { | 822 | } else { |
783 | spin_lock(&gl->gl_spin); | 823 | spin_lock(&gl->gl_spin); |
784 | if (gl->gl_state != gl->gl_demote_state) { | 824 | if (gl->gl_state != gl->gl_demote_state) { |
785 | gl->gl_req_bh = NULL; | ||
786 | spin_unlock(&gl->gl_spin); | 825 | spin_unlock(&gl->gl_spin); |
787 | gfs2_glock_drop_th(gl); | 826 | gfs2_glock_drop_th(gl); |
788 | gfs2_glock_put(gl); | 827 | gfs2_glock_put(gl); |
@@ -793,6 +832,14 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) | |||
793 | } | 832 | } |
794 | } else { | 833 | } else { |
795 | spin_lock(&gl->gl_spin); | 834 | spin_lock(&gl->gl_spin); |
835 | if (ret & LM_OUT_CONV_DEADLK) { | ||
836 | gh->gh_error = 0; | ||
837 | set_bit(GLF_CONV_DEADLK, &gl->gl_flags); | ||
838 | spin_unlock(&gl->gl_spin); | ||
839 | gfs2_glock_drop_th(gl); | ||
840 | gfs2_glock_put(gl); | ||
841 | return; | ||
842 | } | ||
796 | list_del_init(&gh->gh_list); | 843 | list_del_init(&gh->gh_list); |
797 | gh->gh_error = -EIO; | 844 | gh->gh_error = -EIO; |
798 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 845 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
@@ -824,7 +871,6 @@ out: | |||
824 | if (op_done) { | 871 | if (op_done) { |
825 | spin_lock(&gl->gl_spin); | 872 | spin_lock(&gl->gl_spin); |
826 | gl->gl_req_gh = NULL; | 873 | gl->gl_req_gh = NULL; |
827 | gl->gl_req_bh = NULL; | ||
828 | clear_bit(GLF_LOCK, &gl->gl_flags); | 874 | clear_bit(GLF_LOCK, &gl->gl_flags); |
829 | spin_unlock(&gl->gl_spin); | 875 | spin_unlock(&gl->gl_spin); |
830 | } | 876 | } |
@@ -835,6 +881,17 @@ out: | |||
835 | gfs2_holder_wake(gh); | 881 | gfs2_holder_wake(gh); |
836 | } | 882 | } |
837 | 883 | ||
884 | static unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock, | ||
885 | unsigned int cur_state, unsigned int req_state, | ||
886 | unsigned int flags) | ||
887 | { | ||
888 | int ret = 0; | ||
889 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | ||
890 | ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state, | ||
891 | req_state, flags); | ||
892 | return ret; | ||
893 | } | ||
894 | |||
838 | /** | 895 | /** |
839 | * gfs2_glock_xmote_th - Call into the lock module to acquire or change a glock | 896 | * gfs2_glock_xmote_th - Call into the lock module to acquire or change a glock |
840 | * @gl: The glock in question | 897 | * @gl: The glock in question |
@@ -856,6 +913,8 @@ static void gfs2_glock_xmote_th(struct gfs2_glock *gl, struct gfs2_holder *gh) | |||
856 | 913 | ||
857 | if (glops->go_xmote_th) | 914 | if (glops->go_xmote_th) |
858 | glops->go_xmote_th(gl); | 915 | glops->go_xmote_th(gl); |
916 | if (state == LM_ST_DEFERRED && glops->go_inval) | ||
917 | glops->go_inval(gl, DIO_METADATA); | ||
859 | 918 | ||
860 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | 919 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); |
861 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | 920 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); |
@@ -863,7 +922,6 @@ static void gfs2_glock_xmote_th(struct gfs2_glock *gl, struct gfs2_holder *gh) | |||
863 | gfs2_assert_warn(sdp, state != gl->gl_state); | 922 | gfs2_assert_warn(sdp, state != gl->gl_state); |
864 | 923 | ||
865 | gfs2_glock_hold(gl); | 924 | gfs2_glock_hold(gl); |
866 | gl->gl_req_bh = xmote_bh; | ||
867 | 925 | ||
868 | lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state, lck_flags); | 926 | lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state, lck_flags); |
869 | 927 | ||
@@ -876,49 +934,13 @@ static void gfs2_glock_xmote_th(struct gfs2_glock *gl, struct gfs2_holder *gh) | |||
876 | xmote_bh(gl, lck_ret); | 934 | xmote_bh(gl, lck_ret); |
877 | } | 935 | } |
878 | 936 | ||
879 | /** | 937 | static unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, void *lock, |
880 | * drop_bh - Called after a lock module unlock completes | 938 | unsigned int cur_state) |
881 | * @gl: the glock | ||
882 | * @ret: the return status | ||
883 | * | ||
884 | * Doesn't wake up the process waiting on the struct gfs2_holder (if any) | ||
885 | * Doesn't drop the reference on the glock the top half took out | ||
886 | * | ||
887 | */ | ||
888 | |||
889 | static void drop_bh(struct gfs2_glock *gl, unsigned int ret) | ||
890 | { | 939 | { |
891 | struct gfs2_sbd *sdp = gl->gl_sbd; | 940 | int ret = 0; |
892 | const struct gfs2_glock_operations *glops = gl->gl_ops; | 941 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
893 | struct gfs2_holder *gh = gl->gl_req_gh; | 942 | ret = sdp->sd_lockstruct.ls_ops->lm_unlock(lock, cur_state); |
894 | 943 | return ret; | |
895 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | ||
896 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | ||
897 | gfs2_assert_warn(sdp, !ret); | ||
898 | |||
899 | state_change(gl, LM_ST_UNLOCKED); | ||
900 | |||
901 | if (glops->go_inval) | ||
902 | glops->go_inval(gl, DIO_METADATA); | ||
903 | |||
904 | if (gh) { | ||
905 | spin_lock(&gl->gl_spin); | ||
906 | list_del_init(&gh->gh_list); | ||
907 | gh->gh_error = 0; | ||
908 | spin_unlock(&gl->gl_spin); | ||
909 | } | ||
910 | |||
911 | spin_lock(&gl->gl_spin); | ||
912 | gfs2_demote_wake(gl); | ||
913 | gl->gl_req_gh = NULL; | ||
914 | gl->gl_req_bh = NULL; | ||
915 | clear_bit(GLF_LOCK, &gl->gl_flags); | ||
916 | spin_unlock(&gl->gl_spin); | ||
917 | |||
918 | gfs2_glock_put(gl); | ||
919 | |||
920 | if (gh) | ||
921 | gfs2_holder_wake(gh); | ||
922 | } | 944 | } |
923 | 945 | ||
924 | /** | 946 | /** |
@@ -935,13 +957,14 @@ static void gfs2_glock_drop_th(struct gfs2_glock *gl) | |||
935 | 957 | ||
936 | if (glops->go_xmote_th) | 958 | if (glops->go_xmote_th) |
937 | glops->go_xmote_th(gl); | 959 | glops->go_xmote_th(gl); |
960 | if (glops->go_inval) | ||
961 | glops->go_inval(gl, DIO_METADATA); | ||
938 | 962 | ||
939 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | 963 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); |
940 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); | 964 | gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); |
941 | gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED); | 965 | gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED); |
942 | 966 | ||
943 | gfs2_glock_hold(gl); | 967 | gfs2_glock_hold(gl); |
944 | gl->gl_req_bh = drop_bh; | ||
945 | 968 | ||
946 | ret = gfs2_lm_unlock(sdp, gl->gl_lock, gl->gl_state); | 969 | ret = gfs2_lm_unlock(sdp, gl->gl_lock, gl->gl_state); |
947 | 970 | ||
@@ -964,16 +987,17 @@ static void gfs2_glock_drop_th(struct gfs2_glock *gl) | |||
964 | static void do_cancels(struct gfs2_holder *gh) | 987 | static void do_cancels(struct gfs2_holder *gh) |
965 | { | 988 | { |
966 | struct gfs2_glock *gl = gh->gh_gl; | 989 | struct gfs2_glock *gl = gh->gh_gl; |
990 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
967 | 991 | ||
968 | spin_lock(&gl->gl_spin); | 992 | spin_lock(&gl->gl_spin); |
969 | 993 | ||
970 | while (gl->gl_req_gh != gh && | 994 | while (gl->gl_req_gh != gh && |
971 | !test_bit(HIF_HOLDER, &gh->gh_iflags) && | 995 | !test_bit(HIF_HOLDER, &gh->gh_iflags) && |
972 | !list_empty(&gh->gh_list)) { | 996 | !list_empty(&gh->gh_list)) { |
973 | if (gl->gl_req_bh && !(gl->gl_req_gh && | 997 | if (!(gl->gl_req_gh && (gl->gl_req_gh->gh_flags & GL_NOCANCEL))) { |
974 | (gl->gl_req_gh->gh_flags & GL_NOCANCEL))) { | ||
975 | spin_unlock(&gl->gl_spin); | 998 | spin_unlock(&gl->gl_spin); |
976 | gfs2_lm_cancel(gl->gl_sbd, gl->gl_lock); | 999 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
1000 | sdp->sd_lockstruct.ls_ops->lm_cancel(gl->gl_lock); | ||
977 | msleep(100); | 1001 | msleep(100); |
978 | spin_lock(&gl->gl_spin); | 1002 | spin_lock(&gl->gl_spin); |
979 | } else { | 1003 | } else { |
@@ -1041,7 +1065,6 @@ static int glock_wait_internal(struct gfs2_holder *gh) | |||
1041 | 1065 | ||
1042 | spin_lock(&gl->gl_spin); | 1066 | spin_lock(&gl->gl_spin); |
1043 | gl->gl_req_gh = NULL; | 1067 | gl->gl_req_gh = NULL; |
1044 | gl->gl_req_bh = NULL; | ||
1045 | clear_bit(GLF_LOCK, &gl->gl_flags); | 1068 | clear_bit(GLF_LOCK, &gl->gl_flags); |
1046 | run_queue(gl); | 1069 | run_queue(gl); |
1047 | spin_unlock(&gl->gl_spin); | 1070 | spin_unlock(&gl->gl_spin); |
@@ -1428,6 +1451,14 @@ void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs) | |||
1428 | gfs2_glock_dq_uninit(&ghs[x]); | 1451 | gfs2_glock_dq_uninit(&ghs[x]); |
1429 | } | 1452 | } |
1430 | 1453 | ||
1454 | static int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp) | ||
1455 | { | ||
1456 | int error = -EIO; | ||
1457 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | ||
1458 | error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp); | ||
1459 | return error; | ||
1460 | } | ||
1461 | |||
1431 | /** | 1462 | /** |
1432 | * gfs2_lvb_hold - attach a LVB from a glock | 1463 | * gfs2_lvb_hold - attach a LVB from a glock |
1433 | * @gl: The glock in question | 1464 | * @gl: The glock in question |
@@ -1463,12 +1494,15 @@ int gfs2_lvb_hold(struct gfs2_glock *gl) | |||
1463 | 1494 | ||
1464 | void gfs2_lvb_unhold(struct gfs2_glock *gl) | 1495 | void gfs2_lvb_unhold(struct gfs2_glock *gl) |
1465 | { | 1496 | { |
1497 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
1498 | |||
1466 | gfs2_glock_hold(gl); | 1499 | gfs2_glock_hold(gl); |
1467 | gfs2_glmutex_lock(gl); | 1500 | gfs2_glmutex_lock(gl); |
1468 | 1501 | ||
1469 | gfs2_assert(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0); | 1502 | gfs2_assert(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0); |
1470 | if (atomic_dec_and_test(&gl->gl_lvb_count)) { | 1503 | if (atomic_dec_and_test(&gl->gl_lvb_count)) { |
1471 | gfs2_lm_unhold_lvb(gl->gl_sbd, gl->gl_lock, gl->gl_lvb); | 1504 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
1505 | sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(gl->gl_lock, gl->gl_lvb); | ||
1472 | gl->gl_lvb = NULL; | 1506 | gl->gl_lvb = NULL; |
1473 | gfs2_glock_put(gl); | 1507 | gfs2_glock_put(gl); |
1474 | } | 1508 | } |
@@ -1534,8 +1568,7 @@ void gfs2_glock_cb(void *cb_data, unsigned int type, void *data) | |||
1534 | gl = gfs2_glock_find(sdp, &async->lc_name); | 1568 | gl = gfs2_glock_find(sdp, &async->lc_name); |
1535 | if (gfs2_assert_warn(sdp, gl)) | 1569 | if (gfs2_assert_warn(sdp, gl)) |
1536 | return; | 1570 | return; |
1537 | if (!gfs2_assert_warn(sdp, gl->gl_req_bh)) | 1571 | xmote_bh(gl, async->lc_ret); |
1538 | gl->gl_req_bh(gl, async->lc_ret); | ||
1539 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) | 1572 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) |
1540 | gfs2_glock_put(gl); | 1573 | gfs2_glock_put(gl); |
1541 | up_read(&gfs2_umount_flush_sem); | 1574 | up_read(&gfs2_umount_flush_sem); |
@@ -1594,10 +1627,10 @@ void gfs2_glock_schedule_for_reclaim(struct gfs2_glock *gl) | |||
1594 | gfs2_glock_hold(gl); | 1627 | gfs2_glock_hold(gl); |
1595 | list_add(&gl->gl_reclaim, &sdp->sd_reclaim_list); | 1628 | list_add(&gl->gl_reclaim, &sdp->sd_reclaim_list); |
1596 | atomic_inc(&sdp->sd_reclaim_count); | 1629 | atomic_inc(&sdp->sd_reclaim_count); |
1597 | } | 1630 | spin_unlock(&sdp->sd_reclaim_lock); |
1598 | spin_unlock(&sdp->sd_reclaim_lock); | 1631 | wake_up(&sdp->sd_reclaim_wq); |
1599 | 1632 | } else | |
1600 | wake_up(&sdp->sd_reclaim_wq); | 1633 | spin_unlock(&sdp->sd_reclaim_lock); |
1601 | } | 1634 | } |
1602 | 1635 | ||
1603 | /** | 1636 | /** |
@@ -1897,7 +1930,6 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl) | |||
1897 | print_dbg(gi, " gl_owner = -1\n"); | 1930 | print_dbg(gi, " gl_owner = -1\n"); |
1898 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); | 1931 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); |
1899 | print_dbg(gi, " req_gh = %s\n", (gl->gl_req_gh) ? "yes" : "no"); | 1932 | print_dbg(gi, " req_gh = %s\n", (gl->gl_req_gh) ? "yes" : "no"); |
1900 | print_dbg(gi, " req_bh = %s\n", (gl->gl_req_bh) ? "yes" : "no"); | ||
1901 | print_dbg(gi, " lvb_count = %d\n", atomic_read(&gl->gl_lvb_count)); | 1933 | print_dbg(gi, " lvb_count = %d\n", atomic_read(&gl->gl_lvb_count)); |
1902 | print_dbg(gi, " object = %s\n", (gl->gl_object) ? "yes" : "no"); | 1934 | print_dbg(gi, " object = %s\n", (gl->gl_object) ? "yes" : "no"); |
1903 | print_dbg(gi, " reclaim = %s\n", | 1935 | print_dbg(gi, " reclaim = %s\n", |