From 6ed23b4a0cea7e41b4743e27319737af693947ec 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 --- 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 3a3edf382bcf0..4ef9901281c5b 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1943,8 +1943,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