From ab0ca7c00f03f1634a37ec513a1424f9e42842f6 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 26 Jul 2023 01:53:16 +0300 Subject: [PATCH] Return FILE_SYNC from NFS writes if immediate_commit is enabled --- src/nfs_conn.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nfs_conn.cpp b/src/nfs_conn.cpp index 6216d4b8..d150d740 100644 --- a/src/nfs_conn.cpp +++ b/src/nfs_conn.cpp @@ -392,7 +392,6 @@ static int nfs3_write_proc(void *opaque, rpc_op_t *rop) .resok = (WRITE3resok){ //.file_wcc = ..., .count = (unsigned)count, - .committed = args->stable, }, }; if ((args->offset % alignment) != 0 || (count % alignment) != 0) @@ -493,10 +492,11 @@ static void nfs_do_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint } else { + bool imm = self->parent->cli->get_immediate_commit(inode); + reply->resok.committed = args->stable != UNSTABLE || imm ? FILE_SYNC : UNSTABLE; *(uint64_t*)reply->resok.verf = self->parent->server_id; delete op; - if (args->stable != UNSTABLE && - !self->parent->cli->get_immediate_commit(inode)) + if (args->stable != UNSTABLE && !imm) { // Client requested a stable write. Add an fsync op = new cluster_op_t;