主权项 |
1. A method, comprising:
implementing, by a cluster file system operating on a processing device, a lock scheme for a cache manager associated with an inode of the cluster file system, wherein the lock scheme comprises lock modes of a null lock (NL) that is used to store a reference count for a lock value block (LVB) and an exclusive (EX) lock that is used for setting up inode event notifications, the inode event notifications sent by the cluster file system when events occur corresponding to locks of inodes of target files of the cluster file system, the inode event notifications sent to applications holding notification locks for the target files; associating, by the cluster file system, a first global counter and a second global counter with the cache manager for the inode, wherein the first global counter is to track one or more processes that have the inode open in read-only mode and the second global counter is to track processes that have the inode open in read-write mode; and obtaining an EX lock mode on the cache manager of the inode in order to initialize a watch for an event on the inode, wherein obtaining the EX lock mode causes any open calls on the inode by other nodes in the cluster file system to be blocked, their associated locks demoted to the NL lock mode, and at least one of the first or second global counters to be updated accordingly; wherein any other nodes in the cluster file system with a lock demoted to the NL lock mode are to: at least one of increment the first global counter when the inode is open in read-only mode at that node or increment the second global counter when the inode is open in read-write mode at that node; and re-queue a request for a higher lock mode for the cache manager of the inode by the node upon the demotion of its cache manager to the NL lock mode. |