summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/sup_fs_location.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-16 11:54:29 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-16 15:33:56 +0100
commit66fac03fae3af9dded964b01c89662819dbfc5c2 (patch)
tree2d866941dc2ae2b633f62cfeec830e34d1e4c059 /cpukit/libcsupport/src/sup_fs_location.c
parentpsxstrsignal01: New test (diff)
downloadrtems-66fac03fae3af9dded964b01c89662819dbfc5c2.tar.bz2
libio: Fix deadlock in location management
Perform a context-dependent deferred location release to avoid a deadlock on the file system instance locks, for example during a chdir(). Update #2936.
Diffstat (limited to 'cpukit/libcsupport/src/sup_fs_location.c')
-rw-r--r--cpukit/libcsupport/src/sup_fs_location.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/cpukit/libcsupport/src/sup_fs_location.c b/cpukit/libcsupport/src/sup_fs_location.c
index 2b8126ee8b..db40d4f21a 100644
--- a/cpukit/libcsupport/src/sup_fs_location.c
+++ b/cpukit/libcsupport/src/sup_fs_location.c
@@ -106,7 +106,7 @@ void rtems_filesystem_global_location_assign(
*lhs_global_loc_ptr = rhs_global_loc;
rtems_filesystem_mt_entry_unlock(lock_context);
- rtems_filesystem_global_location_release(lhs_global_loc);
+ rtems_filesystem_global_location_release(lhs_global_loc, true);
}
static void release_with_count(
@@ -184,10 +184,11 @@ rtems_filesystem_global_location_t *rtems_filesystem_global_location_obtain(
}
void rtems_filesystem_global_location_release(
- rtems_filesystem_global_location_t *global_loc
+ rtems_filesystem_global_location_t *global_loc,
+ bool deferred
)
{
- if (_Thread_Dispatch_is_enabled()) {
+ if (!deferred) {
release_with_count(global_loc, 1);
} else {
rtems_interrupt_lock_context lock_context;
@@ -233,7 +234,7 @@ void rtems_filesystem_do_unmount(
rtems_filesystem_mt_lock();
rtems_chain_extract_unprotected(&mt_entry->mt_node);
rtems_filesystem_mt_unlock();
- rtems_filesystem_global_location_release(mt_entry->mt_point_node);
+ rtems_filesystem_global_location_release(mt_entry->mt_point_node, false);
(*mt_entry->ops->fsunmount_me_h)(mt_entry);
if (mt_entry->unmount_task != 0) {