Another showstopper in 2.2.5

jra at dp.samba.org jra at dp.samba.org
Mon Aug 12 11:46:01 GMT 2002


On Mon, Aug 12, 2002 at 03:19:49PM +0200, Fredrik Ohrn wrote:
> 
> 
> Ok, here's another showstopper I have started to get alot over the last 
> week.
> 
> Average user complains that that he can't open Word/Excel/PowerPoint 
> document foo because it is already opened by another (unknown) user.
> But he had no problems working with the document some time ago.
> 
> This happens a lot with Win98 clients and sometimes with WinXP but it's 
> not as common.
> 
> 
> After some digging I have figured out that the samba process serving the 
> document the first time is dead BUT according to smbstatus samba still 
> thinks the process is alive and the file locked...
> 
> 
> A small example:
> 
> [root at olivia ~]# /usr/local/samba/bin/smbstatus | grep lottab
> lottab       lottab   stdvgl    6887   studv-5-118 (129.16.xxx.xxx) Mon Aug 12 08:31:16 2002
> 6490   DENY_WRITE 0x1         RDONLY     NONE             /olivia/home3/stdvgl/lottab/netscape/rpclsvc_se.dll   Mon Aug 12 08:16:33 2002
> 6490   DENY_NONE  0x3         RDWR       NONE             /olivia/home3/stdvgl/lottab/eudora/EudPriv/Ads/Eudora.idx   Mon Aug 12 08:16:38 2002
> <... lots more nixed ...>
> 
> Lets look for pid 6490
> 
> [root at olivia ~]# ps -ef | grep 6490
> root      7240  7150  0 08:40 pts/4    00:00:00 grep 6490
> 
> Not found! Lets look for the username instead:
> 
> [root at olivia ~]# ps -ef | grep lottab
> lottab    6887 18504  0 08:31 ?        00:00:00 /usr/local/samba/bin/smbd -D
> 
> Look mom! A new smbd process is now serving this user.
> 
> 
> There is no trace what so ever in the logfile on why the smbd died.

There is code in locking/locking.c:get_share_modes() to test if a pid
associated with a share entry still exists. If it does not then the entry
is deleted and not returned.

See this code (around line 482) :

                /*
                 * Ensure that each entry has a real process attached.
                 */

                for (i = 0; i < num_share_modes; ) {
                        share_mode_entry *entry_p = &shares[i];
                        if (process_exists(entry_p->pid)) {
                                DEBUG(10,("get_share_modes: %s\n", share_mode_str(i, entry_p) ));
                                i++;
                        } else {
                                DEBUG(10,("get_share_modes: deleted %s\n", share_mode_str(i, entry_p) ));
                                memcpy( &shares[i], &shares[i+1],
                                        sizeof(share_mode_entry) * (num_share_modes - i - 1));
                                num_share_modes--;
                                del_count++;
                        }
                }


Can you instrument this code for a lower debug level s o you can see
why you are getting share mode entries returned for processes that
no longer exist.

Cheers,

	Jeremy.



More information about the samba-technical mailing list