Commit 0d385e48 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfs4: initialize newly created state ids with sequence zero

Motivation:
typically, every time when file's open/lock/layout state id is used to
change file's state, the sequence number is incremented. Thus newly
created stateid should have sequence zero, as it will be bumped during
processing. As currently sequence number initialized with one (1), fresh
created lock and layout state ids have sequence 2 when sent to the
clients.

Modification:
Initialize sequence number of newly created state ids with zero.
Increment open state id's sequence number for all state ids.

Result:
better spec compliance, as lock and layout state ids will start with
sequence 1.

Acked-by: Jürgen Starek
Target: master, 0.19
parent 8aed1f0f
/*
* Copyright (c) 2017 Deutsches Elektronen-Synchroton,
* Copyright (c) 2017 - 2019 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -129,7 +129,6 @@ public class FileTracker {
os.getOwner().equals(owner)) {
os.shareAccess |= shareAccess;
os.shareDeny |= shareDeny;
os.stateid.seqid.value++;
return os.stateid;
}
}
......
......@@ -57,7 +57,7 @@ public class NFSv4StateHandler {
/**
* initial value of new state's sequence number.
*/
private final static int STATE_INITIAL_SEQUENCE = 1;
private final static int STATE_INITIAL_SEQUENCE = 0;
/**
* client id generator.
......
......@@ -271,6 +271,7 @@ public class OperationOPEN extends AbstractNFSv4Operation {
_args.opopen.share_access.value,
_args.opopen.share_deny.value);
stateid.seqid.value++;
context.currentStateid(stateid);
res.resok4.stateid = stateid;
res.status = nfsstat.NFS_OK;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment