Skip to content

Commit 9de370f

Browse files
committed
fix: 🐛 imrpve seqid handling on close
1 parent 8a313c9 commit 9de370f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/nfs/v4/client/Nfsv4FsClient.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ export class Nfsv4FsClient implements NfsFsClient {
9797
openOwner: structs.Nfsv4OpenOwner,
9898
stateid: structs.Nfsv4Stateid,
9999
): Promise<void> => {
100+
const key = this.makeOpenOwnerKey(openOwner);
101+
const previousSeqid = this.openOwnerSeqids.get(key);
100102
const seqid = this.nextOpenOwnerSeqid(openOwner);
101103
const response = await this.fs.compound([nfs.CLOSE(seqid, stateid)]);
102104
if (response.status !== Nfsv4Stat.NFS4_OK) {
105+
if (previousSeqid !== undefined) {
106+
this.openOwnerSeqids.set(key, previousSeqid);
107+
} else {
108+
this.openOwnerSeqids.delete(key);
109+
}
103110
throw new Error(`Failed to close file: ${response.status}`);
104111
}
105112
};

tslint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"no-unnecessary-initializer": false,
1212
"no-this-assignment": false,
1313
"no-duplicate-imports": false,
14+
"no-invalid-this": false,
1415
"no-angle-bracket-type-assertion": false,
1516
"ban-comma-operator": false,
1617
"no-unused-expression": false,

0 commit comments

Comments
 (0)