[f2fs-dev] [PATCH 9/9] fs: f2fs: support diskcipher

2019-08-20 Thread boojin.kim
F2FS checks the crypto properties of the inode, and if it is a diskcipher, sets it to BIO before submitting the BIO. When using diskcipher, F2FS does not encrypt the data before submitting the bio and decrypt the data on complete of the BIO. F2FS uses DUN(device unit number) as the IV(initial vect

[f2fs-dev] [PATCH 7/9] fscrypt: support diskcipher

2019-08-20 Thread boojin.kim
This patch support fscrypt to use diskcipher in a specific crypto mode (FSCRYPT_MODE_PRIVATE). Fscrypt allocates diskcipher and sets the key on diskcipher. Fscrypt doesn't handle additional data encryption when using diskcipher. Cc: Theodore Y. Ts'o Cc: Jaegeuk Kim Cc: Eric Biggers Signed-off-b

[f2fs-dev] [PATCH 5/9] block: support diskcipher

2019-08-20 Thread boojin.kim
This patch supports crypto information to be maintained via BIO and passed to the storage driver. To do this, 'bi_aux_private', 'REQ_CYPTE' and 'bi_dun' are added to the block layer. 'bi_aux_private' is added for loading additional private information into BIO. 'REQ_CRYPT' is added to distinguish

[f2fs-dev] [PATCH 6/9] dm crypt: support diskcipher

2019-08-20 Thread boojin.kim
This patch supports dm-crypt to use diskcipher in a specific ivmode (disk or fmp). Dm-crypt allocates diskcipher and sets the key on it. Then, dm-crypt sets diskcipher into BIO and submits the BIO without any additional data encryption. Cc: Alasdair Kergon Cc: Mike Snitzer Cc: dm-de...@redhat.co

[f2fs-dev] [PATCH 4/9] mmc: dw_mmc-exynos: support FMP

2019-08-20 Thread boojin.kim
Exynos MMC uses FMP to encrypt data stored on MMC device. FMP H/W reads crypto information from MMC descriptor. So, when using FMP H/W, the format of MMC descriptor should be extended. The FMP driver is registered with the diskcipher algorithm, so exynos MMC calls diskcipher API to use FMP. Cc: Ul

[f2fs-dev] [PATCH 8/9] fs: ext4: support diskcipher

2019-08-20 Thread boojin.kim
Ext4 checks the crypto properties of the inode, and if it is a diskcipher, sets it to BIO before submitting the BIO. When using diskcipher, Ext4 does not encrypt the data before submitting the BIO and decrypt the data on complete of the BIO. Cc: Theodore Ts'o Cc: Andreas Dilger Signed-off-by: Bo

[f2fs-dev] [PATCH 1/9] crypt: Add diskcipher

2019-08-20 Thread boojin.kim
Diskcipher supports cryptographic operations of inline crypto engines like FMP. Inline crypto engine refers to hardware and solutions implemented to encrypt data stored in storage device. When encrypting using the FMP, Additional control is required to carry and maintain the crypto information bet

[f2fs-dev] [PATCH 0/9] Flash Memory Protector Support

2019-08-20 Thread boojin.kim
Exynos has a H/W block called FMP (Flash Memory Protector) to protect data stored on storage device. FMP interworks with the storage controller to encrypt a data before writing to the storage device and decrypt the data after reading from storage device. FMP is a kind of ICE (inline crypto engines)

[f2fs-dev] [PATCH 2/9] crypto: fmp: add Flash Memory Protector driver

2019-08-20 Thread boojin.kim
Exynos has FMP(Flash Memory Protector) H/W to protect data stored on storage device. FMP interworks with the storage controller to encrypt a data before writing to the storage device and decrypt the data after reading from storage device. FMP driver is registered with a cipher algorithm of diskcip

[f2fs-dev] [PATCH 3/9] mmc: dw_mmc: support crypto operation

2019-08-20 Thread boojin.kim
This patch supports the crypto operation in mmc driver. Two vops are added to dw_mci_drv_data for it. The crypto_engine_cfg() is required to set crypto information such as key and algorithm modes before I/O. The crypto_engine_clear() is required to clear the crypto information set in the H/W after

[f2fs-dev] [PATCH v2 3/4] fsck.f2fs: Check write pointer consistency with current segments

2019-08-20 Thread Shin'ichiro Kawasaki
On sudden f2fs shutdown, zoned block device status and f2fs current segment positions in meta data can be inconsistent. When f2fs shutdown happens before write operations completes, write pointers of zoned block devices can go further but f2fs meta data keeps current segments at positions before th

[f2fs-dev] [PATCH v2 1/4] libf2fs_zoned: Introduce f2fs_report_zones() helper function

2019-08-20 Thread Shin'ichiro Kawasaki
To prepare for write pointer consistency check by fsck, add f2fs_report_zones() helper function which calls REPORT ZONE command to get write pointer status. The function is added to lib/libf2fs_zoned which gathers zoned block device related functions. To check write pointer consistency with f2fs m

[f2fs-dev] [PATCH v2 0/4] fsck: Check write pointers of zoned block devices

2019-08-20 Thread Shin'ichiro Kawasaki
On sudden f2fs shutdown, zoned block device status and f2fs meta data can be inconsistent. When f2fs shutdown happens during write operations, write pointers on the device go forward but the f2fs meta data does not reflect write pointer progress. This inconsistency will eventually cause "Unaligned

[f2fs-dev] [PATCH v2 4/4] fsck.f2fs: Check write pointer consistency with valid blocks count

2019-08-20 Thread Shin'ichiro Kawasaki
When sudden f2fs shutdown happens on zoned block devices, write pointers can be inconsistent with valid blocks counts in meta data. The failure scenario is as follows: - Just before a sudden shutdown, a new segment in a new zone is selected for a current segment. Write commands were executed to

[f2fs-dev] [PATCH v2 2/4] libf2fs_zoned: Introduce f2fs_reset_zone() function

2019-08-20 Thread Shin'ichiro Kawasaki
To allow fsck to reset a zone with inconsistent write pointer, introduce a helper function f2fs_reset_zone(). Signed-off-by: Shin'ichiro Kawasaki --- include/f2fs_fs.h | 1 + lib/libf2fs_zoned.c | 24 2 files changed, 25 insertions(+) diff --git a/include/f2fs_fs.h b

Re: [f2fs-dev] [PATCH 0/4] fsck: Check write pointers of zoned block devices

2019-08-20 Thread Shinichiro Kawasaki
On Tue, 2019-08-20 at 10:57 -0700, Jaegeuk Kim wrote: > Hi Shinichiro, > > Thank you so much for the contribution. > BTW, I failed to compile them. Could you please take a look at them one more > time? :) Thank you for the care and sorry about the compile failure. I checked compile pass with dev-

Re: [f2fs-dev] [PATCH V4 5/8] f2fs: Use read_callbacks for decrypting file data

2019-08-20 Thread Chandan Rajendra
On Tuesday, August 20, 2019 11:01 PM Jaegeuk Kim wrote: > Hi Chandan, > > On 08/20, Theodore Y. Ts'o wrote: > > On Tue, Aug 20, 2019 at 10:35:29AM +0530, Chandan Rajendra wrote: > > > Looks like F2FS requires a lot more flexiblity than what can be offered by > > > read callbacks i.e. > > > > > >

[f2fs-dev] [PATCH v7] Add flags option to get xattr method paired to __vfs_getxattr

2019-08-20 Thread Mark Salyzyn via Linux-f2fs-devel
Replace arguments for get and set xattr methods, and __vfs_getxattr and __vfs_setaxtr functions with a reference to the following now common argument structure: struct xattr_gs_args { struct dentry *dentry; struct inode *inode; const char *name; union {

Re: [f2fs-dev] [PATCH 0/4] fsck: Check write pointers of zoned block devices

2019-08-20 Thread Jaegeuk Kim
Hi Shinichiro, Thank you so much for the contribution. BTW, I failed to compile them. Could you please take a look at them one more time? :) Thanks, On 08/19, Shin'ichiro Kawasaki wrote: > On sudden f2fs shutdown, zoned block device status and f2fs meta data can be > inconsistent. When f2fs shut

Re: [f2fs-dev] [PATCH v2] f2fs: allocate memory in batch in build_sit_info()

2019-08-20 Thread Jaegeuk Kim
On 08/20, Chao Yu wrote: > On 2019/8/20 4:20, Jaegeuk Kim wrote: > > On 07/26, Chao Yu wrote: > >> build_sit_info() allocate all bitmaps for each segment one by one, > >> it's quite low efficiency, this pach changes to allocate large > >> continuous memory at a time, and divide it and assign for ea

Re: [f2fs-dev] [PATCH V4 5/8] f2fs: Use read_callbacks for decrypting file data

2019-08-20 Thread Jaegeuk Kim
Hi Chandan, On 08/20, Theodore Y. Ts'o wrote: > On Tue, Aug 20, 2019 at 10:35:29AM +0530, Chandan Rajendra wrote: > > Looks like F2FS requires a lot more flexiblity than what can be offered by > > read callbacks i.e. > > > > 1. F2FS wants to make use of its own workqueue for decryption, verity an

Re: [f2fs-dev] [PATCH V4 5/8] f2fs: Use read_callbacks for decrypting file data

2019-08-20 Thread Gao Xiang via Linux-f2fs-devel
Hi Ted, On Tue, Aug 20, 2019 at 12:25:10PM -0400, Theodore Y. Ts'o wrote: > On Tue, Aug 20, 2019 at 01:12:36PM +0800, Gao Xiang wrote: > > Add a word, I have some little concern about post read procession order > > a bit as I mentioned before, because I'd like to move common EROFS > > decompressio

Re: [f2fs-dev] [PATCH V4 5/8] f2fs: Use read_callbacks for decrypting file data

2019-08-20 Thread Theodore Y. Ts'o
On Tue, Aug 20, 2019 at 10:35:29AM +0530, Chandan Rajendra wrote: > Looks like F2FS requires a lot more flexiblity than what can be offered by > read callbacks i.e. > > 1. F2FS wants to make use of its own workqueue for decryption, verity and >decompression. > 2. F2FS' decompression code is no

Re: [f2fs-dev] [PATCH V4 5/8] f2fs: Use read_callbacks for decrypting file data

2019-08-20 Thread Theodore Y. Ts'o
On Tue, Aug 20, 2019 at 01:12:36PM +0800, Gao Xiang wrote: > Add a word, I have some little concern about post read procession order > a bit as I mentioned before, because I'd like to move common EROFS > decompression code out in the future as well for other fses to use > after we think it's mature

[f2fs-dev] [PATCH v6] Add flags option to get xattr method paired to __vfs_getxattr

2019-08-20 Thread Mark Salyzyn via Linux-f2fs-devel
Replace arguments for get and set xattr methods, and __vfs_getxattr and __vfs_setaxtr functions with a reference to the following now common argument structure: struct xattr_gs_args { struct dentry *dentry; struct inode *inode; const char *name; union {

[PATCH] f2fs: fix to avoid corruption during inline conversion

2019-08-20 Thread Chao Yu
From: Chao Yu - f2fs_setattr - truncate_setsize (expand i_size) - f2fs_convert_inline_inode - f2fs_convert_inline_page - f2fs_reserve_block - f2fs_get_node_info failed Once we fail in above path, inline flag will remain, however - we've reserved one block at inode.i_addr[0] - i_siz

Re: [f2fs-dev] [PATCH 2/4] fsck.f2fs: fix to check c.fix_on before repair

2019-08-20 Thread Chao Yu
Jaegeuk, Could you merge [2,3,4/4] patch as well, I just hit one case with por_fsstress. [ASSERT] (fsck_chk_inode_blk: 803) --> [0x1ec84] wrong inline size:149820 Thanks, On 2019/8/16 9:20, Chao Yu wrote: > On 2019/8/16 9:06, Jaegeuk Kim wrote: >> On 08/12, Chao Yu wrote: >>> We should always

Re: [f2fs-dev] [PATCH v8 00/20] vfs: Add support for timestamp limits

2019-08-20 Thread Jeff Layton
On Sun, 2019-08-18 at 09:57 -0700, Deepa Dinamani wrote: > The series is an update and a more complete version of the > previously posted series at > https://lore.kernel.org/linux-fsdevel/20180122020426.2988-1-deepa.ker...@gmail.com/ > > Thanks to Arnd Bergmann for doing a few preliminary reviews.

Re: [f2fs-dev] [PATCH] f2fs: fix to avoid data corruption by forbidding SSR overwrite

2019-08-20 Thread Chao Yu
On 2019/8/20 9:00, Jaegeuk Kim wrote: > On 08/19, Chao Yu wrote: >> On 2019/8/16 11:03, Chao Yu wrote: >>> There is one case can cause data corruption. >>> >>> - write 4k to fileA >>> - fsync fileA, 4k data is writebacked to lbaA >>> - write 4k to fileA >>> - kworker flushs 4k to lbaB; dnode contai

Re: [f2fs-dev] [PATCH] fsck.f2fs: check only max extra_isize

2019-08-20 Thread Chao Yu
On 2019/8/20 9:16, Jaegeuk Kim wrote: > On 08/18, Chao Yu wrote: >> On 2019-8-17 9:03, Jaegeuk Kim wrote: >>> If we use later kernel having larger extra_isize, old fsck will delete >>> entire old files. >> >> Would it be better to construct the length based on existed features? > > We can't judge

Re: [PATCH v2] f2fs: allocate memory in batch in build_sit_info()

2019-08-20 Thread Chao Yu
On 2019/8/20 4:20, Jaegeuk Kim wrote: > On 07/26, Chao Yu wrote: >> build_sit_info() allocate all bitmaps for each segment one by one, >> it's quite low efficiency, this pach changes to allocate large >> continuous memory at a time, and divide it and assign for each bitmaps >> of segment. For large

Re: [f2fs-dev] [PATCH V4 5/8] f2fs: Use read_callbacks for decrypting file data

2019-08-20 Thread Chao Yu
On 2019/8/19 21:33, Chandan Rajendra wrote: > On Sunday, August 18, 2019 7:15:42 PM IST Chao Yu wrote: >> Hi Chandan, >> >> On 2019-8-16 14:18, Chandan Rajendra wrote: >>> F2FS has a copy of "post read processing" code using which encrypted >>> file data is decrypted. This commit replaces it to mak