Project

General

Profile

Actions

Tasks #65812

closed

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

Tasks #65811: Make dbench work on fscrypt

pwrite failure on overwrite

Added by Christopher Hoffman 13 days ago. Updated 13 days ago.

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

0%

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

Description

Failure on pwrite on overwrite when end of write is past previous end of file.

Steps to reproduce:

import os

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

  os.pwrite(fd, str.encode(s), offset)

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

os.pwrite(fd, str.encode('\0'), 65534)

s = write_fill(fd, '\0', 65536, 0)
s = write_fill(fd, '\0', 65536, 65536)

os.close(fd)

Actions #1

Updated by Christopher Hoffman 13 days ago ยท Edited

  • Status changed from In Progress to Resolved

The issue was a fix I did in an earlier commit. The reproducer should do the read in the start block. The bool for start block was assuming that the endoff-offset fit within one block. This was limiting and created this bug.

I fixed this line

-need_read_start = (ofs_in_start_block >= 0 && (endoff-offset) <= FSCRYPT_BLOCK_SIZE);
+need_read_start = ofs_in_start_block >= 0;

Actions

Also available in: Atom PDF