From b96277e28a583b4dfe84823d49e8133de78daed8 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 4 Dec 2017 13:07:39 +0100 Subject: [PATCH] Fixed a deadlock when moving a folder containing several recordings between different volumes --- CONTRIBUTORS | 2 ++ HISTORY | 4 +++- recording.c | 16 +++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4fbe9ebb..8fa7591d 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3284,6 +3284,8 @@ Matthias Senzel for reporting a bug in drawing very long menu titles in the LCARS skin for reporting and helping to debug a crash when stopping VDR for reporting a crash when moving a recording between different volumes + for reporting a deadlock when moving a folder containing several recordings between + different volumes Marek Nazarko for translating OSD texts to the Polish language diff --git a/HISTORY b/HISTORY index 605380ec..d8dbae75 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-11-29: Version 2.3.9 +2017-12-04: Version 2.3.9 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). @@ -9213,3 +9213,5 @@ Video Disk Recorder Revision History - Fixed positioning the cursor in the Recordings menu when moving a recording between different volumes. - Added a note to PLUGINS.html about writing log messages in English. +- Fixed a deadlock when moving a folder containing several recordings between + different volumes (reported by Matthias Senzel). diff --git a/recording.c b/recording.c index e2d6e7c5..ec6db3d6 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 4.11 2017/11/27 13:58:34 kls Exp $ + * $Id: recording.c 4.12 2017/12/04 13:03:11 kls Exp $ */ #include "recording.h" @@ -1857,7 +1857,7 @@ public: int Usage(const char *FileName = NULL) const; const char *FileNameSrc(void) const { return fileNameSrc; } const char *FileNameDst(void) const { return fileNameDst; } - bool Active(bool &Error); + bool Active(cRecordings *Recordings, bool &Error); }; cRecordingsHandlerEntry::cRecordingsHandlerEntry(int Usage, const char *FileNameSrc, const char *FileNameDst) @@ -1887,7 +1887,7 @@ int cRecordingsHandlerEntry::Usage(const char *FileName) const return u; } -bool cRecordingsHandlerEntry::Active(bool &Error) +bool cRecordingsHandlerEntry::Active(cRecordings *Recordings, bool &Error) { bool CopierFinishedOk = false; // First test whether there is an ongoing operation: @@ -1917,18 +1917,18 @@ bool cRecordingsHandlerEntry::Active(bool &Error) copier->Start(); } ClearPending(); - LOCK_RECORDINGS_WRITE; // to trigger a state change + Recordings->SetModified(); // to trigger a state change return true; } // Clean up: if (CopierFinishedOk && (Usage() & ruMove) != 0) { cRecording Recording(FileNameSrc()); if (Recording.Delete()) { - LOCK_RECORDINGS_WRITE; Recordings->DelByName(Recording.FileName()); + Recordings->SetModified(); // to trigger a state change } } - LOCK_RECORDINGS_WRITE; // to trigger a state change + Recordings->SetModified(); // to trigger a state change Recordings->TouchUpdate(); return false; } @@ -1954,9 +1954,11 @@ void cRecordingsHandler::Action(void) while (Running()) { bool Sleep = false; { + LOCK_RECORDINGS_WRITE; + Recordings->SetExplicitModify(); cMutexLock MutexLock(&mutex); if (cRecordingsHandlerEntry *r = operations.First()) { - if (!r->Active(error)) + if (!r->Active(Recordings, error)) operations.Del(r); else Sleep = true;