Patent ID: 8156164
Filing Date: 2012-04-10
Classification: G06F

Abstract:
1. A method for avoiding directory conflicts across a file system having multiple nodes, comprising: assigning, for each directory in a file system having multiple directories and multiple nodes each accessing each of the multiple directories in parallel and at least one node of said multiple nodes representing a token manager node, at least one node of said multiple nodes to act as a metanode responsible for collecting updates to said directory and for writing updates to directory blocks on disk; obtaining, by a particular node of said multiple nodes, a name-based lock on a filename within a particular directory that is the target of an operation by said particular node, wherein other nodes of said multiple nodes concurrently perform operations on other files within said particular directory, wherein said name-based lock is represented by a byte-range lock for a range of selected bytes of said particular directory determined from a computed hash value of said filename within a total range of bytes for said particular directory; querying, by said particular node, said token manager for a name-based lock token for said range of selected bytes acquired under said name-based lock; if a new name-based lock token is obtained from said token manager, sending a Remote Procedure Call (RPC) to said metanode to obtain matching directory entries, and caching, by said particular node, the result of said RPC so that subsequent operations on said filename can be satisfied without additional messages sent to said metanode, wherein said cached result is valid while said particular node holds said name-based lock token for said filename; updating, by said particular node, a cached directory block in memory by either creating a new directory entry in said directory block or deleting an existing directory entry from said directory block; sending, by said particular node, a new RPC to said metanode to reserve space in said directory block; responsive to said particular node receiving a result of said RPC from said metanode with said reserved space, allocating and initializing a new file system object and inserting into said directory block said filename and a reference which points to said allocated new file system object; and responsive to said metanode detecting there is insufficient space left to reserve in said directory block, said metanode acquiring a name-based range lock for a range of filenames that covers all filenames that might be found in said directory block, revoking all name-based lock tokens corresponding to said filenames that have been previously requested from said token manager by said multiple nodes, triggering said nodes with pending updates to said directory block to send said updates to said metanode, and responsive to said metanode receiving said updates, allocating a new directory block and extending the directory block to make room for more entries by moving a selection of directory entries in the directory block to the new directory block.