linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry
@ 2018-01-11  2:17 Sheng Yong
  2018-01-11  2:17 ` [PATCH 2/3] mkfs.f2fs: set seed for random checkpoint_ver Sheng Yong
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sheng Yong @ 2018-01-11  2:17 UTC (permalink / raw)
  To: jaegeuk, yuchao0; +Cc: shengyong1, linux-f2fs-devel

For dentry name, we should check if parent directory is encrypted. If it
is, show digest-encoded name instead of cipher text when unlink corrupted
dir entries.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 fsck/fsck.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index bcb478a..1211729 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -766,7 +766,7 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
 					blkaddr,
 					&child, (i_blocks == *blk_cnt),
 					ftype, nid, idx, ni->version,
-					file_enc_name(&node_blk->i));
+					file_is_encrypt(&node_blk->i));
 			if (!ret) {
 				*blk_cnt = *blk_cnt + 1;
 			} else if (c.fix_on) {
@@ -974,7 +974,7 @@ int fsck_chk_dnode_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode,
 			blkaddr, child,
 			le64_to_cpu(inode->i_blocks) == *blk_cnt, ftype,
 			nid, idx, ni->version,
-			file_enc_name(inode));
+			file_is_encrypt(inode));
 		if (!ret) {
 			*blk_cnt = *blk_cnt + 1;
 		} else if (c.fix_on) {
@@ -1434,7 +1434,7 @@ static int __chk_dentries(struct f2fs_sb_info *sbi, struct child_info *child,
 				test_and_clear_bit_le(i + j, bitmap);
 			FIX_MSG("Unlink [0x%x] - %s len[0x%x], type[0x%x]",
 					le32_to_cpu(dentry[i].ino),
-					name, name_len,
+					en, name_len,
 					dentry[i].file_type);
 			fixed = 1;
 		} else if (ret == 0) {
@@ -1466,7 +1466,7 @@ int fsck_chk_inline_dentries(struct f2fs_sb_info *sbi,
 	fsck->dentry_depth++;
 	dentries = __chk_dentries(sbi, child,
 			d.bitmap, d.dentry, d.filename, d.max, 1,
-			file_enc_name(&node_blk->i));
+			file_is_encrypt(&node_blk->i));
 	if (dentries < 0) {
 		DBG(1, "[%3d] Inline Dentry Block Fixed hash_codes\n\n",
 			fsck->dentry_depth);
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] mkfs.f2fs: set seed for random checkpoint_ver
  2018-01-11  2:17 [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry Sheng Yong
@ 2018-01-11  2:17 ` Sheng Yong
  2018-01-11  9:51   ` Chao Yu
  2018-01-11  2:17 ` [PATCH 3/3] dump.f2fs: do not write nat bits when dumping info Sheng Yong
  2018-01-11  9:51 ` [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry Chao Yu
  2 siblings, 1 reply; 6+ messages in thread
From: Sheng Yong @ 2018-01-11  2:17 UTC (permalink / raw)
  To: jaegeuk, yuchao0; +Cc: shengyong1, linux-f2fs-devel

If seed is not set, rand always uses 1 as the default seed.

Signed-off-by: Liu Xue <liuxueliu.liu@huawei.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 mkfs/f2fs_format.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index a130001..9d7e180 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -574,6 +574,7 @@ static int f2fs_write_check_point_pack(void)
 	}
 
 	/* 1. cp page 1 of checkpoint pack 1 */
+	srand(time(NULL));
 	cp->checkpoint_ver = cpu_to_le64(rand() | 0x1);
 	set_cp(cur_node_segno[0], c.cur_seg[CURSEG_HOT_NODE]);
 	set_cp(cur_node_segno[1], c.cur_seg[CURSEG_WARM_NODE]);
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] dump.f2fs: do not write nat bits when dumping info
  2018-01-11  2:17 [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry Sheng Yong
  2018-01-11  2:17 ` [PATCH 2/3] mkfs.f2fs: set seed for random checkpoint_ver Sheng Yong
@ 2018-01-11  2:17 ` Sheng Yong
  2018-01-11  9:52   ` Chao Yu
  2018-01-11  9:51 ` [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry Chao Yu
  2 siblings, 1 reply; 6+ messages in thread
From: Sheng Yong @ 2018-01-11  2:17 UTC (permalink / raw)
  To: jaegeuk, yuchao0; +Cc: shengyong1, linux-f2fs-devel

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 fsck/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index 971fc5a..52dd6c3 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2353,7 +2353,7 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi)
 	}
 
 	/* Check nat_bits */
-	if (is_set_ckpt_flags(cp, CP_NAT_BITS_FLAG)) {
+	if (c.func != DUMP && is_set_ckpt_flags(cp, CP_NAT_BITS_FLAG)) {
 		u_int32_t nat_bits_bytes, nat_bits_blocks;
 		__le64 *kaddr;
 		u_int32_t blk;
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry
  2018-01-11  2:17 [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry Sheng Yong
  2018-01-11  2:17 ` [PATCH 2/3] mkfs.f2fs: set seed for random checkpoint_ver Sheng Yong
  2018-01-11  2:17 ` [PATCH 3/3] dump.f2fs: do not write nat bits when dumping info Sheng Yong
@ 2018-01-11  9:51 ` Chao Yu
  2 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2018-01-11  9:51 UTC (permalink / raw)
  To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel

On 2018/1/11 10:17, Sheng Yong wrote:
> For dentry name, we should check if parent directory is encrypted. If it
> is, show digest-encoded name instead of cipher text when unlink corrupted
> dir entries.
> 
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] mkfs.f2fs: set seed for random checkpoint_ver
  2018-01-11  2:17 ` [PATCH 2/3] mkfs.f2fs: set seed for random checkpoint_ver Sheng Yong
@ 2018-01-11  9:51   ` Chao Yu
  0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2018-01-11  9:51 UTC (permalink / raw)
  To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel

On 2018/1/11 10:17, Sheng Yong wrote:
> If seed is not set, rand always uses 1 as the default seed.
> 
> Signed-off-by: Liu Xue <liuxueliu.liu@huawei.com>
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] dump.f2fs: do not write nat bits when dumping info
  2018-01-11  2:17 ` [PATCH 3/3] dump.f2fs: do not write nat bits when dumping info Sheng Yong
@ 2018-01-11  9:52   ` Chao Yu
  0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2018-01-11  9:52 UTC (permalink / raw)
  To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel

On 2018/1/11 10:17, Sheng Yong wrote:
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-11  9:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11  2:17 [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry Sheng Yong
2018-01-11  2:17 ` [PATCH 2/3] mkfs.f2fs: set seed for random checkpoint_ver Sheng Yong
2018-01-11  9:51   ` Chao Yu
2018-01-11  2:17 ` [PATCH 3/3] dump.f2fs: do not write nat bits when dumping info Sheng Yong
2018-01-11  9:52   ` Chao Yu
2018-01-11  9:51 ` [PATCH 1/3] fsck.f2fs: show encoded name when unlinking corrupted dentry Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).