Skip to contentSkip to conversation

Btrfs: check return value for kthread_run() correctly

PATCH In review Qinghuang Feng 2 participants 2 messages Jan 19, 2009 – Jan 21, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: check return value for kthread_run() correctly

kthread_run() returns the kthread or ERR_PTR(-ENOMEM), not NULL.

---

fs/btrfs/disk-io.c +2 -2
index 81a3138..f718d25 100644
@@ -1740,13 +1740,13 @@ struct btrfs_root *open_ctree(struct super_block *sb,
 	fs_info->system_alloc_profile = fs_info->metadata_alloc_profile;
 	fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
 					       "btrfs-cleaner");
-	if (!fs_info->cleaner_kthread)
+	if (IS_ERR(fs_info->cleaner_kthread))
 		goto fail_csum_root;
 
 	fs_info->transaction_kthread = kthread_run(transaction_kthread,
 						   tree_root,
 						   "btrfs-transaction");
-	if (!fs_info->transaction_kthread)
+	if (IS_ERR(fs_info->transaction_kthread))
 		goto fail_cleaner;
 
 	if (btrfs_super_log_root(disk_super) != 0) {
#1 lore raw
Quoted 2 lines · Qinghuang Feng

kthread_run() returns the kthread or ERR_PTR(-ENOMEM), not NULL.

Thanks, got it.

-chris