aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-03-14 12:21:59 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2013-03-14 12:21:59 -0400
commitb01b599e1b86ce86b98566a926dfbea421023798 (patch)
tree982d7dbaa039ffe68e31f0fb0b960f62dd685784
parent89910b686aad35c02c9bca1a758184ba0eabc5b3 (diff)
BUG: Remove lock proc on destroy, not close
Remove lock proc entries on lock destruction, not lock close.
-rw-r--r--litmus/locking.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/litmus/locking.c b/litmus/locking.c
index c6eda968411f..d347fdce4cb7 100644
--- a/litmus/locking.c
+++ b/litmus/locking.c
@@ -69,9 +69,8 @@ static int create_generic_lock(void** obj_ref, obj_type_t type, void* __user ar
69 69
70 TRACE_CUR("Lock %d (%p) created. Type = %d\n.", lock->ident, lock, type); 70 TRACE_CUR("Lock %d (%p) created. Type = %d\n.", lock->ident, lock, type);
71 71
72 if (lock->proc && lock->proc->add) { 72 if (lock->proc && lock->proc->add)
73 lock->proc->add(lock); 73 lock->proc->add(lock);
74 }
75 } 74 }
76 return err; 75 return err;
77} 76}
@@ -89,11 +88,6 @@ static int close_generic_lock(struct od_table_entry* entry)
89{ 88{
90 struct litmus_lock* lock = get_lock(entry); 89 struct litmus_lock* lock = get_lock(entry);
91 if (lock->ops->close) { 90 if (lock->ops->close) {
92
93 if (lock->proc && lock->proc->remove) {
94 lock->proc->remove(lock);
95 }
96
97 return lock->ops->close(lock); 91 return lock->ops->close(lock);
98 } 92 }
99 else 93 else
@@ -103,6 +97,10 @@ static int close_generic_lock(struct od_table_entry* entry)
103static void destroy_generic_lock(obj_type_t type, void* obj) 97static void destroy_generic_lock(obj_type_t type, void* obj)
104{ 98{
105 struct litmus_lock* lock = (struct litmus_lock*) obj; 99 struct litmus_lock* lock = (struct litmus_lock*) obj;
100
101 if (lock->proc && lock->proc->remove)
102 lock->proc->remove(lock);
103
106 lock->ops->deallocate(lock); 104 lock->ops->deallocate(lock);
107} 105}
108 106
@@ -121,7 +119,6 @@ asmlinkage long sys_litmus_lock(int lock_od)
121 entry = get_entry_for_od(lock_od); 119 entry = get_entry_for_od(lock_od);
122 if (entry && is_lock(entry)) { 120 if (entry && is_lock(entry)) {
123 l = get_lock(entry); 121 l = get_lock(entry);
124 //TRACE_CUR("attempts to lock 0x%p\n", l);
125 TRACE_CUR("Attempts to lock %d\n", l->ident); 122 TRACE_CUR("Attempts to lock %d\n", l->ident);
126 err = l->ops->lock(l); 123 err = l->ops->lock(l);
127 if (!err) { 124 if (!err) {
@@ -155,7 +152,6 @@ asmlinkage long sys_litmus_unlock(int lock_od)
155 entry = get_entry_for_od(lock_od); 152 entry = get_entry_for_od(lock_od);
156 if (entry && is_lock(entry)) { 153 if (entry && is_lock(entry)) {
157 l = get_lock(entry); 154 l = get_lock(entry);
158 //TRACE_CUR("attempts to unlock 0x%p\n", l);
159 TRACE_CUR("Attempts to unlock %d\n", l->ident); 155 TRACE_CUR("Attempts to unlock %d\n", l->ident);
160 err = l->ops->unlock(l); 156 err = l->ops->unlock(l);
161 if (!err) { 157 if (!err) {