Daniel Gryniewicz has uploaded this change for review.

View Change

MDCACHE - Close more export/unexport races

When cleaning up the expmap, once it's empty, we try to push the entry
to the CLEANUP queue. However, if something (say lru_run_lane()) takes
a ref, then we won't push to the CLEANUP queue, and also won't clear
first_export_id, leaving it set to the last (and now removed) export.
This will cause lru_run_lane() to eventually assert when it gets to that
entry.

To close this, unconditionally set first_export_id to -1, indicating
that the entry is unmapped, and check the first_export_id before
getting a ref in lru_run_lane(), so that we can skip the entry without
taking a ref, as putting the ref requires an export.

The second race is that we call init_export_root() before we call
insert_gsh_export(); this means that the root entry, with it's mapped
export, is visible to lru_run_lane() before the export can be looked up.
To close this race, skip entries with no export, rather than asserting.

Change-Id: Iac8dead8864872065a7bad8aeb9f719b865d4636
Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
---
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_export.c
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_lru.c
2 files changed, 28 insertions(+), 22 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/68/419268/1

To view, visit change 419268. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac8dead8864872065a7bad8aeb9f719b865d4636
Gerrit-Change-Number: 419268
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Gryniewicz <dang@redhat.com>