Add cache_inode_lru_cleanup_try_push

This routine is used to try pushing a cache inode into the cleanup
queue. If the entry ends up with another LRU reference before this
is accomplished, then don't push it to cleanup.

This will be used when unexporting an export. Any cache inode entry
that only belonged to that export is a candidate for cleanup.
However, it is possible the entry is still accessible via another
export, and an LRU reference might be gained before we can lock the
AVL tree. In that case, the entry must be left alone (thus
cache_inode_kill_entry is NOT suitable for this purpose).

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Test return from write before calling commit

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add cache_inode_unexport to clean up cache inodes associated with unexport

When an export is unexported, any cache inodes that are exclusively
associated with that export must be cleaned up since they might become
otherwise unreachable.

Any cache inode that is still associated with another export will be
left untouched (other than removing it from the list of cache inodes
associated with the export being unexported).

cache_inode_get_protected is used to get a reference to each cache inode
in the list. This guarantees that if unexport is racing with a
cache_inode_kill_entry, that we don't work on a half-killed entry.

cache_inode_lru_cleanup_try_push is used to try and push an entry to
cleanup. This protects against a race where another thread suddenly
references this inode via some other export.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove /n from some log messages

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Don't take/release LRU ref on pin/unpin

Pinning an entry protects it from reaping/recycling or any other removal
from the hash table other than by cache_inode_kill_entry. Any caller of
cache_inode_inc_pin_ref is expected to have an LRU reference on the
entry.

Cleanup of killed entries depends on the LRU refcount being drained to
zero prior to calling state_wipe_file, and the pin refcount will not
drain to zero without state_wipe_file being called. The only way to
prevent this chicken and egg problem is to not take LRU reference on
pin.

Also fix a type in cache_inode_lru_unref

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Clean up export on release of last reference.

Also, take a sentinel reference when creating an export.

remove_gsh_export will remove this sentinel reference.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
First pass of pseudo_unmount_export

Limitations:

Does not handle situation where junction cache inode is killed.

Does not remove FSAL_PSEUDO directories leading only to the export.

Does not clean out the directories in an FSAL_PSEUDO export that is
removed.

Does not handle unmount of any exports mounted on the removed export.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Provide unexport and kill_export_root_entry routines

unexport will be called by admin driven unexport.

kill_export_root_entry is called by cache inode after the last LRU
reference to a killed entry has been removed. It will clean up the
no longer viable export.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Signed-off-by: suhrud <supatank@in.ibm.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
We cannot set garray to NULL. it is dynamically allocated.
Also, we can't free it because later we may have to restore it!!

Ported from 7ef1f5db5488b8d837dd2b18595945d1b4f8f440

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Ammend runcp.sh to reflect that some GPFS files are from GPFS

These include files will not necessarily pass checkpatch.pl

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Jim Lieb <jlieb@panasas.com>
Convert fsal include files from export object to namespace object

FSALs will have an object, fsal_namespace, instead of fsal_export.

A namespace may be associated with one of more exports.

Some key requirements of a namespace:

- All handle keys within a namespace are expected to be unique.

- If a file is visible to more than one export, all of those exports
  MUST utilize the same namespace for cache inode to work properly
  should an export be removed (unexport).

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Convert FSAL directory from export object to namespace object

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Convert FSAL_VFS from export object to namespace object

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Convert FSAL_PSEUDO from export object to namespace object

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Convert FSAL_UP directory from export object to namespace object

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Convert SAL directory from export object to namespace object

Due to temporary collision, use NAMESPACE instead of namespace.
This avoids macro conversion of namespace to export which collides
with exportlist_t *export.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Jim Lieb <jlieb@panasas.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove unused fsal_export parameter from nlm_process_share_parms

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Jim Lieb <jlieb@panasas.com>
Convert Protocols/NFS directory from export object to namespace object

Due to temporary collision, use NAMESPACE instead of namespace in
Protocols/NFS/mnt_Mnt.c

This avoids macro conversion of namespace to export which collides
with exportlist_t *export.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Jim Lieb <jlieb@panasas.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Convert cache_inode directory from export object to namespace object

Also convert include/cache_inode.h

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Jim Lieb <jlieb@panasas.com>
Convert support/nfs_filehandle_mgmt.c from export object to namespace object

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Signed-off-by: Jim Lieb <jlieb@panasas.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>