glusterfs: add gf_mkostemp api and use it instead of mkostemp of libc

Change-Id: Ia3d2f37ae1f7a7d87a75c82bedb4963729d45b6c
BUG: 764890
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/5004
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
libglusterfs/statedump: move options file and statedumps from /tmp

Change-Id: I6b107b9a668b0521b955dba8895cbbeaf9e7cb02
BUG: 764890
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/5005
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/dht: Create linkfile with file uid/gid

Currently, linkfile creation happens as root.

use uid/gid returned from _cbk (link/rename) to set the correct ownership of
the link files.

Change-Id: I5345cff193d5095442ca446fbe5ea05f2c2d86a3
Signed-off-by: shishir gowda <sgowda@redhat.com>
BUG: 884597
Reviewed-on: http://review.gluster.org/5024
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cluster/dht: Linkfiles creation with correct uid/gid

If renames are done with different uid/gid (non-owners), then we would
end up with incorrect uid/gid.

The fix is to create linkfiles, and heal the uid/gid as root:root. This
preserves our notion of creation as root:root and heal the uid/gid as
root:root in all paths. Additionally, we need to consider uid/gid from
only src_cached subvol, and not from linkfiles.

rename is also done as root:root if done on linkfile, as setattr of ownership
on linkfile is done after the rename

BUG: 884597
Change-Id: Ifaacd8dba0f39cb909761ffc8fe7e06cd44ec8de
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/5025
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>