Skip to contentSkip to conversation

f2fs: don't clear CP_QUOTA_NEED_FSCK_FLAG

PATCH In review Jaegeuk Kim 2 participants 13 messages Feb 12, 2019 – May 20, 2019 F2FS file system

lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: don't clear CP_QUOTA_NEED_FSCK_FLAG

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -2
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
 
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
Signature · 1 line
2.19.0.605.g01d371f741-goog
#1 lore raw
Quoted 13 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 5 lines
fs/f2fs/checkpoint.c +0 -2
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Thanks,

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
 
author maintainer
#2 lore raw
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

Quoted 7 lines

Thanks,

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
 
#3 lore raw
Quoted 26 lines · Jaegeuk Kim
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Quoted 1 line

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear

I know it's subtle... and I agreed we can fix it like this in upstream first, but in our product, it's not rare that we hit the QUOTA_SKIP_FLUSH(its value is 4) case, later we may encounter long latency caused by quota repairing of fsck.

Quoted 2 lines

SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

But later if QUOTA_NEED_REPAIR is set, we will set QUOTA_NEED_FSCK_FLAG again, right?

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))

	__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

So in order to figure out whether this is caused by out-of-order execution of below assignments:

if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Could you have a try:

	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR) ||
			is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
	else
		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

Thanks,

Quoted 11 lines
Quoted 8 lines

Thanks,

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
 

.

author maintainer
#4 lore raw
Quoted 56 lines · Chao Yu
Quoted 26 lines · Jaegeuk Kim
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Quoted 1 line

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear

I know it's subtle... and I agreed we can fix it like this in upstream first, but in our product, it's not rare that we hit the QUOTA_SKIP_FLUSH(its value is 4) case, later we may encounter long latency caused by quota repairing of fsck.

Quoted 2 lines

SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

But later if QUOTA_NEED_REPAIR is set, we will set QUOTA_NEED_FSCK_FLAG again, right?

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))

	__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

So in order to figure out whether this is caused by out-of-order execution of below assignments:

if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Quoted 7 lines

Could you have a try:

	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR) ||
			is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
	else
		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

What does this mean? I'm in doubt we have a missing case where we clear this flag, CP_QUOTA_NEED_FSCK_FLAG.

Quoted 14 lines

Thanks,

Quoted 11 lines
Quoted 8 lines

Thanks,

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
 

.

#5 lore raw
Quoted 59 lines · Jaegeuk Kim
Quoted 58 lines · Chao Yu
Quoted 26 lines · Jaegeuk Kim
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Quoted 1 line

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear

I know it's subtle... and I agreed we can fix it like this in upstream first, but in our product, it's not rare that we hit the QUOTA_SKIP_FLUSH(its value is 4) case, later we may encounter long latency caused by quota repairing of fsck.

Quoted 2 lines

SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

But later if QUOTA_NEED_REPAIR is set, we will set QUOTA_NEED_FSCK_FLAG again, right?

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))

	__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

So in order to figure out whether this is caused by out-of-order execution of below assignments:

if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Could you have a try:

Quoted 7 lines
Quoted 5 lines
	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR) ||
			is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
	else
		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

What does this mean? I'm in doubt we have a missing case where we clear this

Cpu pipeline / compiler can make code out-of-order execution, which means:

a = 1;
b = 2;

may actually be executed as the order of:

b = 2;
a = 1;

So I doubt that below two line codes can be executed out-of-order:

else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if ()
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Quoted 1 line

flag, CP_QUOTA_NEED_FSCK_FLAG.

Agreed, I've checked each operation in f2fs_quota_operations yesterday, and didn't find any missing places yet...

Thanks,

Quoted 18 lines
Quoted 15 lines

Thanks,

Quoted 11 lines
Quoted 8 lines

Thanks,

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
 

.

.

#6 lore raw
Quoted 83 lines · Chao Yu
Quoted 59 lines · Jaegeuk Kim
Quoted 58 lines · Chao Yu
Quoted 26 lines · Jaegeuk Kim
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Quoted 1 line

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear

I know it's subtle... and I agreed we can fix it like this in upstream first, but in our product, it's not rare that we hit the QUOTA_SKIP_FLUSH(its value is 4) case, later we may encounter long latency caused by quota repairing of fsck.

Quoted 2 lines

SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

But later if QUOTA_NEED_REPAIR is set, we will set QUOTA_NEED_FSCK_FLAG again, right?

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))

	__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

So in order to figure out whether this is caused by out-of-order execution of below assignments:

if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Could you have a try:

Quoted 7 lines
Quoted 5 lines
	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR) ||
			is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
	else
		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

What does this mean? I'm in doubt we have a missing case where we clear this

Cpu pipeline / compiler can make code out-of-order execution, which means:

a = 1;
b = 2;

may actually be executed as the order of:

b = 2;
a = 1;

So I doubt that below two line codes can be executed out-of-order:

else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

Quoted 7 lines

if ()
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Quoted 1 line

flag, CP_QUOTA_NEED_FSCK_FLAG.

Agreed, I've checked each operation in f2fs_quota_operations yesterday, and didn't find any missing places yet...

Oh, I mean the place where set SBI_QUOTA_NEED_REPAIR, I also doubt we missed to set the flag.

Thanks,

Quoted 31 lines

Thanks,

Quoted 9 lines
Quoted 9 lines

Thanks,

Quoted 5 lines
Quoted 5 lines

Thanks,

Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1272

Quoted 3 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

.

.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

.

author maintainer
#7 lore raw
Quoted 79 lines · Chao Yu
Quoted 78 lines · Chao Yu
Quoted 59 lines · Jaegeuk Kim
Quoted 58 lines · Chao Yu
Quoted 26 lines · Jaegeuk Kim
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Quoted 1 line

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear

I know it's subtle... and I agreed we can fix it like this in upstream first, but in our product, it's not rare that we hit the QUOTA_SKIP_FLUSH(its value is 4) case, later we may encounter long latency caused by quota repairing of fsck.

Quoted 2 lines

SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

But later if QUOTA_NEED_REPAIR is set, we will set QUOTA_NEED_FSCK_FLAG again, right?

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))

	__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

So in order to figure out whether this is caused by out-of-order execution of below assignments:

if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Could you have a try:

Quoted 7 lines
Quoted 5 lines
	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR) ||
			is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
	else
		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

What does this mean? I'm in doubt we have a missing case where we clear this

Cpu pipeline / compiler can make code out-of-order execution, which means:

a = 1;
b = 2;

may actually be executed as the order of:

b = 2;
a = 1;

Quoted 7 lines
Quoted 7 lines

So I doubt that below two line codes can be executed out-of-order:

else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if ()
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

In spin_lock_irqsave()?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

flag, CP_QUOTA_NEED_FSCK_FLAG.

Agreed, I've checked each operation in f2fs_quota_operations yesterday, and didn't find any missing places yet...

Oh, I mean the place where set SBI_QUOTA_NEED_REPAIR, I also doubt we missed to set the flag.

So, I may need to keep this patch untill we find the missing case. I'll keep an eye on this.

Quoted 34 lines

Thanks,

Quoted 31 lines

Thanks,

Quoted 9 lines
Quoted 9 lines

Thanks,

Quoted 5 lines
Quoted 5 lines

Thanks,

Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

fs/f2fs/checkpoint.c

Quoted 3 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

.

.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

.

#8 lore raw
Quoted 82 lines · Jaegeuk Kim
Quoted 81 lines · Chao Yu
Quoted 80 lines · Chao Yu
Quoted 59 lines · Jaegeuk Kim
Quoted 58 lines · Chao Yu
Quoted 26 lines · Jaegeuk Kim
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Quoted 1 line

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear

I know it's subtle... and I agreed we can fix it like this in upstream first, but in our product, it's not rare that we hit the QUOTA_SKIP_FLUSH(its value is 4) case, later we may encounter long latency caused by quota repairing of fsck.

Quoted 2 lines

SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

But later if QUOTA_NEED_REPAIR is set, we will set QUOTA_NEED_FSCK_FLAG again, right?

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))

	__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

So in order to figure out whether this is caused by out-of-order execution of below assignments:

if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Could you have a try:

Quoted 7 lines
Quoted 5 lines
	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR) ||
			is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
	else
		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

What does this mean? I'm in doubt we have a missing case where we clear this

Cpu pipeline / compiler can make code out-of-order execution, which means:

a = 1;
b = 2;

may actually be executed as the order of:

b = 2;
a = 1;

So I doubt that below two line codes can be executed out-of-order:

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if ()
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

In spin_lock_irqsave()?

Not sure in coverage of spin_lock, system can guarantee codes being executed orderly.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

flag, CP_QUOTA_NEED_FSCK_FLAG.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Agreed, I've checked each operation in f2fs_quota_operations yesterday, and didn't find any missing places yet...

Oh, I mean the place where set SBI_QUOTA_NEED_REPAIR, I also doubt we missed to set the flag.

So, I may need to keep this patch untill we find the missing case. I'll keep an eye on this.

Agreed, do you mind adding one line comment there to notice that?

Thanks,

Quoted 38 lines
Quoted 35 lines

Thanks,

Quoted 31 lines

Thanks,

Quoted 9 lines
Quoted 9 lines

Thanks,

Quoted 5 lines
Quoted 5 lines

Thanks,

Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

fs/f2fs/checkpoint.c

Quoted 3 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

.

.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

.

.

author maintainer
#9 lore raw
Quoted 101 lines · Chao Yu
Quoted 82 lines · Jaegeuk Kim
Quoted 81 lines · Chao Yu
Quoted 80 lines · Chao Yu
Quoted 59 lines · Jaegeuk Kim
Quoted 58 lines · Chao Yu
Quoted 26 lines · Jaegeuk Kim
Quoted 15 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
Quoted 9 lines

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -2
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

I didn't get it, previously, if we didn't persist all quota file's data in checkpoint, then we will tag CP_QUOTA_NEED_FSCK_FLAG in CP area, but in current checkpoint, we have persisted all quota file's data, quota files are consistent with all other files in filesystem, why we can't remove this NEED_FSCK flag..?

Quoted 1 line

I said it's subtle. So, I guessed 1) set CP_QUOTA_NEED_FSCK_FLAG, 2) clear

I know it's subtle... and I agreed we can fix it like this in upstream first, but in our product, it's not rare that we hit the QUOTA_SKIP_FLUSH(its value is 4) case, later we may encounter long latency caused by quota repairing of fsck.

Quoted 2 lines

SBI_QUOTA_SKIP_FLUSH by checkpoint, 3) clear CP_QUOTA_NEED_FSCK_FLAG by another checkpoint?

But later if QUOTA_NEED_REPAIR is set, we will set QUOTA_NEED_FSCK_FLAG again, right?

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))

	__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

So in order to figure out whether this is caused by out-of-order execution of below assignments:

if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

Could you have a try:

Quoted 7 lines
Quoted 5 lines
	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR) ||
			is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
	else
		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

What does this mean? I'm in doubt we have a missing case where we clear this

Cpu pipeline / compiler can make code out-of-order execution, which means:

a = 1;
b = 2;

may actually be executed as the order of:

b = 2;
a = 1;

So I doubt that below two line codes can be executed out-of-order:

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

else
__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- clear flag later

if ()
__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG); --- set flag first

In spin_lock_irqsave()?

Not sure in coverage of spin_lock, system can guarantee codes being executed orderly.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

flag, CP_QUOTA_NEED_FSCK_FLAG.

Agreed, I've checked each operation in f2fs_quota_operations yesterday, and didn't find any missing places yet...

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Oh, I mean the place where set SBI_QUOTA_NEED_REPAIR, I also doubt we missed to set the flag.

So, I may need to keep this patch untill we find the missing case. I'll keep an eye on this.

Agreed, do you mind adding one line comment there to notice that?

/*
* TODO: we count on fsck.f2fs to clear this flag until we figure out
* missing cases which clear it incorrectly.
*/

I added like this.

Thanks,

Quoted 41 lines

Thanks,

Quoted 38 lines
Quoted 35 lines

Thanks,

Quoted 31 lines

Thanks,

Quoted 9 lines
Quoted 9 lines

Thanks,

Quoted 5 lines
Quoted 5 lines

Thanks,

Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

fs/f2fs/checkpoint.c

Quoted 3 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

.

.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

.

.

Reviewed-by
#10 lore raw
Quoted 6 lines · Jaegeuk Kim

/*
* TODO: we count on fsck.f2fs to clear this flag until we figure out
* missing cases which clear it incorrectly.
*/

I added like this.

Thanks,

Quoted 2 lines

Thanks,

#11 lore raw
In reply to Jaegeuk Kim
Quoted 13 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 5 lines
fs/f2fs/checkpoint.c +0 -2
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

Jaegeuk,

Will below commit fix this issue? Not sure, but just want to check that.. :)

f2fs-tools: fix to check total valid block count before block allocation

Thanks,

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_NEED_REPAIR))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
 
author maintainer
#12 lore raw
Quoted 22 lines · Chao Yu
Quoted 13 lines · Jaegeuk Kim

If we met this once, let fsck.f2fs clear this only. Note that, this addresses all the subtle fault injection test.

---
 fs/f2fs/checkpoint.c | 2 --
 1 file changed, 2 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index 03fea4efd64b..10a3ada28715 100644

fs/f2fs/checkpoint.c static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 1271

Quoted 5 lines
fs/f2fs/checkpoint.c +0 -2
@@ -1267,8 +1267,6 @@ static void update_ckpt_flags(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
 	if (is_sbi_flag_set(sbi, SBI_QUOTA_SKIP_FLUSH))
 		__set_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);
-	else
-		__clear_ckpt_flags(ckpt, CP_QUOTA_NEED_FSCK_FLAG);

Jaegeuk,

Quoted 3 lines

Will below commit fix this issue? Not sure, but just want to check that.. :)

f2fs-tools: fix to check total valid block count before block allocation

I started test again whether we can revert this or not. :) Let's see.