[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-984-gc192144

2009-02-18 Thread Steven Danneman
The branch, master has been updated
   via  c19214424b0f8ca0dfa5970880e54807880c443c (commit)
   via  03421944b2bd82caf13946b745e4d634f0559f82 (commit)
   via  c441f58dedc465f59060296815a0bc7f9aeb743f (commit)
  from  cdcd525a05ce851dcb338dfa8c9be3009194aa96 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit c19214424b0f8ca0dfa5970880e54807880c443c
Author: todd stecher 
Date:   Thu Feb 12 13:03:03 2009 -0800

S3: Log warning in smbstatus about lack of pid in anonymous mode.

commit 03421944b2bd82caf13946b745e4d634f0559f82
Author: todd stecher 
Date:   Thu Feb 12 00:11:38 2009 -0800

S3: Stop creating SMBD cores when failing to create a pipe.

This was uncovered when the MAX FD limit was hit, causing an instant core
and invoking error reporting. This fix causes SMBD to exit, but without
building a core.

commit c441f58dedc465f59060296815a0bc7f9aeb743f
Author: todd stecher 
Date:   Tue Feb 17 16:16:35 2009 -0800

S3: Allow SMBD processes to survive in low memory condidtions

This commit adds a configure argument which allows for setting MADV_PROTECT
in the madvise() API.  With this enabled the kernel won't kill SMBD when
it's running low on memory.

---

Summary of changes:
 source3/configure.in|   28 
 source3/include/includes.h  |4 
 source3/lib/select.c|   12 +++-
 source3/printing/printing.c |   10 +++---
 source3/smbd/server.c   |   11 +++
 source3/utils/status.c  |4 
 6 files changed, 65 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/configure.in b/source3/configure.in
index 691d0a8..57d475f 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -4718,6 +4718,34 @@ SMB_LIBRARY(lua, 0)
 SMB_LIBRARY(addns, 0, no, [undefined API])
 
 
+#
+# check to see if we should set the protected madvise flag,
+# which will keep smbd alive in low memory conditions
+AC_MSG_CHECKING(whether to protect smbd from being killed in low memory)
+AC_ARG_WITH(madvise-protect,
+[AS_HELP_STRING([--with-madvise-protect], [Include low memory madvise 
protection (default=no)])],
+[ case "$withval" in
+  yes)
+AC_TRY_COMPILE([
+#include 
+],[
+int a = MADV_PROTECT;
+],
+[samba_cv_madvise_protect=yes],
+[samba_cv_madvise_protect=no])
+if test x"$samba_cv_madvise_protect" = x"yes"; then
+AC_MSG_RESULT(yes)
+AC_DEFINE(WITH_MADVISE_PROTECTED,1,[Whether to include low memory 
protection support])
+else
+AC_MSG_ERROR(Low memory protection supporte requires availability of 
MADVISE_PROTECT flag.)
+fi
+;;
+  *)
+AC_MSG_RESULT(no)
+;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
 
 #
 # these tests are taken from the GNU fileutils package
diff --git a/source3/include/includes.h b/source3/include/includes.h
index a9f813b..1906830 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -241,6 +241,10 @@ typedef int ber_int_t;
 #include 
 #endif
 
+#ifdef WITH_MADVISE_PROTECTED
+#include 
+#endif
+
 /* Special macros that are no-ops except when run under Valgrind on
  * x86.  They've moved a little bit from valgrind 1.0.4 to 1.9.4 */
 #if HAVE_VALGRIND_MEMCHECK_H
diff --git a/source3/lib/select.c b/source3/lib/select.c
index 14e5925..a58530a 100644
--- a/source3/lib/select.c
+++ b/source3/lib/select.c
@@ -59,7 +59,17 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, 
fd_set *errorfds, s
 
if (initialised != sys_getpid()) {
if (pipe(select_pipe) == -1)
-   smb_panic("Could not create select pipe");
+   {
+   DEBUG(0, ("sys_select: pipe failed (%s)\n",
+   strerror(errno)));
+   if (readfds != NULL)
+   FD_ZERO(readfds);
+   if (writefds != NULL)
+   FD_ZERO(writefds);
+   if (errorfds != NULL)
+   FD_ZERO(errorfds);
+   return -1;
+   }
 
/*
 * These next two lines seem to fix a bug with the Linux
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 17ddc55..7179184 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1478,9 +1478,13 @@ void start_background_queue(void)
 
ret = sys_select(maxfd, &r_fds, &w_fds, NULL, &to);
 
-   /* If pause_pipe[1] is closed it means the parent smbd
-* and children exited or aborted. */
-   if (ret =

Re: [SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-984-gc192144

2009-02-19 Thread Stefan (metze) Metzmacher
Hi Todd, hi Steven,

> commit c441f58dedc465f59060296815a0bc7f9aeb743f
> Author: todd stecher 
> Date:   Tue Feb 17 16:16:35 2009 -0800
> 
> S3: Allow SMBD processes to survive in low memory condidtions
> 
> This commit adds a configure argument which allows for setting 
> MADV_PROTECT
> in the madvise() API.  With this enabled the kernel won't kill SMBD when
> it's running low on memory.
> 

wouldn't it make sense to add this call to become_daemon() so that
nmbd and winbindd also get the protection.

I'm also wondering if we really want that the child (per connection)
smbds are also protected.

metze



signature.asc
Description: OpenPGP digital signature


Re: [SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-984-gc192144

2009-02-19 Thread Volker Lendecke
On Thu, Feb 19, 2009 at 11:17:50AM +0100, Stefan (metze) Metzmacher wrote:
> > commit c441f58dedc465f59060296815a0bc7f9aeb743f
> > Author: todd stecher 
> > Date:   Tue Feb 17 16:16:35 2009 -0800
> > 
> > S3: Allow SMBD processes to survive in low memory condidtions
> > 
> > This commit adds a configure argument which allows for setting 
> > MADV_PROTECT
> > in the madvise() API.  With this enabled the kernel won't kill SMBD when
> > it's running low on memory.
> > 
> 
> wouldn't it make sense to add this call to become_daemon() so that
> nmbd and winbindd also get the protection.
> 
> I'm also wondering if we really want that the child (per connection)
> smbds are also protected.

Yep, I think at most the parent smbd should be protected if
at all. We've had bad memleaks in the past and I'm sure in
certain workloads we still have them, and the kernel should
be given a chance to kill the main culprit.

Having all smbd's protected this way is definitely wrong.

Volker


pgpwnRO2upSgU.pgp
Description: PGP signature