diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-08-16 07:55:39 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-10-18 14:29:37 -0400 |
commit | 4cb2ad2c18180420953d18580d822422b047f074 (patch) | |
tree | bdbccf83aca80c56db1ce706f7d1f8ac1601dbf5 | |
parent | d245619060965c2f379fadf6103e7b69a2d1e951 (diff) |
FDSO: make sure fdso_close() is called during task teardown
When a task exists and its FDSO table is released, the locking
protocol's 'close()' callback should be invoked to do proper
protocol-specific cleanup (such as unlocking the resource, if
required).
-rw-r--r-- | litmus/fdso.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/litmus/fdso.c b/litmus/fdso.c index cd85b9cd9a0a..250377d184e7 100644 --- a/litmus/fdso.c +++ b/litmus/fdso.c | |||
@@ -166,6 +166,18 @@ static int put_od_entry(struct od_table_entry* od) | |||
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | static long close_od_entry(struct od_table_entry *od) | ||
170 | { | ||
171 | long ret; | ||
172 | |||
173 | /* Give the class a chance to reject the close. */ | ||
174 | ret = fdso_close(od); | ||
175 | if (ret == 0) | ||
176 | ret = put_od_entry(od); | ||
177 | |||
178 | return ret; | ||
179 | } | ||
180 | |||
169 | void exit_od_table(struct task_struct* t) | 181 | void exit_od_table(struct task_struct* t) |
170 | { | 182 | { |
171 | int i; | 183 | int i; |
@@ -173,7 +185,7 @@ void exit_od_table(struct task_struct* t) | |||
173 | if (t->od_table) { | 185 | if (t->od_table) { |
174 | for (i = 0; i < MAX_OBJECT_DESCRIPTORS; i++) | 186 | for (i = 0; i < MAX_OBJECT_DESCRIPTORS; i++) |
175 | if (t->od_table[i].used) | 187 | if (t->od_table[i].used) |
176 | put_od_entry(t->od_table + i); | 188 | close_od_entry(t->od_table + i); |
177 | kfree(t->od_table); | 189 | kfree(t->od_table); |
178 | t->od_table = NULL; | 190 | t->od_table = NULL; |
179 | } | 191 | } |
@@ -287,11 +299,7 @@ asmlinkage long sys_od_close(int od) | |||
287 | return ret; | 299 | return ret; |
288 | 300 | ||
289 | 301 | ||
290 | /* give the class a chance to reject the close | 302 | ret = close_od_entry(t->od_table + od); |
291 | */ | ||
292 | ret = fdso_close(t->od_table + od); | ||
293 | if (ret == 0) | ||
294 | ret = put_od_entry(t->od_table + od); | ||
295 | 303 | ||
296 | return ret; | 304 | return ret; |
297 | } | 305 | } |