oddness in 10,3 .. mnt_ref leak?

Julian Elischer julian at freebsd.org
Fri Oct 14 10:23:05 UTC 2016

I'm runnign 10.3 in our appliance and by chance I added code to print 
out the mnt-ref values of struct mount as htey are being changed..

to my surprise that reference count seems to be wildly wrong..

I added the following code to be run when it is decremented:

#define MNT_REL(mp)     do {                                            \
         if ((mp)->mnt_ref > 0) {                                        \
(mp)->mnt_ref--;                                        \
         } else {                                                        \
                 printf("### %s (%s) negative mnt_ref, %d\n", __func__ 
,mp->mnt_stat.f_mntonname, mp->mnt_ref);  \
                 (mp->mnt_ref = 0);                                      \
} \
         if ((mp)->mnt_ref == 0)                                         \
wakeup((mp));                                           \
} while (0)

and I see this every few seconds:

### vfs_unbusy (/opt/pixel8/master_config) negative mnt_ref, 0

is there a chance that vfs_unbusy has no balancing MNT_REF when the 
file system becomes active again?

I've looked through our patches (we do have some)  but don't see a 
reason for this in them.


More information about the freebsd-fs mailing list