aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPatrick Caulfield <pcaulfie@redhat.com>2006-04-25 14:49:01 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-25 14:49:01 -0400
commit714dc65c34385afbc21342f5bee8d0d25027ac9a (patch)
tree152697e333a34e4ce7502291527a8afe28996274 /fs
parent96c2c0083d76ca80d546a53089c86e74fbfbe791 (diff)
[DLM] Convert a semaphore to a completion
Convert a semaphore into a completion in device.c. Cc: David Teigland <teigland@redhat.com> Cc: Andrew Morton <akpm@osdl.org> Signed-off-by: Patrick Caulfield <pcaulfie@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/device.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/dlm/device.c b/fs/dlm/device.c
index 99d8b6b07fba..5da4b2ed988d 100644
--- a/fs/dlm/device.c
+++ b/fs/dlm/device.c
@@ -79,7 +79,7 @@ struct lock_info {
79 struct list_head li_ownerqueue; 79 struct list_head li_ownerqueue;
80 struct file_info *li_file; 80 struct file_info *li_file;
81 struct dlm_lksb __user *li_user_lksb; 81 struct dlm_lksb __user *li_user_lksb;
82 struct semaphore li_firstlock; 82 struct completion li_firstcomp;
83}; 83};
84 84
85/* A queued AST no less */ 85/* A queued AST no less */
@@ -376,8 +376,7 @@ static void ast_routine(void *param)
376 li->li_lksb.sb_status != 0) { 376 li->li_lksb.sb_status != 0) {
377 377
378 /* Wait till dlm_lock() has finished */ 378 /* Wait till dlm_lock() has finished */
379 down(&li->li_firstlock); 379 wait_for_completion(&li->li_firstcomp);
380 up(&li->li_firstlock);
381 380
382 spin_lock(&li->li_file->fi_li_lock); 381 spin_lock(&li->li_file->fi_li_lock);
383 list_del(&li->li_ownerqueue); 382 list_del(&li->li_ownerqueue);
@@ -808,10 +807,10 @@ static int do_user_lock(struct file_info *fi, uint8_t cmd,
808 li->li_castaddr = kparams->castaddr; 807 li->li_castaddr = kparams->castaddr;
809 li->li_castparam = kparams->castparam; 808 li->li_castparam = kparams->castparam;
810 809
811 /* OK, this isn;t exactly a FIRSTLOCK but it is the 810 /* OK, this isn't exactly a FIRSTLOCK but it is the
812 first time we've used this lockinfo, and if things 811 first time we've used this lockinfo, and if things
813 fail we want rid of it */ 812 fail we want rid of it */
814 init_MUTEX_LOCKED(&li->li_firstlock); 813 init_completion(&li->li_firstcomp);
815 set_bit(LI_FLAG_FIRSTLOCK, &li->li_flags); 814 set_bit(LI_FLAG_FIRSTLOCK, &li->li_flags);
816 add_lockinfo(li); 815 add_lockinfo(li);
817 816
@@ -839,10 +838,10 @@ static int do_user_lock(struct file_info *fi, uint8_t cmd,
839 if (!li) 838 if (!li)
840 return -ENOMEM; 839 return -ENOMEM;
841 840
842 /* semaphore to allow us to complete our work before 841 /* Allow us to complete our work before
843 the AST routine runs. In fact we only need (and use) this 842 the AST routine runs. In fact we only need (and use) this
844 when the initial lock fails */ 843 when the initial lock fails */
845 init_MUTEX_LOCKED(&li->li_firstlock); 844 init_completion(&li->li_firstcomp);
846 set_bit(LI_FLAG_FIRSTLOCK, &li->li_flags); 845 set_bit(LI_FLAG_FIRSTLOCK, &li->li_flags);
847 } 846 }
848 847
@@ -892,7 +891,7 @@ static int do_user_lock(struct file_info *fi, uint8_t cmd,
892 if (add_lockinfo(li)) 891 if (add_lockinfo(li))
893 printk(KERN_WARNING "Add lockinfo failed\n"); 892 printk(KERN_WARNING "Add lockinfo failed\n");
894 893
895 up(&li->li_firstlock); 894 complete(&li->li_firstcomp);
896 } 895 }
897 896
898 /* Return the lockid as the user needs it /now/ */ 897 /* Return the lockid as the user needs it /now/ */
@@ -936,8 +935,7 @@ static int do_user_unlock(struct file_info *fi, uint8_t cmd,
936 935
937 /* Wait until dlm_lock() has completed */ 936 /* Wait until dlm_lock() has completed */
938 if (!test_bit(LI_FLAG_ONLIST, &li->li_flags)) { 937 if (!test_bit(LI_FLAG_ONLIST, &li->li_flags)) {
939 down(&li->li_firstlock); 938 wait_for_completion(&li->li_firstcomp);
940 up(&li->li_firstlock);
941 } 939 }
942 940
943 /* dlm_unlock() passes a 0 for castaddr which means don't overwrite 941 /* dlm_unlock() passes a 0 for castaddr which means don't overwrite