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. 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 share. So my question: how to shorten that time or 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. many thanx Sincerely Yours / Mit freundlichen Gr??en: Gerhard Zuber ---------------------------------------------------------- Dipl.-Ing. Gerhard Zuber Telefon: (030) 861 32 01 Pfalzburger Str. 25 10719 Berlin Internet: zuber@berlin.snafu.de Germany phone: +49.30.8613201 ---------------------------------------------------------- Meine Meinung ist immer die meinige. My opinions are always my own.
> >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 >share. > >So my question: > >how to shorten that timeTry turning oplocks off, to see if they are the problem. i.e. add oplocks = no to the relevent share in smb.conf>or > >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. -- Andrew Mobbs - Software Engineer Allstor Software Ltd.
> 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. > > 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 > share. > > So my question: > > how to shorten that timeHmm... the "dead time" share parameter is in minutes, so you may have trouble with this. It shouldn't be too hard to hack the code to recognise "dead time = 15s", though, and could be useful to others too...> 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.fuser -mv /cd/mount/point will tell you all the processes with open files on that filesystem. fuser -km /cd/mount/point will (I think) kill all processes accessing files on that filesystem. For your cd changer script, you may like to look at the Linux autofs automounter. I'm sure a bit of hacking should enable you to sort it out quite cleanly. Matthew. -- Matthew Kirkwood | Mail: matthew.kirkwood@lmh.ox.ac.uk LMH JCR, | Web: http://www-jcr.lmh.ox.ac.uk/~weejock/ Oxford OX2 6QA, | England. | "To do things badly is a basic human right"
many thanx to all people answering my question. the very quick solution is with fuser -km /cdrom this is very ugly, because one smbd serves all shares used by a single client. this means, if the same client has open files simultanously on another share, this get an error. eg. a compiler fails etc. dead time is in minutes and oplock = no has no effect. the problem is that smbd has its current working dir on that share USER PID ACCESS COMMAND /cdrom root 1725 ..c.. smbd the time seems to be 5 .. 10 seconds after winnt-filemanager has build the filelist. then smbd has moved his cwd to / and the mountpoint is free. maybe if one has a solution for smbd, not to cwd to the mountpoint of the share, let me know. Sincerely Yours / Mit freundlichen Gruessen: Gerhard Zuber ---------------------------------------------------------- Dipl.-Ing. Gerhard Zuber Telefon: (030) 861 32 01 Pfalzburger Str. 25 10719 Berlin Internet: zuber@berlin.snafu.de Germany phone: +49.30.8613201 ----------------------------------------------------------