Client lib: fix path cache invalidation and insertion to handle concurrent i-node number changes performed by other simultaneously running QFS client. One such failure was exhibited with listing directory "a" with single directory entry "a", then performing the following sequence from another qfs client: mkdir b; mv a/a b/ ; rmdir a ; mv b a; then listing directory "a" again after 30 seconds (i-node cache invalidation interval) passes. Invalidate cached i-node number entries with path prefix if i-node number changes. Clear cached entries with the common directory prefix before inserting results of read dir plus into the i-node cache, in order to clear stale directory entries, if any, and handle possible change in the directory i-node number.
Client lib: pass copy path flag to update path invocation in update fattr method.
Chunk server: fix adding chunk directories with changed file system id, after the chunk file cleanup, by comparing file system id reported by the directory checker and assigning file system id to the chunk directory.
Merge branch 'master' into topic/krb

Conflicts:
	src/cc/libclient/KfsClient.cc
	src/cc/libclient/KfsClientInt.h
Qfs tool: fix path re-assembly from url by including "query" and "fragment" along with the respective delimiters.
Qfs test: use special symbols including glob special symbols in the qfs tool test directory name (but do not use glob symbols as the last 3 characters of the test directory suffix to prevent unwanted glob expansion.
Qfs tool: fix path re-assembly from url by including "query" and "fragment" along with the respective delimiters.
Qfs test: use special symbols including glob special symbols in the qfs tool test directory name (but do not use glob symbols as the last 3 characters of the test directory suffix to prevent unwanted glob expansion.
Merge branch 'master' into topic/krb

Conflicts:
	src/test-scripts/qfstest.sh
Client library: qfs protocol state machine: fix authentication handshake handling by setting lookup and authenticate ops sequence number to -1 in connection reset method, as the ops might not be in flight yet, and in such case cancel that sets sequence number to -1 will no be invoked. Fix re-queuing, and retry logic for ops with no owner, do not cancel these until the retries are exhausted. (It seems that at the moment only sort master’s running status file delete code issues ops with no owner.)
Merge branch 'topic/krb' into topic/cs_threads
Client library: fix deadlock introduced by the change of using protocol worker thread to execute meta server RPCs. With this change it is no longer possible to use the same global client instance mutex with asynchronous read request completion handler, as the meta server RPCs executed without releasing this mutex, and therefore resulting in deadlock with multiple parallel threads once waiting for read completion, and the other waiting for the meta server RPC completion. To avoid deadlock create new dedicated read request completion mutex, ensure that global and read request completion mutexes acquisition order is always the same in all code paths.
Client lib: QFS protocol state machine: fix recursion handling with authentication handshake: only start authentication handshake if look up RPC sequence remains the same after re-queuing other ops. Remove early return from connection reset method to ensure correct state reset in the cases.
Client library: write append state machine: with the server pool, update the key of the dedicated chunk server here. This is needed to make the first / initial round of append status recovery work, as the first round uses this key, before attempting to get the chunk server access tokens/keys from the meta server.
Client library: fix recursion handling with QFS protocol state machine's EnsureConnected() method. Fix space reservation with write appender when using server (connection) pool, by detecting disconnects, and setting reserved space to 0 in such case, as the chunk server automatically releases all client allocated space in the event of disconnect (the write id remains valid though). Implement lease acquire variant for append recovery to allow the client to specify the chunk server list that it needs to talk to in order to recover append status. This is required in order to deal with append status recovery after chunk deletion, where the meta server has no knowledge of the servers participated in the append synchronous replication, and to handle the cases where the hosting servers have changed due to chunk re-replication. The chunk servers keep the append state around after chunk deletion to allow the client to recover the status.
Kfsio library: define "append recovery" chunk access flag with chunk access token.
Chunk server: handle append recovery access with only append recovery flag set, by allowing by allowing append recovery RPC to proceed (with no write access flag set).
Meta server: implement append recovery access special handling with the lease acquire. Grant chunk server and chunk access in the case when chunk does not exist, but chunk id is not greater than the last allocated chunk id, and no chunk allocation with the requested chunk id are in flight, to prevent the client from acquiring append recovery access to chunks that are about to be created or might be created in the future. Grant special "append status recovery" access, even if according to the meta server state the chunk isn't hosted on a requested chunk server in order to allow the append client to perform recovery by accessing the append status information that the chunk servers participated in the synchronous append replication, keep for the pre-defined period of time past chunk deletion.
Meta server: cleanup trailing white space.
Kfsio library: define net manager dispatcher interface in order to allow to invoke dispatcher methods at the pre-defined place in the net manager's event dispatch loop. At the moment the interface has a single method DispatchStart() invoked immediately after the event dispatch mutex (if one is used) is re-acquired. The interface is intended to be used in the cases where the invocation order matters and therefore ITimeout interface cannot be used.
Meta server: fix checkpoint write race that can result in processing an extra rpc(s) by "client" threads, from under DoFork() / PrepareCurrentThreadToFork() invocation. Use net manager's dispatcher interface, instead of ITimeout, to resolve (theoretical) ambiguity with prepare to fork in the main thread. Invoke prepare to fork method immediately after acquiring dispatch mutex in the main and the client threads, as the prepare to fork method can release and re-acquire the mutex while waiting on conditional variable. Handle theoretically possible sporadic wakeups on fork done conditional variable by maintaining fork counter and keep invoking wait until the counter changes. Implement checkpoint write correctness check by ensuring that the meta data mutation count remains 0 before starting checkpoint write, do not write checkpoint otherwise. Panic the parent if the mutation count isn't 0 immediately after forking the child process with DoFork().
The race appears to be rare. The workaround is to use prior checkpoint by hard linking it to the "latest", in the case if log replay fails. If the prior checkpoint isn't available, then it should be possible to recover by removing extraneous offending entry in the transaction log pointed by the checkpoint, along the transaction log segment checksum lines, or updating the log segment checksum after editing.
Meta server: order chunk servers vector by server location and use binary search to find chunk server by location, and by host. Remove now redundant chunk server map. Make set location method protected, as it only used by layout emulator. Use boost bind with rack id binary search, instead of custom functor.
Meta server: convert const_iterator to iterator to make erase() compile with gcc.
Meta server: fix possible invalid end iterator de-reference in AddNewServer() method. Replace matching server class with boost bind. Pass server location by reference in find server by host method.
Meta server: fix chunk id check with append status recovery read lease, use getseed() instead of id(), as seed is used to generate the chunk id.
Meta server: return EAGAIN if no servers available for append recovery, in order to make the append client retry.