[arch-commits] Commit in dovecot/trunk (3 files)

Thore Bödecker foxxx0 at archlinux.org
Mon Jun 11 17:50:38 UTC 2018


    Date: Monday, June 11, 2018 @ 17:50:38
  Author: foxxx0
Revision: 342376

upgpkg: dovecot 2.3.1-4

add patches to fix replication issues

Added:
  dovecot/trunk/dovecot-0004-fix-replication-hang-ioloop.patch
  dovecot/trunk/dovecot-0005-fix-mail_user_home_mkdir.patch
Modified:
  dovecot/trunk/PKGBUILD

------------------------------------------------+
 PKGBUILD                                       |    9 -
 dovecot-0004-fix-replication-hang-ioloop.patch |   26 ++++
 dovecot-0005-fix-mail_user_home_mkdir.patch    |  132 +++++++++++++++++++++++
 3 files changed, 163 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-06-11 17:28:08 UTC (rev 342375)
+++ PKGBUILD	2018-06-11 17:50:38 UTC (rev 342376)
@@ -11,7 +11,7 @@
 
 pkgname=dovecot
 pkgver=2.3.1
-pkgrel=3
+pkgrel=4
 
 pkgdesc="An IMAP and POP3 server written with security primarily in mind"
 url="http://dovecot.org/"
@@ -31,8 +31,8 @@
         'dovecot.sysusersd'
         'dovecot.tmpfilesd'
         'dovecot.ld.so.conf'
-        # needs "proper" fix according to upstream. might be fixed in 2.3.2
-        'dovecot-0003-dsync-Revert-to-tmp-if-home-does-not-exist.patch')
+        'dovecot-0004-fix-replication-hang-ioloop.patch'
+        'dovecot-0005-fix-mail_user_home_mkdir.patch')
 
 sha256sums=('0883821b97fd02a084a84b9469a681f7e6edc56541d854b5419d98891c51fb93'
             'SKIP'
@@ -39,7 +39,8 @@
             'c5e3a8ffe23e5deb4f7893d9877d972347c2ee45c4ebf713de85c537e47cfcaf'
             'bb7620be7fc0217d77fcac940441c2abbd9efc6ef660153288d09ba412e27e06'
             'a457a1691cfa82495fc0503bfa4b61e54b149e63400fe0f568dff2c24a3f7858'
-            '95c33d502936cd108a50001e1dbb0b6f885f8b9bfe2e53eaecc6c5ecf8a973d2')
+            '38d944d7fb3790f1ac64ecd855a37ba5c16374a83b374306ce6296a598f5257c'
+            'd4e34418dbe1b3ddd10e859bccd735e8708081916a5be3d35a8a54bdf8cda70c')
 validpgpkeys=(
   'E643F0BDFDCD04D9FFCB6279C948525140558AC9' # Timo Sirainen <tss at iki.fi>
   '2BE74AAB3EE754DFB9C80D3318A348AEED409DA1' # Dovecot Community Edition

Added: dovecot-0004-fix-replication-hang-ioloop.patch
===================================================================
--- dovecot-0004-fix-replication-hang-ioloop.patch	                        (rev 0)
+++ dovecot-0004-fix-replication-hang-ioloop.patch	2018-06-11 17:50:38 UTC (rev 342376)
@@ -0,0 +1,26 @@
+From a952e178943a5944255cb7c053d970f8e6d49336 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen at dovecot.fi>
+Date: Tue, 5 Jun 2018 20:23:52 +0300
+Subject: [PATCH] doveadm-server: Fix hang when sending a lot of output to
+ clients
+
+Nowadays ostream adds its io to the stream's specified ioloop, not to
+current ioloop.
+---
+ src/doveadm/client-connection-tcp.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/doveadm/client-connection-tcp.c b/src/doveadm/client-connection-tcp.c
+index a2e1358d7f..672017495d 100644
+--- a/src/doveadm/client-connection-tcp.c
++++ b/src/doveadm/client-connection-tcp.c
+@@ -336,6 +336,9 @@ static int doveadm_cmd_handle(struct client_connection_tcp *conn,
+ 	   running one and we can't call the original one recursively, so
+ 	   create a new ioloop. */
+ 	conn->ioloop = io_loop_create();
++	o_stream_switch_ioloop(conn->output);
++	if (conn->log_out != NULL)
++		o_stream_switch_ioloop(conn->log_out);
+ 
+ 	if (cmd_ver2 != NULL)
+ 		doveadm_cmd_server_run_ver2(conn, argc, argv, cctx);

Added: dovecot-0005-fix-mail_user_home_mkdir.patch
===================================================================
--- dovecot-0005-fix-mail_user_home_mkdir.patch	                        (rev 0)
+++ dovecot-0005-fix-mail_user_home_mkdir.patch	2018-06-11 17:50:38 UTC (rev 342376)
@@ -0,0 +1,132 @@
+From 59cd19919bf444e5c3fa429314408aacc8dd4eb8 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen at dovecot.fi>
+Date: Tue, 24 Apr 2018 18:47:28 +0300
+Subject: [PATCH 1/2] lib-storage: Add mail_user_home_mkdir()
+
+---
+ src/lib-storage/mail-user.c | 61 +++++++++++++++++++++++++++++++++++++++++++++
+ src/lib-storage/mail-user.h |  5 ++++
+ 2 files changed, 66 insertions(+)
+
+diff --git a/src/lib-storage/mail-user.c b/src/lib-storage/mail-user.c
+index 947e26cee4..a15ed353ff 100644
+--- a/src/lib-storage/mail-user.c
++++ b/src/lib-storage/mail-user.c
+@@ -8,6 +8,7 @@
+ #include "module-dir.h"
+ #include "home-expand.h"
+ #include "file-create-locked.h"
++#include "mkdir-parents.h"
+ #include "safe-mkstemp.h"
+ #include "str.h"
+ #include "strescape.h"
+@@ -716,6 +717,66 @@ void mail_user_stats_fill(struct mail_user *user, struct stats *stats)
+ 	user->v.stats_fill(user, stats);
+ }
+ 
++static int
++mail_user_home_mkdir_try_ns(struct mail_namespace *ns, const char *home)
++{
++	const enum mailbox_list_path_type types[] = {
++		MAILBOX_LIST_PATH_TYPE_DIR,
++		MAILBOX_LIST_PATH_TYPE_ALT_DIR,
++		MAILBOX_LIST_PATH_TYPE_CONTROL,
++		MAILBOX_LIST_PATH_TYPE_INDEX,
++		MAILBOX_LIST_PATH_TYPE_INDEX_PRIVATE,
++		MAILBOX_LIST_PATH_TYPE_INDEX_CACHE,
++		MAILBOX_LIST_PATH_TYPE_LIST_INDEX,
++	};
++	size_t home_len = strlen(home);
++	const char *path;
++
++	for (unsigned int i = 0; i < N_ELEMENTS(types); i++) {
++		if (!mailbox_list_get_root_path(ns->list, types[i], &path))
++			continue;
++		if (strncmp(path, home, home_len) == 0 &&
++		    (path[home_len] == '\0' || path[home_len] == '/')) {
++			return mailbox_list_mkdir_root(ns->list, path,
++						       types[i]) < 0 ? -1 : 1;
++		}
++	}
++	return 0;
++}
++
++int mail_user_home_mkdir(struct mail_user *user)
++{
++	struct mail_namespace *ns;
++	const char *home;
++	int ret;
++
++	if (mail_user_get_home(user, &home) < 0)
++		return -1;
++
++	/* Try to create the home directory by creating the root directory for
++	   a namespace that exists under the home. This way we end up in the
++	   special mkdir() code in mailbox_list_try_mkdir_root_parent().
++	   Start from INBOX, since that's usually the correct place. */
++	ns = mail_namespace_find_inbox(user->namespaces);
++	if ((ret = mail_user_home_mkdir_try_ns(ns, home)) != 0)
++		return ret < 0 ? -1 : 0;
++	/* try other namespaces */
++	for (ns = user->namespaces; ns != NULL; ns = ns->next) {
++		if ((ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) {
++			/* already tried the INBOX namespace */
++			continue;
++		}
++		if ((ret = mail_user_home_mkdir_try_ns(ns, home)) != 0)
++			return ret < 0 ? -1 : 0;
++	}
++	/* fallback to a safe mkdir() with 0700 mode */
++	if (mkdir_parents(home, 0700) < 0 && errno != EEXIST) {
++		i_error("mkdir_parents(%s) failed: %m", home);
++		return -1;
++	}
++	return 0;
++}
++
+ static const struct var_expand_func_table mail_user_var_expand_func_table_arr[] = {
+ 	{ "userdb", mail_user_var_expand_func_userdb },
+ 	{ NULL, NULL }
+diff --git a/src/lib-storage/mail-user.h b/src/lib-storage/mail-user.h
+index b97514df75..1627e34fe1 100644
+--- a/src/lib-storage/mail-user.h
++++ b/src/lib-storage/mail-user.h
+@@ -210,4 +210,9 @@ void mail_user_init_fs_settings(struct mail_user *user,
+    plugin must be loaded to have anything filled. */
+ void mail_user_stats_fill(struct mail_user *user, struct stats *stats);
+ 
++/* Try to mkdir() user's home directory. Ideally this should be called only
++   after the caller tries to create a file to the home directory, but it fails
++   with ENOENT. This way it avoids unnecessary disk IO to the home. */
++int mail_user_home_mkdir(struct mail_user *user);
++
+ #endif
+
+From 8077d714e11388a294f1583e706152396972acce Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen at dovecot.fi>
+Date: Tue, 24 Apr 2018 18:50:38 +0300
+Subject: [PATCH 2/2] dsync: If lock file can't be created because home is
+ missing, mkdir the home
+
+---
+ src/doveadm/dsync/dsync-brain.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/doveadm/dsync/dsync-brain.c b/src/doveadm/dsync/dsync-brain.c
+index c2b8169f1a..6bc013ff53 100644
+--- a/src/doveadm/dsync/dsync-brain.c
++++ b/src/doveadm/dsync/dsync-brain.c
+@@ -441,6 +441,13 @@ dsync_brain_lock(struct dsync_brain *brain, const char *remote_hostname)
+ 				       "/"DSYNC_LOCK_FILENAME, NULL);
+ 	brain->lock_fd = file_create_locked(brain->lock_path, &lock_set,
+ 					    &brain->lock, &created, &error);
++	if (brain->lock_fd == -1 && errno == ENOENT) {
++		/* home directory not created */
++		if (mail_user_home_mkdir(brain->user) < 0)
++			return -1;
++		brain->lock_fd = file_create_locked(brain->lock_path, &lock_set,
++			&brain->lock, &created, &error);
++	}
+ 	if (brain->lock_fd == -1)
+ 		i_error("Couldn't lock %s: %s", brain->lock_path, error);
+ 	else if (brain->debug) {



More information about the arch-commits mailing list