[Samba] Address family not supported by protocol

2013-10-08 Thread Thiago Fernandes Crepaldi
I've compile a Samba 4.0.9 for x86_64 with the following options:

CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-march=atom -O2 -pipe -fomit-frame-pointer" \
samba_cv_HAVE_GETTIMEOFDAY_TZ=yes \
samba_cv_HAVE_IFACE_IFCONF=yes \
samba_cv_HAVE_IFACE_IFREQ=yes \
ac_cv_have_setresuid=yes \
ac_cv_have_setresgid=yes \
ac_cv_file__proc_sys_kernel_core_pattern=yes \
samba_cv_USE_SETRESUID=yes \
samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes \
samba_cv_HAVE_WRFILE_KEYTAB=yes \
samba_cv_HAVE_OFF64_T=yes \
samba_cv_have_longlong=yes \
samba_cv_HAVE_MMAP=yes \
samba_cv_HAVE_INO64_T=yes \
samba_cv_CC_NEGATIVE_ENUM_VALUES=yes \
smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=no \
smb_krb5_cv_enctype_to_string_takes_size_t_arg=yes \
./configure \
--without-pie \
--disable-cups \
--disable-iprint \
--with-configdir=/etc/samba \
--with-logfilebase=/tmp/samba \
--with-lockdir=/tmp/samba \
--with-piddir=/tmp/samba \
--with-privatedir=/etc/samba/private \
--with-sendfile-support \
--with-ldap \
--with-ads \
--with-pam \
--with-pammodulesdir=/lib/x86_64-linux-gnu/security \
--with-pam_smbpass \
--with-winbind \
--with-acl-support \
--with-automount \
--enable-pthreadpool \
--with-dnsupdate \
--with-shared-modules=idmap_ad,idmap_rid \
--localstatedir=/var \
--with-libiconv=/usr \
--with-cachedir=/mnt/system/samba/system \
--prefix=/usr/local/samba \
--without-ad-dc \
--without-swat \
--without-quotas \
--with-aio-support \
--fail-immediately \
--jobs=8

After joining samba on a AD environment, I am not able to list users/groups
domains. I changed Log Level =2 and got this weird "Address family not
supported by protocol" error on *log.smbd*

[2013/10/08 11:49:55,  0] ../source3/smbd/server.c:1201(main)
  smbd version 4.0.9 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2012
[2013/10/08 11:49:55.136632,  0] ../source3/smbd/server.c:1281(main)
  standard input is not a socket, assuming -D option
[2013/10/08 11:49:55.763906,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!
[2013/10/08 11:49:55.765678,  0]
../source3/lib/util_sock.c:423(open_socket_in)
  open_socket_in(): socket() call failed: Address family not supported by
protocol
[2013/10/08 11:49:55.765901,  0]
../source3/smbd/server.c:685(smbd_open_one_socket)
  smbd_open_once_socket: open_socket_in: Address family not supported by
protocol
[2013/10/08 11:49:55.768391,  0]
../source3/lib/util_sock.c:423(open_socket_in)
  open_socket_in(): socket() call failed: Address family not supported by
protocol
[2013/10/08 11:49:55.768565,  0]
../source3/smbd/server.c:685(smbd_open_one_socket)
  smbd_open_once_socket: open_socket_in: Address family not supported by
protocol
[2013/10/08 11:50:56.374475,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!
[2013/10/08 12:03:57.631802,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!
[2013/10/08 12:16:58.867944,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!
[2013/10/08 12:29:59.868909,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!
[2013/10/08 12:43:01.144145,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!
[2013/10/08 12:56:02.329592,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!
[2013/10/08 13:09:03.247922,  0]
../source3/printing/print_standard.c:68(std_pcap_cache_reload)
  Unable to open printcap file lpstat for read!

At log.winbindd I got:

[2013/10/08 13:12:18,  0] ../source3/winbindd/winbindd.c:1409(main)
  winbindd version 4.0.9 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2012
[2013/10/08 13:12:18,  2]
../source3/lib/tallocmsg.c:124(register_msg_pool_usage)
  Registered MSG_REQ_POOL_USAGE
[2013/10/08 13:12:18,  2]
../source3/lib/dmallocmsg.c:78(register_dmalloc_msgs)
  Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED
[2013/10/08 13:12:18.895808,  2]
../source3/param/loadparm.c:544(max_open_files)
  rlimit_max: increasing rlimit_max (4096) to minimum Windows limit (16384)
[2013/10/08 13:12:18.896176,  1]
../source3/param/loadparm.c:3156(lp_do_parameter)
  WARNING: The "idmap backend" option is deprecated
[2013/10/08 13:12:18.896355,  1]
../source3/param/loadparm.c:3156(lp_do_parameter)
  WARNING: The "idmap uid" option is deprecated
[2013/10/08 13:12:18.896521,  1]
../source3/param/loadparm.c:3156(lp_do_parameter)
  WARNING: The "idmap gid" option is deprecated
[2013/10/08 13:12:18.897759, 

Re: [Samba] Samba4 consumes more CPU

2013-10-02 Thread Thiago Fernandes Crepaldi
Googling around copy_user_generic_unrolled() - a kernel space function -
seen in my previous smbd profiling, I found what might be a clue for the
performance drop. It is a comment on line #31 (see below) that says:

31 /*
32 * If CPU has ERMS feature, use copy_user_enhanced_fast_string.
33 * Otherwise, if CPU has rep_good feature, use copy_user_generic_string.
34 * Otherwise, use copy_user_generic_unrolled.
35 */

Which makes me guess that my Atom D2701 (
http://ark.intel.com/products/59683/Intel-Atom-Processor-D2700-1M-Cache-2_13-GHz)
is not compiled with REP_GOOD nor ERMS. It is not clear to me if the
processor does support those features, but apparently it does (looking at
/proc/cpuinfo from another user's NAS -
http://www.foxnetwork.ru/index.php/en/component/content/article/121-thecus-n4800eco.html
)

__

linux/arch/x86/include/asm/uaccess_64.h

Toggle line number - Style:
1 #ifndef _ASM_X86_UACCESS_64_H
2 #define _ASM_X86_UACCESS_64_H
3
4 /*
5 * User space memory access functions
6 */
7 #include 
8 #include 
9 #include 
10 #include 
11 #include 
12 #include 
13
14 /*
15 * Copy To/From Userspace
16 */
17
18 /* Handles exceptions in both to and from, but doesn't do access_ok */
19 __must_check unsigned long
20 copy_user_enhanced_fast_string(void *to, const void *from, unsigned len);
21 __must_check unsigned long
22 copy_user_generic_string(void *to, const void *from, unsigned len);
23 __must_check unsigned long
24 copy_user_generic_unrolled(void *to, const void *from, unsigned len);
25
26 static __always_inline __must_check unsigned long
27 copy_user_generic(void *to, const void *from, unsigned len)
28 {
29 unsigned ret;
30
31 /*
32 * If CPU has ERMS feature, use copy_user_enhanced_fast_string.
33 * Otherwise, if CPU has rep_good feature, use copy_user_generic_string.
34 * Otherwise, use copy_user_generic_unrolled.
35 */
36 alternative_call_2(copy_user_generic_unrolled,
37 copy_user_generic_string,
38 X86_FEATURE_REP_GOOD,
39 copy_user_enhanced_fast_string,
40 X86_FEATURE_ERMS,
41 ASM_OUTPUT2(""=a"" (ret), ""=D"" (to), ""=S"" (from),
42 ""=d"" (len)),
43 ""1"" (to), ""2"" (from), ""3"" (len)
44 : ""memory"", ""rcx"", ""r8"", ""r9"", ""r10"", ""r11"");
45 return ret;
46 }


On Tue, Oct 1, 2013 at 6:04 PM, Thiago Fernandes Crepaldi  wrote:

> That is funny. Now that I replaced samba 4 and libc-2.13.so with debug
> symbols, the perf profile seems to be have changed a bit after the same
> tests !
>
> Events: 54K cycles
> -   3.06%  smbd  [kernel.kallsyms] [k] copy_user_generic_unrolled
>- copy_user_generic_unrolled
> 52.63% __read_nocancel
> 36.20% __write_nocancel
> 2.70% __getdents64
> 2.44% __libc_readv
>   + 2.00% do_fcntl
> 0.87% __GI___libc_read
>   + 0.77% __fxstat64
> -   2.02%  smbd  libc-2.13.so  [.] _int_malloc
>+ _int_malloc
> -   1.62%  smbd  [kernel.kallsyms] [k] kmem_cache_alloc
>+ kmem_cache_alloc
> -   1.22%  smbd  libtalloc.so.2.0.7[.] _talloc_free
>+ _talloc_free
> -   0.99%  smbd  libtalloc.so.2.0.7[.]
> _talloc_free_children_internal.isra.4
>+ _talloc_free_children_internal.isra.4
> -   0.86%  smbd  libc-2.13.so  [.] __memcpy_ssse3
>+ __memcpy_ssse3
> +   0.81%  smbd  [kernel.kallsyms] [k] kmem_cache_free
> +   0.81%  smbd  libc-2.13.so  [.] _int_free
> +   0.79%  smbd  [kernel.kallsyms] [k] __kmalloc
> +   0.66%  smbd  libtalloc.so.2.0.7[.] _talloc_zero
> +   0.63%  smbd  [kernel.kallsyms] [k] link_path_walk
> +   0.63%  smbd  [kernel.kallsyms] [k] ext4_htree_store_dirent
> +   0.55%  smbd  libtalloc.so.2.0.7[.] talloc_alloc_pool
> +   0.55%  smbd  libc-2.13.so  [.] __memset_sse2
> +   0.53%  smbd  libc-2.13.so  [.] malloc
> +   0.53%  smbd  [kernel.kallsyms] [k] fcntl_setlk
> +   0.52%  smbd  [kernel.kallsyms] [k] get_page_from_freelist
> +   0.50%  smbd  libtalloc.so.2.0.7[.] talloc_get_name
> +   0.50%  smbd  [kernel.kallsyms] [k] tg3_start_xmit
> +   0.48%  smbd  [kernel.kallsyms] [k] memset
> +   0.47%  smbd  libc-2.13.so  [.] free
> +   0.47%  smbd  [kernel.kallsyms] [k] _raw_spin_lock
> +   0.45%  smbd  [kernel.kallsyms] [k] __d_lookup_rcu
> +   0.45%  smbd  libc-2.13.so  [.] __GI___strcmp_ssse3
> +   0.44%  smbd  libtalloc.so.2.0.7[.] _talloc_get_type_abort
> +   0.43%  smbd  [kernel.kallsyms]

Re: [Samba] Samba4 consumes more CPU

2013-10-01 Thread Thiago Fernandes Crepaldi
That is funny. Now that I replaced samba 4 and libc-2.13.so with debug
symbols, the perf profile seems to be have changed a bit after the same
tests !

Events: 54K cycles
-   3.06%  smbd  [kernel.kallsyms] [k] copy_user_generic_unrolled
   - copy_user_generic_unrolled
52.63% __read_nocancel
36.20% __write_nocancel
2.70% __getdents64
2.44% __libc_readv
  + 2.00% do_fcntl
0.87% __GI___libc_read
  + 0.77% __fxstat64
-   2.02%  smbd  libc-2.13.so  [.] _int_malloc
   + _int_malloc
-   1.62%  smbd  [kernel.kallsyms] [k] kmem_cache_alloc
   + kmem_cache_alloc
-   1.22%  smbd  libtalloc.so.2.0.7[.] _talloc_free
   + _talloc_free
-   0.99%  smbd  libtalloc.so.2.0.7[.]
_talloc_free_children_internal.isra.4
   + _talloc_free_children_internal.isra.4
-   0.86%  smbd  libc-2.13.so  [.] __memcpy_ssse3
   + __memcpy_ssse3
+   0.81%  smbd  [kernel.kallsyms] [k] kmem_cache_free
+   0.81%  smbd  libc-2.13.so  [.] _int_free
+   0.79%  smbd  [kernel.kallsyms] [k] __kmalloc
+   0.66%  smbd  libtalloc.so.2.0.7[.] _talloc_zero
+   0.63%  smbd  [kernel.kallsyms] [k] link_path_walk
+   0.63%  smbd  [kernel.kallsyms] [k] ext4_htree_store_dirent
+   0.55%  smbd  libtalloc.so.2.0.7[.] talloc_alloc_pool
+   0.55%  smbd  libc-2.13.so  [.] __memset_sse2
+   0.53%  smbd  libc-2.13.so  [.] malloc
+   0.53%  smbd  [kernel.kallsyms] [k] fcntl_setlk
+   0.52%  smbd  [kernel.kallsyms] [k] get_page_from_freelist
+   0.50%  smbd  libtalloc.so.2.0.7[.] talloc_get_name
+   0.50%  smbd  [kernel.kallsyms] [k] tg3_start_xmit
+   0.48%  smbd  [kernel.kallsyms] [k] memset
+   0.47%  smbd  libc-2.13.so  [.] free
+   0.47%  smbd  [kernel.kallsyms] [k] _raw_spin_lock
+   0.45%  smbd  [kernel.kallsyms] [k] __d_lookup_rcu
+   0.45%  smbd  libc-2.13.so  [.] __GI___strcmp_ssse3
+   0.44%  smbd  libtalloc.so.2.0.7[.] _talloc_get_type_abort
+   0.43%  smbd  [kernel.kallsyms] [k] system_call_after_swapgs
+   0.43%  smbd  [kernel.kallsyms] [k] ext4_mark_iloc_dirty
+   0.42%  smbd  libtalloc.so.2.0.7[.] talloc_is_parent
+   0.41%  smbd  [kernel.kallsyms] [k] __alloc_skb
+   0.41%  smbd  [kernel.kallsyms] [k] __posix_lock_file
+   0.40%  smbd  [kernel.kallsyms] [k] __ext4_get_inode_loc
+   0.39%  smbd  libc-2.13.so  [.] __strlen_sse2
+   0.39%  smbd  [kernel.kallsyms] [k] kfree
+   0.39%  smbd  [kernel.kallsyms] [k] tcp_recvmsg
+   0.38%  smbd  libtalloc.so.2.0.7[.] talloc_named_const
+   0.37%  smbd  libtalloc.so.2.0.7[.] _talloc_array


On Mon, Sep 30, 2013 at 6:19 PM, Thiago Fernandes Crepaldi <
togn...@gmail.com> wrote:

> Agreed. For some strange reason I though perf would "follow" the new smbd
> forked and account their data too =)
>
> Unfortunately, I don't have the libc symbols (at least for today) to see
> what is going on there, but here is what I got in the child smbd process on
> the server side. The client side is a Windows 7 Virtual machine running
> NASPT
>
> Could this result mean that most of the time the performance drop I am
> experiencing is due to libc ?
> I've never worked with perf before, but I will still try to resolve those
> crazy addresses
>
> Events: 45K cycles
> -   7.37%  smbd  libc-2.13.so  [.] 0x11e465
>- 0x7ffab9f2043c
> 41.73% 0
> 5.32% 0x1b3fbe0
> 5.29% 0x2c4dab0
> 3.60% 0x1b0b130
> 3.37% 0x1b0b2a0
> 2.94% 0x1b5af80
> 2.70% 0x1b0d850
> 2.64% 0x2825fb0
> 1.86% 0x28e06d0
> 1.83% 0x2afcc80
> 1.71% 0x1b2ccb0
> 1.64% 0x2a4deb0
> 1.63% 0x1b56e00
> 1.51% 0x1b6bd00
> 1.16% 0x1b49eb0
> 1.15% 0x1b506e0
> 1.13% 0x1b4da00
> 1.07% 0x1b35100
> 0.93% 0x1af9050
> 0.92% 0x2b03680
> 0.91% 0x2ae21f0
> 0.90% 0x1b21210
> 0.89% 0x1b5de80
> 0.89% 0x1b5aa80
> 0.89% 0x1b2e0e0
> 0.88% 0x1b59be0
> 0.87% 0x1b4c600
> 0.86% 0x1b2aa20
> 0.85% 0x1b4a940
> 0.85% 0x1b45f50
> 0.84% 0x1b4a6d0
> 0.84% 0x1b23940
> 0.82% 0x1b37210
> 0.82% 0x1b2cf30
> 0.82% 0x1b33320
> 0.77% 0x2c96d50
> 0.76% 0x202f380
> 0.75% 0x2bd0bd0
> 0.66% 0x1b5e1d0
>- 0x7ffab9f27e10
> 37.72% 0x2f62696c2f3365
>   + 23.78% 0
>   + 11.24% 0x7fffc9f76d40
>   + 6.25% set_unix_security_ctx
> 3.13% 0x645f6e656b6f74
> 2.46% 0x10009
>   + 2.17% 0x11b9f22aac
>

Re: [Samba] Samba4 consumes more CPU

2013-09-30 Thread Thiago Fernandes Crepaldi
Agreed. For some strange reason I though perf would "follow" the new smbd
forked and account their data too =)

Unfortunately, I don't have the libc symbols (at least for today) to see
what is going on there, but here is what I got in the child smbd process on
the server side. The client side is a Windows 7 Virtual machine running
NASPT

Could this result mean that most of the time the performance drop I am
experiencing is due to libc ?
I've never worked with perf before, but I will still try to resolve those
crazy addresses

Events: 45K cycles
-   7.37%  smbd  libc-2.13.so  [.] 0x11e465
   - 0x7ffab9f2043c
41.73% 0
5.32% 0x1b3fbe0
5.29% 0x2c4dab0
3.60% 0x1b0b130
3.37% 0x1b0b2a0
2.94% 0x1b5af80
2.70% 0x1b0d850
2.64% 0x2825fb0
1.86% 0x28e06d0
1.83% 0x2afcc80
1.71% 0x1b2ccb0
1.64% 0x2a4deb0
1.63% 0x1b56e00
1.51% 0x1b6bd00
1.16% 0x1b49eb0
1.15% 0x1b506e0
1.13% 0x1b4da00
1.07% 0x1b35100
0.93% 0x1af9050
0.92% 0x2b03680
0.91% 0x2ae21f0
0.90% 0x1b21210
0.89% 0x1b5de80
0.89% 0x1b5aa80
0.89% 0x1b2e0e0
0.88% 0x1b59be0
0.87% 0x1b4c600
0.86% 0x1b2aa20
0.85% 0x1b4a940
0.85% 0x1b45f50
0.84% 0x1b4a6d0
0.84% 0x1b23940
0.82% 0x1b37210
0.82% 0x1b2cf30
0.82% 0x1b33320
0.77% 0x2c96d50
0.76% 0x202f380
0.75% 0x2bd0bd0
0.66% 0x1b5e1d0
   - 0x7ffab9f27e10
37.72% 0x2f62696c2f3365
  + 23.78% 0
  + 11.24% 0x7fffc9f76d40
  + 6.25% set_unix_security_ctx
3.13% 0x645f6e656b6f74
2.46% 0x10009
  + 2.17% 0x11b9f22aac
2.16% 0x1b53000
  + 2.12% 0x2a29850
2.08% 0xbe70f04c4c
2.01% 0x1b0af00
1.94% 0x1b07390
1.51% 0x1b49b00
1.41% 0x2010
   - 0x7ffab9fc6c10
  + 18.08% 0
  + 13.63% 0x2c5fc20
  + 11.62% 0x2be7b10
  + 7.90% 0x2be8560
  + 6.61% 0x2a29850
  + 6.30% 0x2b3d6c0
5.67% 0x4e6f5479706f43
  + 5.64% 0x29d7110
  + 5.54% 0x2467130
  + 5.53% 0x2b3d5e0
  + 5.31% 0x28c81a0
  + 4.20% 0x2c5fa30
  + 3.98% 0x2a98990
   + 0x7ffab9f20438
   + 0x7ffab9f2045c
 0x7ffab9fc8e03
   + 0x7ffab9fc425e
   + 0x7ffab9f2a715
   + 0x7ffab9f2a6d0
 0x7ffab9f1f851
 0x7ffab9f1f2ac
   + 0x7ffab9f27e25
   + 0x7ffab9f2a648
   + 0x7ffab9fc4240
 0x7ffab9fc8654
 0x7ffab9f206bf
   + 0x7ffab9f20548
   + 0x7ffab9f20bc2
   + 0x7ffab9f1f130
   + 0x7ffab9f26310
   + 0x7ffab9f20422
 0x7ffab9f1e0db
 0x7ffab9f1f179
   + 0x7ffab9f2a6f2
   + 0x7ffab9f20572
   + 0x7ffab9f2054c
   + 0x7ffab9fc42c5
-   1.72%  smbd  [kernel.kallsyms] [k] kmem_cache_alloc
   + kmem_cache_alloc
-   1.30%  smbd  libtalloc.so.2.0.7[.] _talloc_free
   + _talloc_free
-   1.10%  smbd  libtalloc.so.2.0.7[.]
_talloc_free_children_internal.i
   + _talloc_free_children_internal.isra.4
-   1.07%  smbd  [kernel.kallsyms] [k] copy_user_generic_unrolled
   + copy_user_generic_unrolled
-   0.95%  smbd  [kernel.kallsyms] [k] __kmalloc
   + __kmalloc
-   0.78%  smbd  [kernel.kallsyms] [k] ext4_htree_store_dirent
   + ext4_htree_store_dirent
   + 0x7ffab9f4f2f5
-   0.73%  smbd  [kernel.kallsyms] [k] kmem_cache_free
   + kmem_cache_free
-   0.73%  smbd  [kernel.kallsyms] [k] link_path_walk
   + link_path_walk
-   0.69%  smbd  libc-2.13.so  [.] malloc
   + malloc
-   0.69%  smbd  libtalloc.so.2.0.7[.] _talloc_zero
   + _talloc_zero
-   0.62%  smbd  [kernel.kallsyms] [k] fcntl_setlk
   + fcntl_setlk
   + 0x7ffabcf93238
-   0.59%  smbd  [kernel.kallsyms] [k] __d_lookup_rcu
   + __d_lookup_rcu
-   0.57%  smbd  libtalloc.so.2.0.7[.] talloc_alloc_pool
   + talloc_alloc_pool
-   0.55%  smbd  libtalloc.so.2.0.7[.] talloc_get_name
   + talloc_get_name
-   0.55%  smbd  [kernel.kallsyms] [k] __posix_lock_file
   + __posix_lock_file
   + 0x7ffabcf93238
-   0.50%  smbd  [kernel.kallsyms] [k] _raw_spin_lock
   + _raw_spin_lock
+   0.49%  smbd  [kernel.kallsyms] [k] tg3_start_xmit
+   0.48%  smbd  [kernel.kallsyms] [k] system_call_after_swapgs
+   0.46%  smbd  libtalloc.so.2.0.7[.] talloc_named_const
+   0.46%  smbd  [kernel.kallsyms] [k] memset
+   0.46%  smbd  libtalloc.so.2.0.7[.] _talloc_get_type_abort
+   0.45%  smbd  [kernel.kallsyms] [k] str2hashbuf_signed
+   0.45%  smbd  [kernel.kallsyms] [k] kfree
+   0.45%  smbd  libc-2.13.so  [.] free
+   0.44%  smbd  [kernel.kallsyms] [k] __alloc_skb
+   0.42%  smbd  libtalloc.so.2.0.7[.] talloc_is_parent
+   0.41%  smbd  libtalloc.so.2.0.7[.] _talloc_array





On Mon, Sep 30, 2013 at 5:39 PM, Jeremy Allison  wrote:

> On Mon, Sep 30, 2013 at 05:21:44PM 

Re: [Samba] Samba4 consumes more CPU

2013-09-30 Thread Thiago Fernandes Crepaldi
Andrew, in my company we are also experiencing a higher CPU usage of Samba
4 (smbd) if compared to Samba 3.

In fact, it almost reaches 100% of CPU and uses all the memory during *dir
copies* (individual file copy is as good as samba 3's). I strongly believe
that this CPU usage is the responsible for a worse samba 4's throughput if
compared to Samba 3 tests.

Giving that, I would like to contribute with this investigation and share
my data regarding perf profiling on smbd (parent process)

Events: 7  cycles
-  90.01%  smbd  [kernel.kallsyms]  [k] copy_pte_range
 copy_pte_range
 __libc_fork
 smbd_accept_connection
-   9.77%  smbd  [kernel.kallsyms]  [k] handle_edge_irq
 handle_edge_irq
 smbd_accept_connection
-   0.22%  smbd  [kernel.kallsyms]  [k] perf_pmu_rotate_start.isra.57
 perf_pmu_rotate_start.isra.57
 __poll
-   0.00%  smbd  [kernel.kallsyms]  [k] native_write_msr_safe
 native_write_msr_safe
 __poll

My smb.conf is:

[Global]
available= yes
client signing= auto
server signing= auto
server string= LenovoEMCâ
 ¢ px4-400r
Workgroup= WORKGROUP
security= user
domain master= auto
preferred master= auto
local master= yes
os level= 20
invalid users= bin daemon adm sync shutdown halt mail news uucp gopher
map to guest= Bad User
host msdfs= yes
restrict anonymous= 0
strict allocate= yes
encrypt passwords= yes
passdb backend= smbpasswd
printcap name= lpstat
printable= no
load printers= yes
max smbd processes= 500
getwd cache= yes
syslog= 0
use sendfile= yes
browse directory= /tmp/samba
winbind sequence directory= /tmp/samba
log level= 0
max log size= 50
unix extensions= no
veto files= /.AppleDouble/.AppleDB/.bin/.AppleDesktop/Network Trash
Folder/Temporary Items/:2eDS_Store/

[Printers]
path= /mnt/system/samba/spool
printable= yes
only guest= yes
use client driver= yes
comment= All Printers

[USB_UnkVend_USB_DISK_MOD_a_1]
path= /mnt/ext/USB_UnkVend_USB_DISK_MOD_a_1/
max connections= 150
directory mode= 0777
create mode= 0777
follow symlinks= yes
wide links= no
strict allocate= no
nt acl support= no
dos filemode= no
writeable= yes
public= yes
store dos attributes= yes
write list= guest

[Backups]
path= /mnt/pools/A/A0/Backups/
max connections= 150
directory mode= 0777
create mode= 0777
follow symlinks= yes
wide links= no
nt acl support= no
dos filemode= no
writeable= yes
public= yes
store dos attributes= yes
write list= guest

[Documents]
path= /mnt/pools/A/A0/Documents/
max connections= 150
directory mode= 0777
create mode= 0777
follow symlinks= yes
wide links= no
nt acl support= no
dos filemode= no
writeable= yes
public= yes
store dos attributes= yes
write list= guest

My samba 4.0.9 was compiled with the following options:
CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-march=atom -O2 -pipe -fomit-frame-pointer" \
samba_cv_HAVE_GETTIMEOFDAY_TZ=yes \
samba_cv_HAVE_IFACE_IFCONF=yes \
samba_cv_HAVE_IFACE_IFREQ=yes \
ac_cv_have_setresuid=yes \
ac_cv_have_setresgid=yes \
ac_cv_file__proc_sys_kernel_core_pattern=yes \
samba_cv_USE_SETRESUID=yes \
samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes \
samba_cv_HAVE_WRFILE_KEYTAB=yes \
samba_cv_HAVE_OFF64_T=yes \
samba_cv_have_longlong=yes \
samba_cv_HAVE_MMAP=yes \
samba_cv_HAVE_INO64_T=yes \
samba_cv_CC_NEGATIVE_ENUM_VALUES=yes \
smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=no \
smb_krb5_cv_enctype_to_string_takes_size_t_arg=yes \
./configure \
--without-pie \
--disable-cups \
--disable-iprint \
--with-configdir=/etc/samba \
--with-logfilebase=/tmp/samba \
--with-lockdir=/tmp/samba \
--with-piddir=/tmp/samba \
--with-privatedir=/etc/samba/private \
--with-sendfile-support \
--with-ldap \
--with-ads \
--with-pam \
--with-pammodulesdir=/lib/x86_64-linux-gnu/security \
--with-pam_smbpass \
--with-winbind \
--with-acl-support \
--with-automount \
--enable-pthreadpool \
--with-dnsupdate \
--with-shared-modules=idmap_ad,idmap_rid \
--localstatedir=/var \
--with-libiconv=/usr \
--with-cachedir=/mnt/system/samba/system \
--prefix=/usr/local/samba \
--without-ad-dc \
--without-swat \
--without-quotas \
--with-aio-support \
--fail-immediately \
--jobs=8 \
--enable-debug \ # i added this to use with perf only #

Please, let me know if I can do help more !
Thiago


On Mon, Sep 2, 2013 at 5:50 PM, Andrew Bartlett  wrote:

> On Mon, 2013-08-26 at 22:39 +0530, Prema wrote:
> > Dear Andrew,
> >
> > As per your suggestion , I have attached the gdb log of the samba and
> smbd
> > process log running in the single server mode.
> > Also when I noted in the perf top, libndr.so consumes the maximum cpu.
> > I noticed that it happens soon after sometime the samba process is
> started
> > and the CPU is filled up.
> > Since the samba process occupies 100% atleast two or

Re: [Samba] Bug on PAM_Winbind ?

2013-08-22 Thread Thiago Fernandes Crepaldi
One interesting thing is that if I put pam_winbind in front of pam_smbpass
on /etc/pam.d/pwauth, AD domain users will be granted access, workgroup
users will NOT and the core dump does not occur.

I can't really know if the problem is in pam_smbpass or pam_winbind. pwauth
code is correct, though.

*/etc/pam.d/pwauth which does't not coredump*
 *
*
#%PAM-1.0
auth   sufficient   /lib/security/pam_winbind.so   cached_login
auth   required /lib/security/pam_winbind.so   krb5_auth
auth   sufficient   /lib/security/pam_smbpass.so
accountrequired /lib/security/pam_nologin.so
accountrequired /lib/security/pam_winbind.so
accountsufficient   /lib/security/pam_smbpass.so
password   required /lib/security/pam_winbind.so
password   sufficient   /lib/security/pam_smbpass.so
sessionrequired /lib/security/pam_unix.so





On Wed, Aug 21, 2013 at 12:14 PM, Thiago Fernandes Crepaldi <
togn...@gmail.com> wrote:

> Hello guys,
>
> I am using PAM (0.82) to authenticate (samba) workgroup users and it works
> fine (pam_smbpass).  But after joining a domain and start using pam_winbind
> too, pwauth (2.3.10) get a segmentation fault when trying to authenticate
> any workgroup or domain user. What happens is that it does authenticate the
> user successfully, but when it calls pam_end() to release its resources, it
> crashes. Maybe pam_winbind is freeing something that will be freed by
> pam_end or something like that - I don't really know about PAM and their
> modules (smbpass/winbind), but it seems that pam_winbind might be misusing
> libtalloc somehow. Any ideas ?
>
> I believe this is an important use case because (AFAIK) it is the
> recommended way of authenticating users on web servers. Although I am using
> Samba 4.0.9 (with symbols), I can also see this issue on Samba 4.0.7 and
> 4.0.0 too. The funny thing is that it works fine on samba 3.6.9, though.
>
> *pwauth backtrace:*
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xb7e32f03 in ?? ()
> (gdb) bt
> #0  0xb7e32f03 in ?? ()
> *#1  0xb7bb26e1 in _talloc_free_internal (ptr=0x80612d0,
> location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
> ../lib/talloc/talloc.c:831*
> *#2  0xb7bb33f0 in _talloc_free_children_internal (tc=0x8060d88,
> ptr=0x8060db8, location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
> ../lib/talloc/talloc.c:1256*
> *#3  0xb7bb2830 in _talloc_free_internal (ptr=0x8060db8,
> location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
> ../lib/talloc/talloc.c:851*
> *#4  0xb7bb3742 in _talloc_free (ptr=0x8060db8, location=0xb7bb54c7
> "../lib/talloc/talloc.c:2251") at ../lib/talloc/talloc.c:1371*
> *#5  0xb7bb4d82 in talloc_autofree () at ../lib/talloc/talloc.c:2251*
> *#6  0xb7e865e8 in __cxa_finalize () from /lib/i386-linux-gnu/libc.so.6*
> *#7  0xb7bb1a43 in __do_global_dtors_aux () from
> /usr/local/samba/lib/private/libtalloc.so.2*
> #8  0xb7ff4e52 in ?? () from /lib/ld-linux.so.2
> #9  0xb7ff5947 in ?? () from /lib/ld-linux.so.2
>  #10 0xb7e53cc4 in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #11 0xb7fefde6 in ?? () from /lib/ld-linux.so.2
> #12 0xb7e540bc in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #13 0xb7e53cfa in dlclose () from /lib/i386-linux-gnu/libdl.so.2
> #14 0xb7fadf8b in ?? () from /lib/i386-linux-gnu/libpam.so.0
> #15 0xb7fab8ff in ?? () from /lib/i386-linux-gnu/libpam.so.0
> *#16 0xb7fa8da0 in pam_end () from /lib/i386-linux-gnu/libpam.so.0*
> #17 0x08048baf in check_auth (login=0xb8bf "admin", passwd=0xb4be
> "soho") at auth_pam.c:186
> #18 0x08048952 in main (argc=1, argv=0xbd84) at main.c:92
>
> *cat /etc/nsswitch.conf *
>
> passwd: files winbind
> shadow: files winbind
> group:  files winbind
> hosts:  files wins dns
> bootparams: nisplus [NOTFOUND=return] files
> ethers: files
> netmasks:   files
> networks:   files
> protocols:  files
> rpc:files
> services:   files
> netgroup:   nisplus
> publickey:  nisplus
> automount:  files nisplus
> aliases:files nisplus
>
> *cat /etc/pam.d/pwauth *
> #%PAM-1.0
> auth   sufficient   /lib/security/pam_smbpass.so
> auth   sufficient   /lib/security/pam_winbind.so   cached_login
> auth   required /lib/security/pam_winbind.so   krb5_auth
> accountrequired /lib/security/pam_nologin.so
> accountsufficient   /lib/security/pam_smbpass.so
> accountrequired /lib/security/pam_winbind.so
> password   sufficient   /lib/security/pam_smbpass.so
> password   required /lib/security/pam_winbind.so
> sessionrequired /lib/security/pam_unix.so
>
> *cat /etc/samba/smb.conf*
> [Global]
> available= yes
> client signing= auto
> se

Re: [Samba] Bug on PAM_Winbind ?

2013-08-21 Thread Thiago Fernandes Crepaldi
As expected, if I comment out talloc_free() call, pwauth's pam_end() will
not crash and everything will work (user credentials will be verified and
access will be granted - memory will leak, though)

talloc.c:2249
static void talloc_autofree(void)
{
talloc_free(autofree_context);
}


On Wed, Aug 21, 2013 at 12:14 PM, Thiago Fernandes Crepaldi <
togn...@gmail.com> wrote:

> Hello guys,
>
> I am using PAM (0.82) to authenticate (samba) workgroup users and it works
> fine (pam_smbpass).  But after joining a domain and start using pam_winbind
> too, pwauth (2.3.10) get a segmentation fault when trying to authenticate
> any workgroup or domain user. What happens is that it does authenticate the
> user successfully, but when it calls pam_end() to release its resources, it
> crashes. Maybe pam_winbind is freeing something that will be freed by
> pam_end or something like that - I don't really know about PAM and their
> modules (smbpass/winbind), but it seems that pam_winbind might be misusing
> libtalloc somehow. Any ideas ?
>
> I believe this is an important use case because (AFAIK) it is the
> recommended way of authenticating users on web servers. Although I am using
> Samba 4.0.9 (with symbols), I can also see this issue on Samba 4.0.7 and
> 4.0.0 too. The funny thing is that it works fine on samba 3.6.9, though.
>
> *pwauth backtrace:*
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xb7e32f03 in ?? ()
> (gdb) bt
> #0  0xb7e32f03 in ?? ()
> *#1  0xb7bb26e1 in _talloc_free_internal (ptr=0x80612d0,
> location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
> ../lib/talloc/talloc.c:831*
> *#2  0xb7bb33f0 in _talloc_free_children_internal (tc=0x8060d88,
> ptr=0x8060db8, location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
> ../lib/talloc/talloc.c:1256*
> *#3  0xb7bb2830 in _talloc_free_internal (ptr=0x8060db8,
> location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
> ../lib/talloc/talloc.c:851*
> *#4  0xb7bb3742 in _talloc_free (ptr=0x8060db8, location=0xb7bb54c7
> "../lib/talloc/talloc.c:2251") at ../lib/talloc/talloc.c:1371*
> *#5  0xb7bb4d82 in talloc_autofree () at ../lib/talloc/talloc.c:2251*
> *#6  0xb7e865e8 in __cxa_finalize () from /lib/i386-linux-gnu/libc.so.6*
> *#7  0xb7bb1a43 in __do_global_dtors_aux () from
> /usr/local/samba/lib/private/libtalloc.so.2*
> #8  0xb7ff4e52 in ?? () from /lib/ld-linux.so.2
> #9  0xb7ff5947 in ?? () from /lib/ld-linux.so.2
>  #10 0xb7e53cc4 in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #11 0xb7fefde6 in ?? () from /lib/ld-linux.so.2
> #12 0xb7e540bc in ?? () from /lib/i386-linux-gnu/libdl.so.2
> #13 0xb7e53cfa in dlclose () from /lib/i386-linux-gnu/libdl.so.2
> #14 0xb7fadf8b in ?? () from /lib/i386-linux-gnu/libpam.so.0
> #15 0xb7fab8ff in ?? () from /lib/i386-linux-gnu/libpam.so.0
> *#16 0xb7fa8da0 in pam_end () from /lib/i386-linux-gnu/libpam.so.0*
> #17 0x08048baf in check_auth (login=0xb8bf "admin", passwd=0xb4be
> "soho") at auth_pam.c:186
> #18 0x08048952 in main (argc=1, argv=0xbd84) at main.c:92
>
> *cat /etc/nsswitch.conf *
>
> passwd: files winbind
> shadow: files winbind
> group:  files winbind
> hosts:  files wins dns
> bootparams: nisplus [NOTFOUND=return] files
> ethers: files
> netmasks:   files
> networks:   files
> protocols:  files
> rpc:files
> services:   files
> netgroup:   nisplus
> publickey:  nisplus
> automount:  files nisplus
> aliases:files nisplus
>
> *cat /etc/pam.d/pwauth *
> #%PAM-1.0
> auth   sufficient   /lib/security/pam_smbpass.so
> auth   sufficient   /lib/security/pam_winbind.so   cached_login
> auth   required /lib/security/pam_winbind.so   krb5_auth
> accountrequired /lib/security/pam_nologin.so
> accountsufficient   /lib/security/pam_smbpass.so
> accountrequired /lib/security/pam_winbind.so
> password   sufficient   /lib/security/pam_smbpass.so
> password   required /lib/security/pam_winbind.so
> sessionrequired /lib/security/pam_unix.so
>
> *cat /etc/samba/smb.conf*
> [Global]
> available= yes
> client signing= auto
> server signing= auto
> server string= Bla
> Workgroup= DISNEY
> netbios name= vmstore-4
> realm= DISNEY.XXTEST.ASD-ABC.LOCALDOMAIN
> password server= *
> idmap backend= tdb
> idmap uid= 5000-999
> idmap gid= 5000-999
> idmap config DISNEY : backend= rid
> idmap config DISNEY : range= 1000-1999
> security= ADS
> name resolve order= wins host bcast lmhosts
> client use spnego= yes
> dns proxy= no
> winbind use default domain= no
> winbind nested groups= yes
> inherit acls= yes
> winbind enum users= yes
> winbind enum groups= yes
> winbind separator= \\
> winbind cache time= 300
> winbind offline logon= true
> encrypt passwords= yes
> passdb backend= smbpasswd
>



-- 
Thiago Fernandes Crepaldi (aka Crepaldi)
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


[Samba] Bug on PAM_Winbind ?

2013-08-21 Thread Thiago Fernandes Crepaldi
Hello guys,

I am using PAM (0.82) to authenticate (samba) workgroup users and it works
fine (pam_smbpass).  But after joining a domain and start using pam_winbind
too, pwauth (2.3.10) get a segmentation fault when trying to authenticate
any workgroup or domain user. What happens is that it does authenticate the
user successfully, but when it calls pam_end() to release its resources, it
crashes. Maybe pam_winbind is freeing something that will be freed by
pam_end or something like that - I don't really know about PAM and their
modules (smbpass/winbind), but it seems that pam_winbind might be misusing
libtalloc somehow. Any ideas ?

I believe this is an important use case because (AFAIK) it is the
recommended way of authenticating users on web servers. Although I am using
Samba 4.0.9 (with symbols), I can also see this issue on Samba 4.0.7 and
4.0.0 too. The funny thing is that it works fine on samba 3.6.9, though.

*pwauth backtrace:*

Program received signal SIGSEGV, Segmentation fault.
0xb7e32f03 in ?? ()
(gdb) bt
#0  0xb7e32f03 in ?? ()
*#1  0xb7bb26e1 in _talloc_free_internal (ptr=0x80612d0,
location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
../lib/talloc/talloc.c:831*
*#2  0xb7bb33f0 in _talloc_free_children_internal (tc=0x8060d88,
ptr=0x8060db8, location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
../lib/talloc/talloc.c:1256*
*#3  0xb7bb2830 in _talloc_free_internal (ptr=0x8060db8,
location=0xb7bb54c7 "../lib/talloc/talloc.c:2251") at
../lib/talloc/talloc.c:851*
*#4  0xb7bb3742 in _talloc_free (ptr=0x8060db8, location=0xb7bb54c7
"../lib/talloc/talloc.c:2251") at ../lib/talloc/talloc.c:1371*
*#5  0xb7bb4d82 in talloc_autofree () at ../lib/talloc/talloc.c:2251*
*#6  0xb7e865e8 in __cxa_finalize () from /lib/i386-linux-gnu/libc.so.6*
*#7  0xb7bb1a43 in __do_global_dtors_aux () from
/usr/local/samba/lib/private/libtalloc.so.2*
#8  0xb7ff4e52 in ?? () from /lib/ld-linux.so.2
#9  0xb7ff5947 in ?? () from /lib/ld-linux.so.2
#10 0xb7e53cc4 in ?? () from /lib/i386-linux-gnu/libdl.so.2
#11 0xb7fefde6 in ?? () from /lib/ld-linux.so.2
#12 0xb7e540bc in ?? () from /lib/i386-linux-gnu/libdl.so.2
#13 0xb7e53cfa in dlclose () from /lib/i386-linux-gnu/libdl.so.2
#14 0xb7fadf8b in ?? () from /lib/i386-linux-gnu/libpam.so.0
#15 0xb7fab8ff in ?? () from /lib/i386-linux-gnu/libpam.so.0
*#16 0xb7fa8da0 in pam_end () from /lib/i386-linux-gnu/libpam.so.0*
#17 0x08048baf in check_auth (login=0xb8bf "admin", passwd=0xb4be
"soho") at auth_pam.c:186
#18 0x08048952 in main (argc=1, argv=0xbd84) at main.c:92

*cat /etc/nsswitch.conf *

passwd: files winbind
shadow: files winbind
group:  files winbind
hosts:  files wins dns
bootparams: nisplus [NOTFOUND=return] files
ethers: files
netmasks:   files
networks:   files
protocols:  files
rpc:files
services:   files
netgroup:   nisplus
publickey:  nisplus
automount:  files nisplus
aliases:files nisplus

*cat /etc/pam.d/pwauth *
#%PAM-1.0
auth   sufficient   /lib/security/pam_smbpass.so
auth   sufficient   /lib/security/pam_winbind.so   cached_login
auth   required /lib/security/pam_winbind.so   krb5_auth
accountrequired /lib/security/pam_nologin.so
accountsufficient   /lib/security/pam_smbpass.so
accountrequired /lib/security/pam_winbind.so
password   sufficient   /lib/security/pam_smbpass.so
password   required /lib/security/pam_winbind.so
sessionrequired /lib/security/pam_unix.so

*cat /etc/samba/smb.conf*
[Global]
available= yes
client signing= auto
server signing= auto
server string= Bla
Workgroup= DISNEY
netbios name= vmstore-4
realm= DISNEY.XXTEST.ASD-ABC.LOCALDOMAIN
password server= *
idmap backend= tdb
idmap uid= 5000-999
idmap gid= 5000-999
idmap config DISNEY : backend= rid
idmap config DISNEY : range= 1000-1999
security= ADS
name resolve order= wins host bcast lmhosts
client use spnego= yes
dns proxy= no
winbind use default domain= no
winbind nested groups= yes
inherit acls= yes
winbind enum users= yes
winbind enum groups= yes
winbind separator= \\
winbind cache time= 300
winbind offline logon= true
encrypt passwords= yes
passdb backend= smbpasswd
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] Samba4 + Winbind + PAM Installation/Configuration

2013-08-19 Thread Thiago Fernandes Crepaldi
I am justs tarting o samba too, but I think it is normal to have lots of
"not found". You have to pay attention for the features you want, though.

You might need libpam0g-dev package for PAM support  (At least that is the
one for Debian) and you can also consider libacl-dev for ACL support
(changing permissions for a share on windows, for example)


On Sun, Aug 18, 2013 at 11:38 AM, Andreas Krupp wrote:

>
> Hi,
>
> I have not set any home var yet in my smb.conf.
> If you're asking for that, I am probably missing a lot of important
> parameters.
> Below my smb.conf for the moment:
>
> # Global parameters
> [global]
> workgroup = MYDOMAIN
> realm = MYDOMAIN.HOME
> netbios name = DC
> server role = active directory domain controller
> dns forwarder = 10.33.66.99
> template shell = /bin/bash
> wins support = yes
>
> [netlogon]
> path = /usr/local/samba/var/locks/sysvol/mydomain.home/scripts
> read only = No
>
> [sysvol]
> path = /usr/local/samba/var/locks/sysvol
> read only = No
>
>
> Otherwise I checked for all the lines during "./configure" that mention
> "not found"... I have more than 100 of these. Is that normal?
> Among the things missing are e.g. ldap, pam_start, NFS QUOTAS, and lots of
> other stuff... I tried to follow the list of packages to install on the
> Samba4 Wiki for CentOS but it seems, that is not really enough, is it?
>
> Cheers & best,
> Andreas
>
> *On 16 August 2013 08:37, Daniel Müller  has written: *
>
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
>



-- 
Thiago Fernandes Crepaldi (aka Crepaldi)
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba