Project

General

Profile

Actions

Tasks #64307

closed

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

Tasks #64160: RMW race detection

Buffered write failure

Added by Christopher Hoffman 3 months ago. Updated about 1 month ago.

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

0%

Tags:
Reviewed:
Affected Versions:
Component(FS):
Labels (FS):
Pull request ID:

Description

Buffered write is failing:

#0  0x00007ffff62afecc in __pthread_kill_implementation () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff62afecc in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007ffff625fab6 in raise () from /lib64/libc.so.6
#2  0x00007ffff62497fc in abort () from /lib64/libc.so.6
#3  0x00007ffff75b46ec in ceph::__ceph_assert_fail (assertion=0x55555583a348 "cap_refs[c] > 0", file=<optimized out>, 
    line=195, func=0x55555583a358 "int Inode::put_cap_ref(int)") at /sdb/choffman/code/fork/ceph/src/common/assert.cc:75
#4  0x00007ffff75b47ac in ceph::__ceph_assert_fail (ctx=...) at /sdb/choffman/code/fork/ceph/src/common/assert.cc:80
#5  0x0000555555795b21 in Inode::put_cap_ref (this=this@entry=0x7fffcc010f90, cap=1, cap@entry=8192)
    at /sdb/choffman/code/fork/ceph/src/client/Inode.cc:195
#6  0x00005555556efb10 in Client::put_cap_ref (this=this@entry=0x555555a84860, in=in@entry=0x7fffcc010f90, 
    cap=cap@entry=8192) at /sdb/choffman/code/fork/ceph/src/client/Client.cc:3642
#7  0x000055555573b440 in Client::_write (this=this@entry=0x555555a84860, f=<optimized out>, f@entry=0x7fffb4005bd0, 
    offset=<optimized out>, offset@entry=0, size=<optimized out>, 
    buf=buf@entry=0x7fffac00df00 "#include <stdio.h>\n#include <assert.h>\n#include <limits.h>\n#include \"ffsb_stats.h\"\n#include \"util.h\"\n\nchar *syscall_names[] = {\n\t\"open\",\n\t\"read\",\n\t\"write\",\n\t\"create\",\n\t\"lseek\",\n\t\"unlink\",\n\t\"close\",\n\t\""..., iov=iov@entry=0x0, iovcnt=0, onfinish=0x0, do_fsync=false, syncdataonly=false)
    at /sdb/choffman/code/fork/ceph/src/client/Client.cc:12097
#8  0x000055555573c841 in Client::ll_write (this=0x555555a84860, fh=0x7fffb4005bd0, off=off@entry=0, 
    len=<optimized out>, len@entry=7130, 
    data=data@entry=0x7fffac00df00 "#include <stdio.h>\n#include <assert.h>\n#include <limits.h>\n#include \"ffsb_stats.h\"\n#include \"util.h\"\n\nchar *syscall_names[] = {\n\t\"open\",\n\t\"read\",\n\t\"write\",\n\t\"create\",\n\t\"lseek\",\n\t\"unlink\",\n\t\"close\",\n\t\""...) at /sdb/choffman/code/fork/ceph/src/client/Client.cc:16475
#9  0x00005555556cefcf in fuse_ll_write (req=0x7fffac0029e0, ino=<optimized out>, 
    buf=0x7fffac00df00 "#include <stdio.h>\n#include <assert.h>\n#include <limits.h>\n#include \"ffsb_stats.h\"\n#include \"util.h\"\n\nchar *syscall_names[] = {\n\t\"open\",\n\t\"read\",\n\t\"write\",\n\t\"create\",\n\t\"lseek\",\n\t\"unlink\",\n\t\"close\",\n\t\""..., size=7130, off=0, fi=0x7fffbb7fbf50) at /sdb/choffman/code/fork/ceph/src/client/fuse_ll.cc:901
#10 0x00007ffff7f7e36f in do_write.lto_priv () from /lib64/libfuse3.so.3
#11 0x00007ffff7f8b033 in fuse_session_process_buf_int () from /lib64/libfuse3.so.3
#12 0x00007ffff7f83577 in fuse_do_work () from /lib64/libfuse3.so.3
#13 0x00007ffff62ae19d in start_thread () from /lib64/libc.so.6
#14 0x00007ffff632fc60 in clone3 () from /lib64/libc.so.6

Actions #1

Updated by Christopher Hoffman 3 months ago

Steps to reproduce:

cd /mnt/mycephfs
mkdir fscrypt_test_unlocked_ffsb
echo -ne '\x07\x63\xe7\x11\xd9\xc8\x09\x25\xc9\xff\xcc\xe6\x2d\x8e\x03\x02\xa5\xd7\xdd\x37\xc0\x2e\x97\x5d\x8a\x92\x38\x1e\xc4\xc8\x38\xd1\xbf\xd9\x05\x0d\x94\x9e\x45\x6e\xee\xdc\x9c\xed\x82\x9a\x72\x0b\x00\x89\x91\x63\x05\x3b\x09\x6d\x06\x30\x71\x63\x7c\x91\x0f\x38' | xfs_io -c 'add_enckey ' fscrypt_test_unlocked_ffsb
xfs_io -c 'set_encpolicy 69d7f347a3ca7bfa3e0c1d84e476d050' fscrypt_test_unlocked_ffsb
cd fscrypt_test_unlocked_ffsb
dd if=/dev/zero of=file1 bs=7777 count=10
dd if=/dev/zero of=file1 bs=7777 count=10

Actions #2

Updated by Christopher Hoffman 3 months ago

  • Status changed from New to In Progress
Actions #3

Updated by Patrick Donnelly 3 months ago

  • Assignee set to Christopher Hoffman
Actions #4

Updated by Christopher Hoffman about 1 month ago

  • Status changed from In Progress to Closed

Fixed in: https://github.com/ceph/ceph/commit/9a083b0935509744234082832d12ed2734bcb6e0 and commit in wip-fscrypt.

diff --git a/src/client/Client.cc b/src/client/Client.cc
index 8970e7e5aa8..9ed12685ba3 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -11682,7 +11682,7 @@ int Client::WriteEncMgr::read_modify_write(Context *_iofinish)
   read_start_size = (need_read_start && need_read_end && start_block == end_block ?
                      FSCRYPT_BLOCK_SIZE : ofs_in_start_block);

-  bool need_read = need_read_start | need_read_start;
+  bool need_read = need_read_start | need_read_end;
   ldout(cct, 10) << "need_read_start=" << need_read_start << "need_read_end=" << need_read_end
                  << " read_start_size=" << read_start_size << " need_read=" << need_read << dendl;

Actions

Also available in: Atom PDF