Skip to contentSkip to conversation

f2fs: retry ENOMEM for quota_read|write

PATCH In review Jaegeuk Kim 3 participants 8 messages Oct 19, 2017 – Oct 30, 2017

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/2 f2fs: retry ENOMEM for quota_read|write

This gives another chance to read or write quota data.

---
 fs/f2fs/super.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
fs/f2fs/super.c +11 -2
index fc3b74e53670..2c6e9adce464 100644
@@ -1351,8 +1351,13 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data,
 		tocopy = min_t(unsigned long, sb->s_blocksize - offset, toread);
 repeat:
 		page = read_mapping_page(mapping, blkidx, NULL);
-		if (IS_ERR(page))
+		if (IS_ERR(page)) {
+			if (PTR_ERR(page) == -ENOMEM) {
+				congestion_wait(BLK_RW_ASYNC, HZ/50);
+				goto repeat;
+			}
 			return PTR_ERR(page);
+		}
 
 		lock_page(page);
 
@@ -1395,10 +1400,14 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 	while (towrite > 0) {
 		tocopy = min_t(unsigned long, sb->s_blocksize - offset,
 								towrite);
-
+retry:
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
 		if (unlikely(err)) {
+			if (err == -ENOMEM) {
+				congestion_wait(BLK_RW_ASYNC, HZ/50);
+				goto retry;
+			}
 			if (len == towrite)
 				return err;
 			break;
Signature · 1 line
2.14.0.rc1.383.gd1ce394fe2-goog
author maintainer
#1 lore raw

PATCH 2/2 f2fs: relax EIO injection for quota file

This case is not happening easily.

---
 fs/f2fs/f2fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/f2fs.h +1 -1
index e0ef31cb2cc6..6301ccca8888 100644
@@ -1544,7 +1544,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
 		return ret;
 
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-	if (time_to_inject(sbi, FAULT_BLOCK)) {
+	if (!IS_NOQUOTA(inode) && time_to_inject(sbi, FAULT_BLOCK)) {
 		f2fs_show_injection_info(FAULT_BLOCK);
 		release = *count;
 		goto enospc;
Signature · 1 line
2.14.0.rc1.383.gd1ce394fe2-goog
maintainer
#2 lore raw

Re: [f2fs-dev] [PATCH 2/2] f2fs: relax EIO injection for quota file

Quoted 1 line · Jaegeuk Kim

This case is not happening easily.

Actually it can happen, so why not just keep it?

Thanks,

Quoted 20 lines
---
 fs/f2fs/f2fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/f2fs.h +1 -1
index e0ef31cb2cc6..6301ccca8888 100644
@@ -1544,7 +1544,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
 		return ret;
 
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-	if (time_to_inject(sbi, FAULT_BLOCK)) {
+	if (!IS_NOQUOTA(inode) && time_to_inject(sbi, FAULT_BLOCK)) {
 		f2fs_show_injection_info(FAULT_BLOCK);
 		release = *count;
 		goto enospc;
author maintainer
#3 lore raw

Re: [f2fs-dev] [PATCH 2/2] f2fs: relax EIO injection for quota file

Quoted 4 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim

This case is not happening easily.

Actually it can happen, so why not just keep it?

Okay, so let me keep this patch for local stress tests only.

Thanks,

Quoted 23 lines

Thanks,

Quoted 20 lines
---
 fs/f2fs/f2fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/f2fs.h +1 -1
index e0ef31cb2cc6..6301ccca8888 100644
@@ -1544,7 +1544,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
 		return ret;
 
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-	if (time_to_inject(sbi, FAULT_BLOCK)) {
+	if (!IS_NOQUOTA(inode) && time_to_inject(sbi, FAULT_BLOCK)) {
 		f2fs_show_injection_info(FAULT_BLOCK);
 		release = *count;
 		goto enospc;
#4 lore raw

Re: [f2fs-dev] [PATCH 2/2] f2fs: relax EIO injection for quota file

Hi Jaegeuk,

Quoted 7 lines · Jaegeuk Kim
Quoted 4 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim

This case is not happening easily.

Actually it can happen, so why not just keep it?

Okay, so let me keep this patch for local stress tests only.

May I ask which type and rate of fault injection you are using for test now?

Thanks,

Quoted 30 lines

Thanks,

Quoted 16 lines

Thanks,

Quoted 13 lines
---
 fs/f2fs/f2fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/f2fs.h +0 -0
index e0ef31cb2cc6..6301ccca8888 100644
@@ -1544,7 +1544,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
 		return ret;
 
Quoted 7 lines

fs/f2fs/f2fs.h static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, · line 1550

Quoted 7 lines
fs/f2fs/f2fs.h +1 -1
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-	if (time_to_inject(sbi, FAULT_BLOCK)) {
+	if (!IS_NOQUOTA(inode) && time_to_inject(sbi, FAULT_BLOCK)) {
 		f2fs_show_injection_info(FAULT_BLOCK);
 		release = *count;
 		goto enospc;

.

author maintainer
#5 lore raw

Re: [f2fs-dev] [PATCH 2/2] f2fs: relax EIO injection for quota file

Quoted 5 lines · Chao Yu

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim
Quoted 1 line · Chao Yu

On 2017/10/20 0:56, Jaegeuk Kim wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

This case is not happening easily.

Actually it can happen, so why not just keep it?

Okay, so let me keep this patch for local stress tests only.

May I ask which type and rate of fault injection you are using for test now?

I select random value between 3000 and 5000, and 255 for type.

Thanks,

Quoted 33 lines

Thanks,

Quoted 30 lines

Thanks,

Quoted 16 lines

Thanks,

Quoted 13 lines
---
 fs/f2fs/f2fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/f2fs.h +0 -0
index e0ef31cb2cc6..6301ccca8888 100644
@@ -1544,7 +1544,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
 		return ret;
 
Quoted 7 lines

fs/f2fs/f2fs.h static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, · line 1550

Quoted 7 lines
fs/f2fs/f2fs.h +1 -1
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-	if (time_to_inject(sbi, FAULT_BLOCK)) {
+	if (!IS_NOQUOTA(inode) && time_to_inject(sbi, FAULT_BLOCK)) {
 		f2fs_show_injection_info(FAULT_BLOCK);
 		release = *count;
 		goto enospc;

.

#6 lore raw

Re: [f2fs-dev] [PATCH 2/2] f2fs: relax EIO injection for quota file

Quoted 8 lines · Jaegeuk Kim
Quoted 7 lines · Chao Yu

Hi Jaegeuk,

Quoted 4 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim

This case is not happening easily.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Actually it can happen, so why not just keep it?

Okay, so let me keep this patch for local stress tests only.

May I ask which type and rate of fault injection you are using for test now?

I select random value between 3000 and 5000, and 255 for type.

Got it, thanks for your sharing. :)

Thanks,

Quoted 39 lines

Thanks,

Quoted 33 lines

Thanks,

Quoted 30 lines

Thanks,

Quoted 16 lines

Thanks,

Quoted 13 lines
---
 fs/f2fs/f2fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/f2fs.h +0 -0
index e0ef31cb2cc6..6301ccca8888 100644
@@ -1544,7 +1544,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
 		return ret;
 
Quoted 7 lines

fs/f2fs/f2fs.h static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, · line 1550

Quoted 7 lines
fs/f2fs/f2fs.h +1 -1
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-	if (time_to_inject(sbi, FAULT_BLOCK)) {
+	if (!IS_NOQUOTA(inode) && time_to_inject(sbi, FAULT_BLOCK)) {
 		f2fs_show_injection_info(FAULT_BLOCK);
 		release = *count;
 		goto enospc;

.

.

maintainer Reviewed-by on v1 1/2
#7 lore raw
In reply to Jaegeuk Kim
Quoted 3 lines · Jaegeuk Kim

This gives another chance to read or write quota data.

Thanks,

Quoted 40 lines
---
 fs/f2fs/super.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
fs/f2fs/super.c +11 -2
index fc3b74e53670..2c6e9adce464 100644
@@ -1351,8 +1351,13 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data,
 		tocopy = min_t(unsigned long, sb->s_blocksize - offset, toread);
 repeat:
 		page = read_mapping_page(mapping, blkidx, NULL);
-		if (IS_ERR(page))
+		if (IS_ERR(page)) {
+			if (PTR_ERR(page) == -ENOMEM) {
+				congestion_wait(BLK_RW_ASYNC, HZ/50);
+				goto repeat;
+			}
 			return PTR_ERR(page);
+		}
 
 		lock_page(page);
 
@@ -1395,10 +1400,14 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 	while (towrite > 0) {
 		tocopy = min_t(unsigned long, sb->s_blocksize - offset,
 								towrite);
-
+retry:
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
 		if (unlikely(err)) {
+			if (err == -ENOMEM) {
+				congestion_wait(BLK_RW_ASYNC, HZ/50);
+				goto retry;
+			}
 			if (len == towrite)
 				return err;
 			break;