Doubt about ntfs code: lockmgr with LK_INTERLOCK flag
Scott Long
scottl at samsco.org
Sun Feb 26 09:06:29 PST 2006
Wei Lei wrote:
> Hi list,
>
> Nice to be here =)
>
> 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?
>
Doing a mtx_unlock() could trigger your thread to get preempted by a
higher priority thread that could then come in and modify the i_usecount
field.
Scott
More information about the freebsd-fs
mailing list