Skip to contentSkip to conversation

f2fs: prevent setting ioprio of thread not in merge mode

PATCH In review Daeho Jeong 2 participants 2 messages Feb 1, 2021 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: prevent setting ioprio of thread not in merge mode

From: Daeho Jeong <[email protected]>

It causes a crash to change the ioprio of checkpoint thread not in checkpoint=merge. I fixed that to prevent setting the ioprio of the thread when checkpoint=merge is not enabled.

---
 fs/f2fs/sysfs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/f2fs/sysfs.c +6 -2
index 100608bcd517..e38a7f6921dd 100644
@@ -357,8 +357,12 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
 			return -EINVAL;
 
 		cprc->ckpt_thread_ioprio = IOPRIO_PRIO_VALUE(class, data);
-		ret = set_task_ioprio(cprc->f2fs_issue_ckpt,
-				cprc->ckpt_thread_ioprio);
+		if (test_opt(sbi, MERGE_CHECKPOINT)) {
+			ret = set_task_ioprio(cprc->f2fs_issue_ckpt,
+					cprc->ckpt_thread_ioprio);
+			if (ret)
+				return ret;
+		}
 
 		return count;
 	}
Signature · 1 line
2.30.0.365.g02bc693789-goog
maintainer
#1 lore raw

Thanks.
Merged into the original patch.

Quoted 32 lines · Daeho Jeong

From: Daeho Jeong <[email protected]>

It causes a crash to change the ioprio of checkpoint thread not in checkpoint=merge. I fixed that to prevent setting the ioprio of the thread when checkpoint=merge is not enabled.

---
 fs/f2fs/sysfs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/f2fs/sysfs.c +6 -2
index 100608bcd517..e38a7f6921dd 100644
@@ -357,8 +357,12 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
 			return -EINVAL;
 
 		cprc->ckpt_thread_ioprio = IOPRIO_PRIO_VALUE(class, data);
-		ret = set_task_ioprio(cprc->f2fs_issue_ckpt,
-				cprc->ckpt_thread_ioprio);
+		if (test_opt(sbi, MERGE_CHECKPOINT)) {
+			ret = set_task_ioprio(cprc->f2fs_issue_ckpt,
+					cprc->ckpt_thread_ioprio);
+			if (ret)
+				return ret;
+		}
 
 		return count;
 	}
Signature · 1 line
2.30.0.365.g02bc693789-goog

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