diff -Nru autofs5-5.0.6/debian/changelog autofs5-5.0.6/debian/changelog --- autofs5-5.0.6/debian/changelog 2012-09-12 16:28:23.000000000 -0300 +++ autofs5-5.0.6/debian/changelog 2014-05-02 17:54:13.000000000 -0300 @@ -1,3 +1,9 @@ +autofs5 (5.0.6-0ubuntu5.2) precise; urgency=low + + * Fix file descriptor leak when reloading daemon. + + -- Rafael David Tinoco Fri, 02 May 2014 17:54:03 -0300 + autofs5 (5.0.6-0ubuntu5.1) precise-proposed; urgency=low * Add patch to fix nsswitch parser to accept nsswitch.conf without an diff -Nru autofs5-5.0.6/debian/patches/fix-file-descriptor-leak-when-reloading.patch autofs5-5.0.6/debian/patches/fix-file-descriptor-leak-when-reloading.patch --- autofs5-5.0.6/debian/patches/fix-file-descriptor-leak-when-reloading.patch 1969-12-31 21:00:00.000000000 -0300 +++ autofs5-5.0.6/debian/patches/fix-file-descriptor-leak-when-reloading.patch 2014-04-21 14:37:23.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 autofs5-5.0.6/debian/patches/series autofs5-5.0.6/debian/patches/series --- autofs5-5.0.6/debian/patches/series 2012-09-12 16:27:17.000000000 -0300 +++ autofs5-5.0.6/debian/patches/series 2014-04-21 14:44:23.000000000 -0300 @@ -7,3 +7,4 @@ 17ld.patch non-ipv6-hostname-lookups.patch fix-nsswitch-conf-parser.patch +fix-file-descriptor-leak-when-reloading.patch