<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13017">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Revert "app_voicemail: Cleanup stale lock files on module load"<br><br>This reverts commit fd2e8d0da7ba539470ed73d463d8bc641f7843af.<br><br>Reason for revert: Problematic for users who store their voicemail<br>on network storage devices, or share voicemail storage between<br>multiple Asterisk instances.<br><br>ASTERISK-28567 #close<br><br>Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41<br>---<br>M apps/app_voicemail.c<br>A doc/CHANGES-staging/voicemail_lock_cleanup_revert.txt<br>2 files changed, 10 insertions(+), 51 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index 1134ccd..63c251e 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -3796,54 +3796,6 @@</span><br><span> </span><br><span> #endif /* IMAP_STORAGE */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static void cleanup_orphaned_lock_files(const char *base)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- DIR *dir;</span><br><span style="color: hsl(0, 100%, 40%);">-       struct dirent *e;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       dir = opendir(base);</span><br><span style="color: hsl(0, 100%, 40%);">-    if (!dir) {</span><br><span style="color: hsl(0, 100%, 40%);">-             /* Don't complain about this too loudly */</span><br><span style="color: hsl(0, 100%, 40%);">-          ast_debug(2, "Unable to open `%s': %s\n", base, strerror(errno));</span><br><span style="color: hsl(0, 100%, 40%);">-         return;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       while ((e = readdir(dir))) {</span><br><span style="color: hsl(0, 100%, 40%);">-            char *fullpath;</span><br><span style="color: hsl(0, 100%, 40%);">-         struct stat s;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-          /* Always skip . and .. */</span><br><span style="color: hsl(0, 100%, 40%);">-              if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, "..")) {</span><br><span style="color: hsl(0, 100%, 40%);">-                    continue;</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               /* Build up the full path (using dynamic memory because PATH_MAX is crap) */</span><br><span style="color: hsl(0, 100%, 40%);">-            if (ast_asprintf(&fullpath, "%s/%s", base, e->d_name) == -1) {</span><br><span style="color: hsl(0, 100%, 40%);">-                 break;</span><br><span style="color: hsl(0, 100%, 40%);">-          }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               if (lstat(fullpath, &s) < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-                   ast_free(fullpath);</span><br><span style="color: hsl(0, 100%, 40%);">-                     continue;</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               /* This is exposing an implementation detail of ast_lock_path, but it makes</span><br><span style="color: hsl(0, 100%, 40%);">-              * our life a bit easier */</span><br><span style="color: hsl(0, 100%, 40%);">-             if (!strcmp(e->d_name, ".lock") && S_ISLNK(s.st_mode)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                   if (!ast_unlock_path(base)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                           ast_log(AST_LOG_NOTICE, "Cleaned up orphaned lock file: %s/.lock\n", base);</span><br><span style="color: hsl(0, 100%, 40%);">-                   }</span><br><span style="color: hsl(0, 100%, 40%);">-               } else if (S_ISDIR(s.st_mode)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                        /* If it is a directory, let's dive down */</span><br><span style="color: hsl(0, 100%, 40%);">-                 cleanup_orphaned_lock_files(fullpath);</span><br><span style="color: hsl(0, 100%, 40%);">-          }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               ast_free(fullpath);</span><br><span style="color: hsl(0, 100%, 40%);">-     }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       closedir(dir);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*! \brief Lock file path</span><br><span>  * only return failure if ast_lock_path returns 'timeout',</span><br><span>  * not if the path does not exist or any other reason</span><br><span>@@ -15362,9 +15314,6 @@</span><br><span>        /* compute the location of the voicemail spool directory */</span><br><span>  snprintf(VM_SPOOL_DIR, sizeof(VM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* Now that we have a spool directory, clean up old lock files */</span><br><span style="color: hsl(0, 100%, 40%);">-       cleanup_orphaned_lock_files(VM_SPOOL_DIR);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>   if (!(mwi_subscription_tps = ast_taskprocessor_get("app_voicemail", 0))) {</span><br><span>                 ast_log(AST_LOG_WARNING, "failed to reference mwi subscription taskprocessor.  MWI will not work\n");</span><br><span>      }</span><br><span>diff --git a/doc/CHANGES-staging/voicemail_lock_cleanup_revert.txt b/doc/CHANGES-staging/voicemail_lock_cleanup_revert.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..500c9a4</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/voicemail_lock_cleanup_revert.txt</span><br><span>@@ -0,0 +1,10 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_voicemail</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+A feature was added in Asterisk 13.27.0 and 16.4.0 that removed lock files from</span><br><span style="color: hsl(120, 100%, 40%);">+the Asterisk voicemail directory on startup. Some users that store their</span><br><span style="color: hsl(120, 100%, 40%);">+voicemails on network storage devices experienced slow startup times due to the</span><br><span style="color: hsl(120, 100%, 40%);">+relative expense of traversing the voicemail directory structure looking for</span><br><span style="color: hsl(120, 100%, 40%);">+orphaned lock files. This feature has now been removed.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Users who require the lock files to be removed at startup should modify their</span><br><span style="color: hsl(120, 100%, 40%);">+startup scripts to do so before starting the asterisk process.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13017">change 13017</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13017"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41 </div>
<div style="display:none"> Gerrit-Change-Number: 13017 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>