We study the problem of priority inversion in distributed real-time and embedded systems and propose a solution based on a distributed version of the priority inheritance protocol (PIP). The priority ceiling protocol (PCP) was designed in the context of centralized systems as a modification of PIP that also prevents deadlocks. Previous approaches to priority inversions in distributed systems use variations of PCP, which requires maintaining a global view of the acquired resources, involving a high communication overhead. This paper presents a distributed PIP, built on top of a deadlock avoidance schema. Since the system is already deadlock free and priority inversions can be detected locally, we obtain an efficient dynamic resource allocation system that prevents deadlocks and handles priority inversions.