cache: fix misplaced fence in cache_ncp_invalidate

The intent was to mark the entry as invalid before cache_zap starts messing
with it.

While here add some comments.
This commit is contained in:
Mateusz Guzik 2020-07-02 12:54:50 +00:00
parent 92d8df2f37
commit d129e0eba0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362888

View File

@ -147,6 +147,27 @@ struct namecache_ts {
#define NCF_HOTNEGATIVE 0x40
#define NCF_INVALID 0x80
/*
* Mark an entry as invalid.
*
* This is called before it starts getting deconstructed.
*/
static void
cache_ncp_invalidate(struct namecache *ncp)
{
KASSERT((ncp->nc_flag & NCF_INVALID) == 0,
("%s: entry %p already invalid", __func__, ncp));
ncp->nc_flag |= NCF_INVALID;
atomic_thread_fence_rel();
}
/*
* Verify validity of an entry.
*
* All places which elide locks are supposed to call this after they are
* done with reading from an entry.
*/
static bool
cache_ncp_invalid(struct namecache *ncp)
{
@ -155,16 +176,6 @@ cache_ncp_invalid(struct namecache *ncp)
return ((ncp->nc_flag & NCF_INVALID) != 0);
}
static void
cache_ncp_invalidate(struct namecache *ncp)
{
atomic_thread_fence_rel();
KASSERT((ncp->nc_flag & NCF_INVALID) == 0,
("%s: entry %p already invalid", __func__, ncp));
ncp->nc_flag |= NCF_INVALID;
}
/*
* Name caching works as follows:
*