From e58656005d681ee0e35a25b324321cfeea8c7b3a Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Tue, 17 Oct 2017 17:45:37 -0400 Subject: [PATCH] rgw_file: explicit NFSv3 open() emulation Expect RGW_OPEN_FLAG_V3 in rgw_write(), and if present, attempt a stateless open inline. Required by Ganesha v2.5 and later Signed-off-by: Matt Benjamin (cherry picked from commit 6ed23b4a0cea7e41b4743e27319737af693947ec) --- src/rgw/rgw_file.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index e941ece9269cb..96d934a90b426 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1894,8 +1894,14 @@ int rgw_write(struct rgw_fs *rgw_fs, if (! rgw_fh->is_file()) return -EISDIR; - if (! rgw_fh->is_open()) - return -EPERM; + if (! rgw_fh->is_open()) { + if (flags & RGW_OPEN_FLAG_V3) { + rc = rgw_fh->open(flags); + if (!! rc) + return rc; + } else + return -EPERM; + } rc = rgw_fh->write(offset, length, bytes_written, buffer); -- 2.39.5