Hi, I'm developing a Windows backup application that needs to be able to create possibly hundreds of thousands of hard links on an SMB share. I'm running into a strange problem when that share happens to be on a Samba server. When the application tries to create the 10000th hard link, the win32 CreateHardLink() function returns error code 5 "Access is denied". The Samba log shows: [2009/03/03 01:29:08, 0] smbd/files.c:file_new(79) ERROR! Out of file structures Some googling suggested that the "out of file structures" error occurs when Samba exceeds its max open files limit. Sure enough, if I change "max open files" in smb.conf, the number of successful calls to CreateHardLink() before the error occurs changes accordingly. Configurations I've tried this on: QNAP NAS device running Linux 2.6.12 (ARM) and Samba 3.0.23d Ubuntu Server 8.10 running Linux 2.6.27 (i686) and Samba 3.2.3. Both of these with Windows Vista as client. Several of our customers have reported this bug with different versions of Linux/Samba on the server and different versions of Windows on the client, so it seems to be a widespread problem. Has anyone encountered this problem before? I'm not sure whether it is a bug in Samba or Windows? I'm new to this list. Is this the right place to report this or would it be better to submit a Bugzilla report? Any idea what I can do to work around it, other than setting "max open files" to a ridiculously high value? Thanks David
On Tue, Mar 03, 2009 at 06:13:42PM +1100, David Overton wrote:> I'm developing a Windows backup application that needs to be able to > create possibly hundreds of thousands of hard links on an SMB share. > I'm running into a strange problem when that share happens to be on a > Samba server. When the application tries to create the 10000th hard > link, the win32 CreateHardLink() function returns error code 5 "Access > is denied". The Samba log shows: > > [2009/03/03 01:29:08, 0] smbd/files.c:file_new(79) > ERROR! Out of file structuresCan you send a sniff of what your application is doing? We *might* have a fd leak somewhere. But apart from that -- you do close your files after you've used them? Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20090303/e96cf148/attachment.bin
On Tue, Mar 03, 2009 at 06:13:42PM +1100, David Overton wrote:> Hi, > > I'm developing a Windows backup application that needs to be able to > create possibly hundreds of thousands of hard links on an SMB share. > I'm running into a strange problem when that share happens to be on a > Samba server. When the application tries to create the 10000th hard > link, the win32 CreateHardLink() function returns error code 5 "Access > is denied". The Samba log shows: > > [2009/03/03 01:29:08, 0] smbd/files.c:file_new(79) > ERROR! Out of file structures > > Some googling suggested that the "out of file structures" error occurs > when Samba exceeds its max open files limit. Sure enough, if I change > "max open files" in smb.conf, the number of successful calls to > CreateHardLink() before the error occurs changes accordingly. > > Configurations I've tried this on: > QNAP NAS device running Linux 2.6.12 (ARM) and Samba 3.0.23d > Ubuntu Server 8.10 running Linux 2.6.27 (i686) and Samba 3.2.3. > Both of these with Windows Vista as client. > > Several of our customers have reported this bug with different > versions of Linux/Samba on the server and different versions of > Windows on the client, so it seems to be a widespread problem. > > Has anyone encountered this problem before? I'm not sure whether it > is a bug in Samba or Windows? > I'm new to this list. Is this the right place to report this or would > it be better to submit a Bugzilla report? > Any idea what I can do to work around it, other than setting "max open > files" to a ridiculously high value?Can you open a bug and attach a debug level 10 log and also a wireshark capture trace of this against the Samba share ? Thanks, Jeremy.
Hi Volker, 2009/3/4 Volker Lendecke <Volker.Lendecke@sernet.de>:> On Tue, Mar 03, 2009 at 11:21:46PM +1100, David Overton wrote: >> 2009/3/3 Volker Lendecke <Volker.Lendecke@sernet.de>: >> > On Tue, Mar 03, 2009 at 06:13:42PM +1100, David Overton wrote: >> >> I'm developing a Windows backup application that needs to be able to >> >> create possibly hundreds of thousands of hard links on an SMB share. >> >> I'm running into a strange problem when that share happens to be on a >> >> Samba server. ?When the application tries to create the 10000th hard >> >> link, the win32 CreateHardLink() function returns error code 5 "Access >> >> is denied". ?The Samba log shows: >> >> >> >> [2009/03/03 01:29:08, ?0] smbd/files.c:file_new(79) >> >> ? ERROR! Out of file structures >> > >> > Can you send a sniff of what your application is doing? We >> > *might* have a fd leak somewhere. But apart from that -- you >> > do close your files after you've used them? >> >> Attached is gzipped output of running tshark as suggested at >> http://wiki.samba.org/index.php/Capture_Packets. ?If you need more >> information let me know. > > Thanks, that is what I need. It might take a few days, but > those 20MB in my inbox will definitely remind me of a TODO > for me :-)I've had a look at the sniff myself and it pointed me to a bug in my code. It was using FindFirstFile to obtain some metadata about each file before calling CreateHardLink, but it wasn't calling FindClose. I'm guessing that this was causing Samba to leave file descriptors open. Sorry for wasting your time on this. Thanks for your help. David