pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


Prototype wait for SRW locks before |free()|
Posted by Anonymous on Wed 28th Feb 2024 09:08
raw | new post

  1. diff --git a/daemon/open.c b/daemon/open.c
  2. index f605f1e..534d21d 100644
  3. --- a/daemon/open.c
  4. +++ b/daemon/open.c
  5. @@ -84,6 +84,21 @@ static void open_state_free(
  6.  {
  7.      struct list_entry *entry, *tmp;
  8.  
  9. +    EASSERT(state->ref_count == 0);
  10. +#ifdef NFS41_DRIVER_STABILITY_HACKS
  11. +    BOOLEAN state_lock_locked;
  12. +
  13. +    /* Check whether something is still using the lock */
  14. +    state_lock_locked = TryAcquireSRWLockExclusive(&state->lock);
  15. +    if (state_lock_locked)
  16. +        ReleaseSRWLockExclusive(&state->lock);
  17. +    if (state_lock_locked == FALSE) {
  18. +        AcquireSRWLockExclusive(&state->lock);
  19. +        ReleaseSRWLockExclusive(&state->lock);
  20. +    }
  21. +    EASSERT(state_lock_locked != FALSE);
  22. +#endif /* NFS41_DRIVER_STABILITY_HACKS */
  23. +
  24.      /* free associated lock state */
  25.      list_for_each_tmp(entry, tmp, &state->locks.list)
  26.          free(list_container(entry, nfs41_lock_state, open_entry));
  27. @@ -117,6 +132,8 @@ void nfs41_open_state_ref(
  28.          return;
  29.  #endif /* NFS41_DRIVER_STABILITY_HACKS */
  30.  
  31. +    EASSERT(state->ref_count > 0);
  32. +
  33.      const LONG count = InterlockedIncrement(&state->ref_count);
  34.  
  35.      DPRINTF(2, ("nfs41_open_state_ref('%s') count %d\n", state->path.path, count));
  36. @@ -125,6 +142,8 @@ void nfs41_open_state_ref(
  37.  void nfs41_open_state_deref(
  38.      IN nfs41_open_state *state)
  39.  {
  40. +    EASSERT(state->ref_count > 0);
  41. +
  42.      const LONG count = InterlockedDecrement(&state->ref_count);
  43.  
  44.      DPRINTF(2, ("nfs41_open_state_deref('%s') count %d\n", state->path.path, count));

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at