Project

General

Profile

Actions

Tasks #67347

closed

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

Tasks #66577: interoperability with multi-client

file contents inconsistency between kclient write and fuse read

Added by Christopher Hoffman over 1 year ago. Updated 4 months 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

There's file contents inconsistency using fscrypt when kclient writes 1M file and fuse reads.

choffman@ubuntu1:/mnt/kclient/enc1$ dd if=/dev/urandom of=file1 bs=1M count=1 conv=fsync
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.434824 s, 2.4 MB/s
choffman@ubuntu1:/mnt/kclient/enc1$ md5sum file1 
a089746ce4bb86fe6ab1ce0c70437579  file1
choffman@ubuntu1:/mnt/kclient/enc1$ cd /mnt/mycephfs/enc1/
choffman@ubuntu1:/mnt/mycephfs/enc1$ md5sum file1 
d64a87ee98b28c382f6e7c917bc5fecf  file1
Actions #1

Updated by Christopher Hoffman over 1 year ago

  • Status changed from In Progress to Resolved

_read_async still used Inode size written to disk. We needed to use effective size, where in fscrypt case uses data visible to user versus encrypted size written to OSDs.

commit 6cc747281eeabbf5a1077bccc2306f8b34595990 (HEAD -> wip-fscrypt)
Author: Christopher Hoffman <[email protected]>
Date:   Thu Aug 8 19:50:39 2024 +0000

    client: Use effective_size in eof read

    Fixes: https://tracker.ceph.com/issues/67347
    Signed-off-by: Christopher Hoffman <[email protected]>

diff --git a/src/client/Client.cc b/src/client/Client.cc
index c1c8560316d..32d0a00f816 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -11343,8 +11343,8 @@ int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl,
     return 0;
   }

-  if (off + len > in->size) {
-    len = in->size - off;    
+  if (off + len > effective_size) {
+    len = effective_size - off;
   }

   auto target_len = std::min(len, effective_size - off);

Actions #2

Updated by Christopher Hoffman 4 months ago

  • Assignee set to Christopher Hoffman
Actions

Also available in: Atom PDF