Fix multiple issues in cache_inode_lock_trust_attrs()

1. Unify cache_inode_check_trust() and cache_inode_lock_trust_attrs()
2. Properly refresh attributes in case need_wr_lock == true
3. Check ATTR_RDATTR_ERR
4. Invalidate directory content in case of mtime change
5. Properly initialize current_time
6. Don't check attr_time when expire_type_attr == CACHE_INODE_EXPIRE_NEVER
7. Handle expire_type_attr == CACHE_INODE_EXPIRE_IMMEDIATE
8. Don't call time() when not needed

Signed-off-by: Amit Dror <amitd@infinidat.com>
In cache_inode_create(), use cache_inode_refresh_attrs() instead of manual work

Signed-off-by: Amit Dror <amitd@infinidat.com>
Change readdir FSAL cookie from variable length to uint64_t

Signed-off-by: Amit Dror <amitd@infinidat.com>
Add constness to cache_inode_readdir_cb_t name param

Signed-off-by: Amit Dror <amitd@infinidat.com>
Remove unused export pointer from nfs3_readdirplus_cb_data

Signed-off-by: Amit Dror <amitd@infinidat.com>
Use NFS3_OK instead of NFS_OK (NFSv2)

Signed-off-by: Amit Dror <amitd@infinidat.com>
Make cache_inode_remove_impl() static and simplify locking conditions

Signed-off-by: Amit Dror <amitd@infinidat.com>
Keep directory's CACHE_INODE_TRUST_CONTENT flag on where possible

Signed-off-by: Amit Dror <amitd@infinidat.com>
Remove unused fsal_cookie from cache_inode_dir_entry_t

Signed-off-by: Amit Dror <amitd@infinidat.com>
Translate ERR_FSAL_ISDIR into CACHE_INODE_IS_A_DIRECTORY code

Signed-off-by: Amit Dror <amitd@infinidat.com>
Add cache_inode_refresh_attrs_locked()

Signed-off-by: Amit Dror <amitd@infinidat.com>
Ease lock contention in cache_inode_remove()

Do not hold attr_lock and content_lock write locked for the whole operation.
Use cache_inode_access(), which takes read lock the attr_lock instead of write.
Use cache_inode_refresh_attrs() instead of doing ourselves.
Removed unreachable code (call to cih_remove_checked).
Merged cache_inode_remove_impl() into cache_inode_remove()

Signed-off-by: Amit Dror <amitd@infinidat.com>
Fixed valgrind uninitialized warnings

In case nfs3_FhandleToCache returns NULL, do not check nfsstat3,
as it is invalid (and uninitialized)

Signed-off-by: Amit Dror <amitd@infinidat.com>
Use CACHE_INODE_NOT_A_DIRECTORY status where appropriate

Signed-off-by: Amit Dror <amitd@infinidat.com>
Add cache_inode_check_sticky()

Signed-off-by: Amit Dror <amitd@infinidat.com>
Ease lock contention in cache_inode_link()

Signed-off-by: Amit Dror <amitd@infinidat.com>
Ease some more locking, use cache_inode_check_sticky()

Signed-off-by: Amit Dror <amitd@infinidat.com>
Ease lock contention in cache_inode_rename()

Use cache_inode_access() which works under attr_lock
Do not hold content_lock for src and dst dirs for the whole operation
Add sticky check for the destination
Use cache_inode_refresh_attrs_locked() for refresh

Signed-off-by: Amit Dror <amitd@infinidat.com>
Unify and add missing calls to cache_inode_put()

Signed-off-by: Amit Dror <amitd@infinidat.com>
Remove redundant assignment to cache_status in cache_inode_refresh_attrs()

Signed-off-by: Amit Dror <amitd@infinidat.com>