From 19275aa8bbc3407406d473debf316d0dbe6f45e3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 31 Oct 2017 09:47:14 +0100 Subject: [PATCH] Fixed an invalid lock sequence when trying to remove a deleted recording in case of low disk space; now making sure that AssertFreeDiskSpace() is called with the maximum timer priority in case there are several timers recording with different priorities --- HISTORY | 6 +++++- menu.c | 3 +-- timers.c | 12 +++++++++++- timers.h | 4 +++- vdr.c | 4 +++- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index 823fc060..472526a8 100644 --- a/HISTORY +++ b/HISTORY @@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History a subdirectory. - SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details). -2017-10-11: Version 2.3.9 +2017-10-31: Version 2.3.9 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). @@ -9170,3 +9170,7 @@ Video Disk Recorder Revision History helping to debug this one). - Fixed handling VPS events outside the LingerLimit, which could cause recordings to stop prematurely (thanks to Johann Friedrichs). +- Fixed an invalid lock sequence when trying to remove a deleted recording in case + of low disk space. +- Now making sure that AssertFreeDiskSpace() is called with the maximum timer + priority in case there are several timers recording with different priorities. diff --git a/menu.c b/menu.c index c2c12dd8..105a7164 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 4.41 2017/06/30 09:49:39 kls Exp $ + * $Id: menu.c 4.42 2017/10/31 09:42:07 kls Exp $ */ #include "menu.h" @@ -5208,7 +5208,6 @@ bool cRecordControl::Process(time_t t) timer->SetPending(false); return false; } - AssertFreeDiskSpace(timer->Priority()); return true; } diff --git a/timers.c b/timers.c index 8987b126..bc894cc0 100644 --- a/timers.c +++ b/timers.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 4.11 2017/06/25 10:02:09 kls Exp $ + * $Id: timers.c 4.12 2017/10/31 09:41:31 kls Exp $ */ #include "timers.h" @@ -804,6 +804,16 @@ const cTimer *cTimers::GetMatch(const cEvent *Event, eTimerMatch *Match) const return t; } +int cTimers::GetMaxPriority(void) const +{ + int n = 0; + for (const cTimer *ti = First(); ti; ti = Next(ti)) { + if (!ti->Remote() && ti->Recording()) + n = max(n, ti->Priority()); + } + return n; +} + const cTimer *cTimers::GetNextActiveTimer(void) const { const cTimer *t0 = NULL; diff --git a/timers.h b/timers.h index c4932ba6..18ba30ec 100644 --- a/timers.h +++ b/timers.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.h 4.8 2017/04/20 09:09:45 kls Exp $ + * $Id: timers.h 4.9 2017/10/31 09:47:14 kls Exp $ */ #ifndef __TIMERS_H @@ -176,6 +176,8 @@ public: cTimer *GetMatch(time_t t) { return const_cast(static_cast(this)->GetMatch(t)); }; const cTimer *GetMatch(const cEvent *Event, eTimerMatch *Match = NULL) const; cTimer *GetMatch(const cEvent *Event, eTimerMatch *Match = NULL) { return const_cast(static_cast(this)->GetMatch(Event, Match)); } + int GetMaxPriority(void) const; + ///< Returns the maximum priority of all local timers that are currently recording. const cTimer *GetNextActiveTimer(void) const; const cTimer *UsesChannel(const cChannel *Channel) const; bool SetEvents(const cSchedules *Schedules); diff --git a/vdr.c b/vdr.c index d92c6297..fe104df2 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.tvdr.de * - * $Id: vdr.c 4.18 2017/06/10 11:53:39 kls Exp $ + * $Id: vdr.c 4.19 2017/10/31 09:46:22 kls Exp $ */ #include @@ -1171,6 +1171,8 @@ int main(int argc, char *argv[]) // Trigger remote timer polls: if (TriggerRemoteTimerPoll) Timers->TriggerRemoteTimerPoll(); + // Make sure there is enough free disk space for ongoing recordings: + AssertFreeDiskSpace(Timers->GetMaxPriority()); TimersStateKey.Remove(TimersModified); } // Recordings: