Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Feb 2006 22:25:46 +0800
From:      "Wei Lei" <weilei84@gmail.com>
To:        freebsd-fs@freebsd.org
Cc:        Manish Rai Jain <manishrjain@gmail.com>
Subject:   Doubt about ntfs code: lockmgr with LK_INTERLOCK flag
Message-ID:  <36fee7420602250625h7271d694i7bfc9e69eda8ade7@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi list,

Nice to be here =3D)

I am new here so just hope my first post doesn't mismatch the topic.

I have a doubt when understanding the ntfs code with freebsd 5.4:
ntfs_subr.c, function ntfs_ntget().
I understand that lockmgr() here is trying to get an exclusive lock and
release the mutex ip->i_interlock,
so that the protection can expand from use_count to the whole ntnode.

But what's the significance of having such a mechanism? What could possibly
happen if I do a
mtx_unlock first then acquire the exclusive lock?

This is the code in ntfs_subr.c

352 int
353 ntfs_ntget(ip)
354         struct ntnode *ip;
355 {
356         dprintf((*"ntfs_ntget: get ntnode %d: %p, usecount: %d\n"*,
357                 ip->i_number, ip, ip->i_usecount));
358
359         mtx_lock(&ip->i_interlock);
360         ip->i_usecount++;
361         lockmgr(&ip->i_lock, LK_EXCLUSIVE | LK_INTERLOCK,
&ip->i_interlock,
362             NULL);
363
364         return 0;
365 }

Regards,
Wei Lei



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36fee7420602250625h7271d694i7bfc9e69eda8ade7>