diff -Nru autofs-5.0.7/debian/changelog autofs-5.0.7/debian/changelog --- autofs-5.0.7/debian/changelog 2012-11-14 10:38:09.000000000 -0200 +++ autofs-5.0.7/debian/changelog 2014-05-05 09:45:12.000000000 -0300 @@ -1,3 +1,9 @@ +autofs (5.0.7-3ubuntu2) saucy; urgency=low + + * Fix file descriptor leak when reloading daemon. + + -- Rafael David Tinoco Mon, 05 May 2014 09:44:37 -0300 + autofs (5.0.7-3ubuntu1) raring; urgency=low * Merge from Debian, remaining changes are: diff -Nru autofs-5.0.7/debian/patches/fix-file-descriptor-leak-when-reloading.patch autofs-5.0.7/debian/patches/fix-file-descriptor-leak-when-reloading.patch --- autofs-5.0.7/debian/patches/fix-file-descriptor-leak-when-reloading.patch 1969-12-31 21:00:00.000000000 -0300 +++ autofs-5.0.7/debian/patches/fix-file-descriptor-leak-when-reloading.patch 2014-05-05 09:41:58.000000000 -0300 @@ -0,0 +1,97 @@ +Description: Fix file descriptor leak when reloading daemon + +AutoFS may leak file descriptors when some maps are modified and the daemon reloaded. +This can make autofs reach maximum amount of file descriptors available. + +Author: Leonardo Chiquitto +Author: Ian Kent + +Origin: upstream, commit: 7bcbad9bccb000cffa1295a93d6f0231dd66c61a +Last-Update: 2014-04-21 + +--- + daemon/direct.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/daemon/direct.c b/daemon/direct.c +index 4e8749b..fa4323c 100644 +--- a/daemon/direct.c ++++ b/daemon/direct.c +@@ -86,7 +86,8 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru + { + struct ioctl_ops *ops = get_ioctl_ops(); + char buf[MAX_ERR_BUF]; +- int ioctlfd, rv, left, retries; ++ int ioctlfd = -1, rv, left, retries; ++ int opened = 0; + + left = umount_multi(ap, me->key, 0); + if (left) { +@@ -103,8 +104,10 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru + return 1; + } + ioctlfd = me->ioctlfd; +- } else ++ } else { + ops->open(ap->logopt, &ioctlfd, me->dev, me->key); ++ opened = 1; ++ } + + if (ioctlfd >= 0) { + unsigned int status = 1; +@@ -113,12 +116,16 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru + if (rv) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, "ioctl failed: %s", estr); ++ if (opened && ioctlfd != -1) ++ ops->close(ap->logopt, ioctlfd); + return 1; + } else if (!status) { + if (ap->state != ST_SHUTDOWN_FORCE) { + error(ap->logopt, + "ask umount returned busy for %s", + me->key); ++ if (opened && ioctlfd != -1) ++ ops->close(ap->logopt, ioctlfd); + return 1; + } else { + me->ioctlfd = -1; +@@ -526,7 +533,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me) + { + struct ioctl_ops *ops = get_ioctl_ops(); + char buf[MAX_ERR_BUF]; +- int ioctlfd, rv = 1, retries; ++ int ioctlfd = -1, rv = 1, retries; ++ int opened = 0; + + if (me->ioctlfd != -1) { + if (is_mounted(_PATH_MOUNTED, me->key, MNTS_REAL)) { +@@ -544,6 +552,7 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me) + return 0; + } + ops->open(ap->logopt, &ioctlfd, me->dev, me->key); ++ opened = 1; + } + + if (ioctlfd >= 0) { +@@ -553,6 +562,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me) + if (rv) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + logerr("ioctl failed: %s", estr); ++ if (opened && ioctlfd != -1) ++ ops->close(ap->logopt, ioctlfd); + return 1; + } else if (!status) { + if (ap->state != ST_SHUTDOWN_FORCE) { +@@ -560,6 +571,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me) + error(ap->logopt, + "ask umount returned busy for %s", + me->key); ++ if (opened && ioctlfd != -1) ++ ops->close(ap->logopt, ioctlfd); + return 1; + } else { + me->ioctlfd = -1; +-- +1.9.1 + diff -Nru autofs-5.0.7/debian/patches/series autofs-5.0.7/debian/patches/series --- autofs-5.0.7/debian/patches/series 2012-11-14 09:49:47.000000000 -0200 +++ autofs-5.0.7/debian/patches/series 2014-05-05 09:43:47.000000000 -0300 @@ -27,4 +27,4 @@ # Ubuntu patches # 16group_buffer_size.patch - +fix-file-descriptor-leak-when-reloading.patch