I've been investigating the frequent occurrence of the following error messages: [2005/12/14 17:52:53, 5] tdb/tdbutil.c:tdb_log(725) tdb(/var/cache/samba/gencache.tdb): tdb_brlock failed (fd=3) at offset 244 rw_type=0 lck_type=14 [2005/12/14 17:52:53, 5] tdb/tdbutil.c:tdb_log(725) tdb(/var/cache/samba/gencache.tdb): tdb_brlock failed (fd=3) at offset 244 rw_type=0 lck_type=14: Bad file descriptor [2005/12/14 17:52:53, 0] tdb/tdbutil.c:tdb_log(725) tdb(/var/cache/samba/gencache.tdb): tdb_lock failed on list 19 ltype=0 (Bad file descriptor) I eventually discovered that it is caused by close_our_files() closing the fd for gencache.tdb in the tdb structure (usually fd 3). An "lsof" of any mount.smbfs process will show only fds 0, 1 and 2 open, even though tdb->fd contains 3. close_our_files() needs to avoid the inherited fd for gencache.tdb as it does for client_fd.
From IRC discussion: original thread on samba-technical: http://lists.samba.org/archive/samba-technical/2006-January/044654.html .... <coffeedude> option #2 sounds best to me. gencache.tdb is a generic string based cache which we frequently use for name caching. But you are talking about smbmount and not smbclient. Different programs. If you post attach a patch to the bug report with enough etails to verify the fix (besides just reading code), i'll get it into the tree.
Created attachment 1657 [details] Proposed patch to fix the problem This patch adds a call to namecache_shutdown() within the condition that calls close_our_files(), so that the name cache gets closed properly before close_our_files() steals its file descriptor. Tested on 3.0.7 on Fedora Core 1, but such a trivial change should apply easily to any version.
Hmmm, it looks like there's a problem if the remote server closes the connection due to no activity. When smbclient gets the 104 error (ECONNRESET) and retries, mount.smbfs dies. I'll do some more testing.
(In reply to comment #3) > Hmmm, it looks like there's a problem if the remote server closes the > connection due to no activity. When smbclient gets the 104 error (ECONNRESET) > and retries, mount.smbfs dies. > I'll do some more testing. I meant smbmount of course. I keep doing that :-(
Created attachment 1660 [details] Revised patch for client/smbmount.c and lib/gencache.c Found the problem: gencache_shutdown() was not clearing out the static pointer "cache". This meant that when gencache_init() was subsequently called, it thought the cache file was already set up and returned without opening it again. The attempt to access the actual cache then caused smbmount to crash. This revised patch adds a correction to gencache_shutdown() to set cache to NULL before returning.
Looks good to me. Applying for 3.0.21b (and to all branches). Thanks for being patient and for the patch.
can you please give me the download link for the patch. i'm using Linux 2.4.21-51.EL and also where to apply?
can you please give me the download link for the patch. i'm using Linux 2.4.21-51.EL and also where to apply? error Jan 4 14:22:39 greenapple mount.smbfs[17262]: tdb(/var/cache/samba/gencache.tdb): tdb_lock failed on list 115 ltype=1 (Bad file descriptor) Jan 4 14:22:39 greenapple mount.smbfs[17262]: [2008/01/04 14:22:39, 0] tdb/tdbutil.c:tdb_log(725) Jan 4 14:22:39 greenapple mount.smbfs[17262]: tdb(/var/cache/samba/gencache.tdb): tdb_lock failed on list 115 ltype=1 (Bad file descriptor) Jan 4 14:22:39 greenapple kernel: smb_retry: successful, new pid=17262, generation=4