DELEGRETURN does not have an open/lock owner, don't call Copy_nfs4_state_req

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Hold state_lock in write for nfs4_return_one_state and state_lookup_layout_state

nfs4_return_one_state does a glist_length which requires the state lock,
since most callers hold the lock, change so all callers hold the lock.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Eliminate separate deleg_data structue

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Simplify delegrecall_context and delegrecall_one

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Free state_layout_recall_file list resources

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix a few places where an extra cache inode LRU reference was taken

cache_inode_create, cache_inode_lookup, and cache_inode_lookupp both return a
reference to the resulting entry, and that reference can be handed off to
data->current_entry.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Attach state_t to export uniformly inside state_add_impl

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix missing unlock in pseudo_mount_export

If cache_inode_inc_pin_ref fails, we must unlock the attr_lock taken above.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Replace FSAL_ESTALE, KILLED, and DEAD_ENTRY CACHE_INODE and STATE errors with ESTALE

These three errors all mean the same thing, so just use CACHE_INODE_ESTALE
and STATE_ESTALE.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Introduce return value to cache_inode_lru_ref to prevent new refs to stale entry

If a cache inode is stale (dead), we should prevent handing out additional
references where possible.

We add a new flag, LRU_REQ_STALE_OK, for those cases for which we need to take
a reference anyway. Also, this flag is temporarily used for cases where dealing
with the failure to get a reference is not easy. These cases WILL be fixed in
later patches (but use of this flag allows us to introduce the feature without
making things any worse). There will be at least one place where this flag will
still be useful.

When LRU_REQ_INITIAL is set, we always allow taking the reference since this
flag is only uses when the cache inode is initially found via the hash table
and thus should be valid (or at least was valid a moment ago).

If LRU_REQ_STALE_OK or LRU_REQ_INITIAL flags are used, the only possible
return is CACHE_INODE_SUCCESS thus it is legitimate to ignore the return
value.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Move dead entry cleanup to any unref as long as LRU_UNREF_QLOCKED is not set.

Make sure we only perform the cleanup once.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Convert export->state to atomic

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add param to getrattr callback to better handle junction processing callbacks

Instead of relying on special parameter values and flags to determine what
the getattr callback is expected to accomplish, make it explicit with a
parameter.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
MORE Convert export->state to atomic

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
MORE Move dead entry cleanup to any unref as long as LRU_UNREF_QLOCKED is not set.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Introduce return value to get_gsh_export_ref to prevent new refs to stale export

If an export is stale (being unexported for any reason), we should prevent
handing out additional references where possible.

We add a new parameter for those cases for which we need to take a reference
anyway. Also, this paremeter is temporarily used for cases where dealing with
the failure to get a reference is not easy. These cases WILL be fixed in later
patches (but use of this parameter allows us to introduce the feature without
making things any worse). There will be at least one place where this parameter
will still be useful.

If export_release_ok is true, the only possible return is true (success) thus
it is legitimate to ignore the return value.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Minor code pretty up

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Move export cleanup to unexport and kill_export_root_entry

Cleanup of an export will now be handled inline with unexport or
kill_export_root_entry. This avoids deadlocks and allows the cache inodes
and state objects being cleaned up to hold export refcounts.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add documentation to abstract_atomic.h

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Convert sle_ref_count to atomic int32_t

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>