[f2fs-dev] [PATCH] f2fs: remove race condition in releasing cblocks

2020-05-07 Thread Daeho Jeong
From: Daeho Jeong Now, if writing pages and releasing compress blocks occur simultaneously, and releasing cblocks is executed more than one time to a file, then total block count of filesystem and block count of the file could be incorrect and damaged. We have to execute releasing compress

Re: [f2fs-dev] [RFC PATCH 4/4] f2fs: Handle casefolding with Encryption (INCOMPLETE)

2020-05-07 Thread Eric Biggers
On Thu, May 07, 2020 at 12:59:05AM -0700, Eric Biggers wrote: > -static void init_dent_inode(const struct f2fs_filename *fname, > +static void init_dent_inode(struct inode *dir, struct inode *inode, > + const struct f2fs_filename *fname, > struct

Re: [f2fs-dev] [PATCH] f2fs: compress: fix zstd data corruption

2020-05-07 Thread Chao Yu
Hi Daeho, On 2020/5/8 9:28, Daeho Jeong wrote: > Hi Chao, > > IIUC, you are trying not to use ZSTD_compressBound() to save the memory > space. Am I right? > > Then, how about LZ4_compressBound() for LZ4 and lzo1x_worst_compress() for > LZO? Oops, it looks those limits were wrongly used...

[f2fs-dev] [PATCH] f2fs: compress: fix zstd data corruption

2020-05-07 Thread Chao Yu
During zstd compression, ZSTD_endStream() may return non-zero value because distination buffer is full, but there is still compressed data remained in intermediate buffer, it means that zstd algorithm can not save at last one block space, let's just writeback raw data instead of compressed one,

[f2fs-dev] [RFC PATCH V3 01/10] include/linux/pagemap.h: introduce attach/detach_page_private

2020-05-07 Thread Guoqing Jiang
The logic in attach_page_buffers and __clear_page_buffers are quite paired, but 1. they are located in different files. 2. attach_page_buffers is implemented in buffer_head.h, so it could be used by other files. But __clear_page_buffers is static function in buffer.c and other potential

Re: [f2fs-dev] [PATCH 0/4] f2fs: rework filename handling

2020-05-07 Thread Jaegeuk Kim
Hi Eric, Thank you so much for the hard work. :P Looks good to me in general, so let me kick off some tests. On 05/07, Eric Biggers wrote: > This patchset reworks f2fs's handling of filenames to make it much > easier to correctly implement all combinations of normal, encrypted, > casefolded, and

Re: [f2fs-dev] [PATCH v2] f2fs: shrink spinlock coverage

2020-05-07 Thread Jaegeuk Kim
On 05/07, Chao Yu wrote: > On 2020/5/6 23:05, Jaegeuk Kim wrote: > > On 05/06, Chao Yu wrote: > >> In f2fs_try_to_free_nids(), .nid_list_lock spinlock critical region will > >> increase as expected shrink number increase, to avoid spining other CPUs > >> for long time, it's better to implement

Re: [f2fs-dev] [PATCH] f2fs: change maximum zstd compression buffer size

2020-05-07 Thread Chao Yu
On 2020/5/6 22:56, Jaegeuk Kim wrote: > On 05/06, Chao Yu wrote: >> On 2020/5/6 7:05, Jaegeuk Kim wrote: >>> On 05/05, Chao Yu wrote: On 2020-5-4 22:30, Jaegeuk Kim wrote: > From: Daeho Jeong > > Current zstd compression buffer size is one page and header size less > than

[f2fs-dev] [PATCH 0/4] f2fs: rework filename handling

2020-05-07 Thread Eric Biggers
This patchset reworks f2fs's handling of filenames to make it much easier to correctly implement all combinations of normal, encrypted, casefolded, and encrypted+casefolded directories. It also optimizes all filesystem operations to compute the dirhash and casefolded name only once, rather than

[f2fs-dev] [PATCH 1/4] f2fs: don't leak filename in f2fs_try_convert_inline_dir()

2020-05-07 Thread Eric Biggers
From: Eric Biggers We need to call fscrypt_free_filename() to free the memory allocated by fscrypt_setup_filename(). Fixes: b06af2aff28b ("f2fs: convert inline_dir early before starting rename") Cc: # v5.6+ Signed-off-by: Eric Biggers --- fs/f2fs/inline.c | 6 -- 1 file changed, 4

[f2fs-dev] [PATCH 2/4] f2fs: split f2fs_d_compare() from f2fs_match_name()

2020-05-07 Thread Eric Biggers
From: Eric Biggers Sharing f2fs_ci_compare() between comparing cached dentries (f2fs_d_compare()) and comparing on-disk dentries (f2fs_match_name()) doesn't work as well as intended, as these actions fundamentally differ in several ways (e.g. whether the task may sleep, whether the directory is

[f2fs-dev] [RFC PATCH 4/4] f2fs: Handle casefolding with Encryption (INCOMPLETE)

2020-05-07 Thread Eric Biggers
From: Eric Biggers Expand f2fs's casefolding support to include encrypted directories. To index casefolded+encrypted directories, we use the SipHash of the casefolded name, keyed by a key derived from the directory's fscrypt master key. This ensures that the dirhash doesn't leak information

[f2fs-dev] [PATCH 3/4] f2fs: rework filename handling

2020-05-07 Thread Eric Biggers
From: Eric Biggers Rework f2fs's handling of filenames to use a new 'struct f2fs_filename'. Similar to 'struct ext4_filename', this stores the usr_fname, disk_name, dirhash, crypto_buf, and casefolded name. Some of these names can be NULL in some cases. 'struct f2fs_filename' differs from

Re: [f2fs-dev] [PATCH] f2fs: get parent inode when recovering pino

2020-05-07 Thread Gao Xiang
Hi Chao, On Thu, May 07, 2020 at 02:38:39PM +0800, Chao Yu wrote: > On 2020/5/7 6:36, Gao Xiang wrote: > > On Wed, May 06, 2020 at 12:16:13PM -0700, Eric Biggers wrote: > >> On Wed, May 06, 2020 at 02:47:19PM +0800, Gao Xiang wrote: > >>> On Wed, May 06, 2020 at 09:58:22AM +0800, Gao Xiang wrote:

Re: [f2fs-dev] [PATCH] f2fs: get parent inode when recovering pino

2020-05-07 Thread Chao Yu
On 2020/5/7 6:36, Gao Xiang wrote: > On Wed, May 06, 2020 at 12:16:13PM -0700, Eric Biggers wrote: >> On Wed, May 06, 2020 at 02:47:19PM +0800, Gao Xiang wrote: >>> On Wed, May 06, 2020 at 09:58:22AM +0800, Gao Xiang wrote: On Tue, May 05, 2020 at 06:24:28PM -0700, Eric Biggers wrote: >

Re: [f2fs-dev] [PATCH] f2fs: get parent inode when recovering pino

2020-05-07 Thread Chao Yu
On 2020/5/6 14:55, Chao Yu wrote: > On 2020/5/6 9:24, Eric Biggers wrote: >> On Wed, May 06, 2020 at 08:14:07AM +0800, Gao Xiang wrote: Actually, I think this is wrong because the fsync can be done via a file descriptor that was opened to a now-deleted link to the file. >>> >>> I'm