Project

General

Profile

Actions

Tasks #69302

closed

Tasks #63293: Implement fscrypt in libcephfs and cephfs-fuse

Tasks #67919: Ensure written vs logical size is used appropriately

Use correct sizes on write_success

Added by Christopher Hoffman about 1 year ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
% Done:

0%

Reviewed:
Affected Versions:
Component(FS):
Labels (FS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

diff --git a/src/client/Client.cc b/src/client/Client.cc
index acda7399d9a..8c185e06b3e 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -11787,12 +11787,14 @@ int64_t Client::_write_success(Fh *f, utime_t start, uint64_t fpos,

   // extend file?
   if (request_size + request_offset > in->effective_size()) {
+    size = request_size + request_offset;
     if (encrypted) {
-      in->set_effective_size(request_size + request_offset);
+      in->set_effective_size(size);
       in->mark_caps_dirty(CEPH_CAP_FILE_EXCL);
+      size = fscrypt_next_block_start(offset + size);
     }
     ldout(cct, 7) << "in->effective_size()=" << in->effective_size() << dendl;
-    in->size = offset + size;
+    in->size = size;
     in->mark_caps_dirty(CEPH_CAP_FILE_WR);

     if (is_quota_bytes_approaching(in, f->actor_perms)) {
@@ -17121,7 +17123,11 @@ int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length)
     }
   } else if (!(mode & FALLOC_FL_KEEP_SIZE)) {
     uint64_t size = offset + length;
-    if (size > in->size) {
+    if (size > in->effective_size()) {
+      if (in->is_fscrypt_enabled()) {
+        in->set_effective_size(size);
+        size = fscrypt_next_block_start(size);
+      }
       in->size = size;
       in->mtime = in->ctime = ceph_clock_now();
       in->change_attr++;

No data to display

Actions

Also available in: Atom PDF