store: Add (un)locking functionality

Some configuration/cache files (like the NFS rmtab) can be stored on
a GlusterFS volume and be used by multiple storage servers. This
requires suitable locking for the gf_store_handle_t structure. Introduce
gf_store_lock() and gf_store_unlock() for this purpose. The
gf_store_locked_local() function can be used to check if the
gf_store_handle_t has been locked by the current process.

This change also includes an unrelated correction where a FILE* was
getting leaked. Krishnan Parthasarathi identified this while reviewing
the new locking functionality.

Change-Id: I431b7510801841d4bad64480b4bb99d87e2ad347
BUG: 904065
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/4677
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>