Project

General

Profile

Actions

Tasks #64819

closed

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

Tasks #64160: RMW race detection

data corruption during rmw after lseek

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

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

0%

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

Description

There's data corruption during a rmw after a seek.

reproducer

import os

def write_fill(fd, fill, size, offset):
  s = ''
  for i in range(0,size):
    s += fill

  os.lseek(fd, offset - int(size / 2), 0)
  os.write(fd, str.encode(s))

file = 'file.log'
fd = os.open(file, os.O_RDWR|os.O_CREAT)

s = write_fill(fd, 's', 32, 16)
s = write_fill(fd, 't', 8, 16)

os.close(fd)

Run the above on fscrypt enabled dir and non-fscrypt dir.

fscrypt enabled dir

hexdump /mnt/mycephfs/fscrypt_test_unlocked_ffsb/file.log 
0000000 7373 7373 7373 7373 7373 7373 7474 7474
0000010 7474 7474 0000 0000 0000 0000 0000 0000
0000020

non-fscrypt dir

hexdump file.log 
0000000 7373 7373 7373 7373 7373 7373 7474 7474
0000010 7474 7474 7373 7373 7373 7373 7373 7373
0000020

fscrypt case, file.log does not have trailing ssss... as it should

Actions

Also available in: Atom PDF