Linux: how to discover open files from smbd ?

amobbs at amobbs at
Mon Mar 2 12:15:46 GMT 1998

>I have a CD-Changer and I want to change the cd under the share.
>this is done by a script, consisting of
>  unmounting the cdrom
>  changing the slot
>  mounting the cdrom again
>to successfully do this, there must be no open files or directories
>on the mountpoint.
Yuck! Better solutions exist (for CD jukeboxes at least), but I'll leave
mentioning them to our marketing department. :-)

>If I browse with windows-nt-filemanager on that share it seems there
>are files/dirs held open by smbd. in elder versions of smbd this
>time was very short, so one second was acceptable to wait.
>now in newer versions of smbd (maybe the new locking code) this time
>is unacceptable long, so I need to kill that smbd is sitting on that
>So my question:
>how to shorten that time
Try turning oplocks off, to see if they are the problem.
i.e. add
oplocks = no
to the relevent share in smb.conf

>how to find the smbd is helding files/dirs open and killing it. There can
>be more than one smbd running, i should kill the right one.
Since your share is a single filesystem, you can use fuser -m <filesystem>
to tell you the PIDs of processes with filehandles open in that filesystem.

If anybody else wants to do the same on other platforms, it's fuser -c
<filesystem> for Solaris (2.5.1 at least), and for AIX you have to resort
to fuser /dev/foo. Anybody with other Unices can go and read the fuser man
page for themselves :-)



Andrew Mobbs - Software Engineer

               Allstor Software Ltd.

More information about the samba mailing list