From f153bc950b36020533d8e775e9ec9d6c6a3ede40 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 25 Jul 2023 01:45:19 +0000 Subject: [PATCH] Return the same "verifier" in NFS COMMIT as in NFS WRITE This fixes buffered (not O_DIRECT) NFS writes in Linux - previously they were hanging in an infinite loop because COMMIT didn't return the same verifier as previous WRITEs, and NFS kernel client was infinitely retrying the same writes. Also this probably allows for correct NFS failover, at least for the same buffered writes, because NFS clients repeat all write requests until a COMMIT confirms them. --- src/nfs_conn.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nfs_conn.cpp b/src/nfs_conn.cpp index 9e3b276e..6216d4b8 100644 --- a/src/nfs_conn.cpp +++ b/src/nfs_conn.cpp @@ -1215,10 +1215,11 @@ static int nfs3_commit_proc(void *opaque, rpc_op_t *rop) cluster_op_t *op = new cluster_op_t; // fsync. we don't know how to fsync a single inode, so just fsync everything op->opcode = OSD_OP_SYNC; - op->callback = [rop](cluster_op_t *op) + op->callback = [self, rop](cluster_op_t *op) { COMMIT3res *reply = (COMMIT3res*)rop->reply; *reply = (COMMIT3res){ .status = vitastor_nfs_map_err(op->retval) }; + *(uint64_t*)reply->resok.verf = self->parent->server_id; rpc_queue_reply(rop); }; self->parent->cli->execute(op);