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.
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>
Return cache_entry refs in dirent populate callback.

The dirent populate callback routine leaked cache entry
references, which are returned indirectly from
cache_inode_new_entry.

The desired behavior is to return each reference immediately.
The LRU mechanism and policies will take care of its lifetime
in the entry cache.

For improved readability, rename the callback from "populate"
to "populate_dirent."  Simplify error handling, just return
false at the error point, since the error label did no work.
Use STYLE(9) return.

Thanks to Dominique Martinet <dominique.martinet@cea.fr> for
finding and reporting this.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Avoid overrunning buffer strcaller if getpeername fails.

Typo.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Initialize grp_tail proc_export (werror).

The surrounding code must assure that grp_tail actually
has a value in all cases, I've not attempted to verify
this.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Assign RES_READDIR3_OK invariantly (werror).

GCC decided that RES_READDIR3 might be used uninitialized.
Just do so in the prologue.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Break out cast pointing into sockaddr_in6.s6_addr (strict aliasing).

It is not clear to me that the flagged code was incorrect, or that
it presented a real aliasing problem, but gcc 4.7.2 seems to think
so, perhaps due to the nested casts.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Break out cast pointing into sockaddr_in6.s6_addr (strict aliasing).

It is not clear to me that the flagged code was incorrect, or that
it presented a real aliasing problem, but gcc 4.7.2 seems to think
so, perhaps due to the nested casts.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>