# US 2013/0159250 A1 · Method, Apparatus and Computer Program Product For Maintaining File System Client Directory Caches With Parallel Directory Writes

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2013/0159250 A1
- Document ID: US20130159250A1
- Status: Published application
- Kind: A1
- Application number: 13/684,875
- Filed: 2012-11-26
- Published: 2013-06-20
- Earliest claimed: 2009-01-08
- Assignees: International Business Machines Corporation
- Inventors: Scott T. Marcotte
- Web page: https://patentgrep.com/patent/US20130159250A1

## CPC

- G06F 16/178: Techniques for file synchronisation in file systems
- G06F 3/0619: {in relation to data integrity, e.g. data losses, bit errors}
- G06F 3/065: {Replication mechanisms}
- G06F 3/067: {Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A cached version of a file system directory is synchronized with a server version of the directory in a distributed file system. Both a server and a client specify version numbers for their directory versions. On receiving a request from the client specifying a directory update, the server updates its version, increments its version number, and transmits a reply to the client containing a change log with the incremented version number. Upon receiving the reply, the client compares the received version number with that of its cached version. If the version number matches that of the next expected update, the client applies the updates to its cached version and increments its version number. Otherwise, it adds the received change log to a change log queue for the directory without incrementing the last applied version. Mechanisms are provided for handling parallel read and update requests without awaiting replies from the server.

## Claims

### Claim 1

In a distributed file system in which a server system stores a server version of a file system directory, a method for synchronizing a client system with the server version of the file system directory, comprising:
storing a cached client version of the file system directory, the client version reflecting updates to the server version of the file system directory that have been replicated on the client system, wherein the cached client version of the file system directory maintains an updaters count of pending requests from the client system to the server system to update the file system directory;
incrementing the updaters count upon initiating an update request to the server system;
decrementing the updaters count upon processing a reply to the update request from the server system;
wherein the cached client version of the file system directory maintains a read waiters flag indicating that one or more tasks are waiting to read the file system directory after decrementing the updaters count, the method further comprising:
determining from the decremented updaters count and the read waiters flag whether the updaters count has been decremented to zero and one or more tasks are waiting to read the file system directory; and
if the updaters count has been decremented to zero and one or more tasks are waiting to read the file system directory, resetting the read waiters flag and waking up all such waiting tasks.

### Claim 2 (depends on 1)

A computer program product stored on a tangible computer-usable medium, comprising a computer-readable program for causing a computer to perform the method steps of claim 1 when the program is run on the computer.

### Claim 3 (depends on 1)

A system comprising a processor configured to perform the method steps of claim 1.

### Claim 4

In a distributed file system in which a server system stores a server version of a file system directory, a method for synchronizing a client system with the server version of the file system directory, comprising:
storing a cached client version of the file system directory, the client version reflecting updates to the server version of the file system directory that have been replicated on the client system, wherein the cached client version of the file system directory maintains an updaters count of pending requests from the client system to the server system to update the file system directory;
incrementing the updaters count upon initiating an update request to the server system;
decrementing the updaters count upon processing a reply to the update request from the server system;
wherein the cached client version of the file system directory has a lock associated therewith, the method further comprising:
acquiring the lock before incrementing the updaters count;
releasing the lock while awaiting a reply from the server system;
reacquiring the lock upon receiving the reply from the server system; and
re-releasing the lock upon processing the reply from the server system and decrementing the updaters count.

### Claim 5 (depends on 4)

A computer program product stored on a tangible computer-usable medium, comprising a computer-readable program for causing a computer to perform the method steps of claim 4 when the program is run on the computer.

### Claim 6 (depends on 4)

A system comprising a processor configured to perform the method steps of claim 4.

### Claim 7

In a distributed file system in which a server system stores a server version of a file system directory, a method for synchronizing a client system with the server version of the file system directory, comprising: storing a cached client version of the file system directory, the client version reflecting updates to the server version of the file system directory that have been replicated on the client system;
wherein the cached client version of the file system directory stored by the client system maintains a readers count of tasks reading the file system directory, a read waiters flag indicating that one or more tasks are waiting to read the file system directory, and an update waiters flag indicating that one or more tasks are waiting to read the file system directory, the method further comprising:
upon initiating an update request, determining from the readers count and the read waiters flag whether there are any tasks reading or waiting to read the file system directory;
if there are no tasks reading or waiting to read the file system directory, continuing with the update request; and
if there are any tasks reading or waiting to read the file system directory, setting the update waiters flag and suspending further processing of the update request.

### Claim 8 (depends on 7)

The method of claim 7, further comprising:
maintaining for the file system directory a change log queue containing change logs that have not been applied to the cached client version, each of the change logs in the change log queue specifying one or more updates to the file system directory and specifying an update version;
receiving from the server system a reply to an update request, the reply containing a change log specifying one or more updates to the file system directory and specifying an update version;
comparing the update version specified by the received change log with a stored last applied version specifying a last update version applied to the cached client version of the file system directory;
if the update version specified by the received change log corresponds to a next expected version after the last applied version, applying the updates specified by the change log to the cached client version of the file system directory and incrementing the last applied version; and
if the update version specified by the received change log corresponds to a later version than the next expected version, adding the received change log to the change log queue without incrementing the last applied version.

### Claim 9 (depends on 8)

The method of claim 8, further comprising, following incrementing of the last applied version:
determining whether the change log queue contains a change log specifying an update version corresponding to a next expected version after the last applied version as so incremented; and
if the change log queue contains a change log specifying an update version corresponding to such next expected version, processing the change log by applying the updates specified by the change log to the cached client version of the file system directory, removing the change log from the change log queue, and incrementing the last applied version, the determining and the processing being performed iteratively while the change log queue contains a change log specifying an update version corresponding to a next expected version.

### Claim 10 (depends on 7)

The method of claim 7, wherein the cached client version of the file system directory maintains an updaters count of pending requests from the client system to the server system to update the file system directory, the method further comprising:
incrementing the updaters count upon initiating an update request to the server system; and
decrementing the updaters count upon processing a reply to the update request from the server system.

### Claim 11 (depends on 7)

A computer program product stored on a tangible computer-usable medium, comprising a computer-readable program for causing a computer to perform the method steps of claim 7 when the program is run on the computer.

### Claim 12 (depends on 7)

A system comprising a processor configured to perform the method steps of claim 7.
