CID#18499 Resource leak

Error handling could lead to a resource leak of
the struct pointed by task if allocation of mul
failed. The fix is a bit longer than the previous
version but it's more readable and avoids a
resource leak.
CID#18466 Missing break in switch

Missing break for LAYOUTRETURN4_FSID case leading
to a fallthrough to the next case.
CID#18465 Missing break in switch

Missing break for case 123 leads to a
fallthrough to the default case used
for error handling.
CID#18453 Explicit null dereferenced

son_owner_val struct member of oname wasn't
initialized before calling memcpy. Thus, leading
to a segfault.
Moreover, this section of the code is only used
if 9P support was activated at build time. oname
isn't used at all in the general case.
CID#18447 Logically dead code

Whatever the course of action, found is set
to TRUE (1) anyway. The last conditionnal
statement isn't needed. This makes the code
a little more simple.
CID#18444 Copy-paste error

Simple typo here, should be mtime instead
of atime.
Merge remote-tracking branch 'upstream/next' into next
CID#23364 Resource leak

If entry is a junction and client doesn't have access to it
then variable name is not freed upon return. Since memory
has been allocated by nfs4_utf8string2dynamic, it can't
be reclaimed has one can expect.
CID#18496 Resource leak

If getextattr_value_by_id returns an error, data isn't freed.
We have to free this buffer here since it's used and retained
later in the process (I first thought of putting it in the
out section but that would cause a segfault later).
CID#18494 Resource leak

secinfo_fh_name is allocated by nfs4_utf8string2dynamic but isn't
freed if we reuse the lookup result.
CID#18487 Resource leak

The structure pointed by myself isn't freed if
fsal_export_init returns an error code (!= 0).
Let the FSAL control the expiration interval for the inode cahce.
Avoid refcnt underrun on xprt stall.

Do not release dispatch xprt ref on stall return from
nfs_rpc_cond_stall_xprt, as it protects rechability from
the stallq itself.

The stall thread appears to do the right thing, returning
its own reference, after first re-arming EPOLL.

This change (I believe) implements the fix
proposed by Shyamsundar Ranganathan <srangana@redhat.com>,
in reporting this issue.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Cleanup killed cache entries inline.

Removes cleanup queue processing from lru_run, in favor
of inline cleanup on return of last ref.

Also, change the order of cih_remove_checked and cleanup push
operations in cache_inode_kill entry.

It also appears that the (removed) cleanup processing incorrectly
returned a cache entry reference.  This likely resulted in leaks
and use-after-free conditions.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix arguments in return_one_state from nfs4_op_close

And fix a locking bug while we're at it.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Mark defective last-segment check

Diagnostic prints always show it as false.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Merge remote-tracking branch 'linuxbox2/next' into merge_next

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Merge remote-tracking branch 'marc/dev48-expire-inode' into merge_next

Merging inode expiry based on seconds instead of nsecs for now.
We will leave the second step to a 2.1 rework of time management.

Signed-off-by: Jim Lieb <jlieb@panasas.com>
Make some cosmetic changes to readdir to make porting easier

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Restructure cache_inode_readdir callback to be made from cache_inode_getattr

For the subsequent patch to fix mounted_on_fileid, we will need to use
cache_inode_getattr from readdir, so we will utilize its callback
mechanism to make the callback to the protocol readdir handlers.

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