Bug 94733 - [smbfs] smbfs may cause double unlock
Summary: [smbfs] smbfs may cause double unlock
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 7.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-20 13:40 UTC by SANETO Takanori
Modified: 2018-01-03 05:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SANETO Takanori 2006-03-20 13:40:15 UTC
during boot up, when mounting smbfs, following warning is displayed:

lockmgr: thread 0xc1e56bd0 unlocking unheld lock
KDB: stack backtrace:
lockmgr(c2028d88,6,c2028dac,c1e56bd0,cc81a9fc) at lockmgr+0x6d9
smb_co_unlock(c2028d80,0,c1e56bd0,cc81aa1c,c2014290) at smb_co_unlock+0x2c
smb_sm_init(cc81aa1c,c0493958,c1f1542c,c2026d62,c1f15400) at smb_sm_init+0x41
nsmb_dev_load(c1f15400,0,0,102,c05f7d1e) at nsmb_dev_load+0x25
module_register_init(c2028150,c05f7d1e,cc81aac0,cc81aac4,0) at module_register_init+0x73
linker_load_module(0,c1e54c00,0,0,cc81ac70) at linker_load_module+0x713
kldload(c1e56bd0,cc81ad04,4,1,cc81ad38) at kldload+0x195
syscall(3b,3b,3b,28050a1a,bfbfea20) at syscall+0x23b
Xint0x80_syscall() at Xint0x80_syscall+0x1f
--- syscall (304, FreeBSD ELF32, kldload), eip = 0x280d1843, esp = 0xbfbfe89c, ebp = 0xbfbfee68 ---

Fix: 

I found that in smbfs_node.c, there is a path where smbfs_hash_unlock() is called twice.
Following patch may avoid such situation.

--- smbfs_node.c        17 Jan 2006 17:29:02 -0000      1.30
+++ smbfs_node.c        18 Mar 2006 23:38:47 -0000
@@ -222,12 +222,13 @@
                    (vp->v_type == VREG && (np->n_dosattr & SMB_FA_DIR) != 0)) {
                        vgone(vp);
                        vput(vp);
-                       break;
+                       goto unlocked;
                }
                *vpp = vp;
                return 0;
        }
        smbfs_hash_unlock(smp, td);
+unlocked:
        /*
         * If we don't have node attributes, then it is an explicit lookup
         * for an existing vnode.
How-To-Repeat: While booting up, I got two warnings. While shutting down, I got one.
I have one smbfs entry in fstab.
Comment 1 SANETO Takanori 2006-03-21 11:03:31 UTC
Although the patch I submitted should be of some use, the problem it
fixes seems not related to lockmgr warning I (and other guy) encountered.

Title should be changed to something like: smbfs may cause double unlock
and severity should be changed to "not serious" because it is fairly
rare case, I think.

Regards,

SANETO Takanori
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2009-05-18 05:21:28 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:23 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped