Skip to contentSkip to conversation

btrfs:Fix error handling in the function btrfs_dev_replace_kthread

PATCH RESEND Chris Mason 1 participant 1 message Dec 30, 2015 2 messages not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 24 lines · Nicholas Krause

This fixes error handling in the function btrfs_dev_replace_kthread by checking if the call to the function btrfs_dev_replace_continue_on_mount has failed and if so return the error code to this function's caller in order to signal a failure has occurred when calling this particular function.

---
 fs/btrfs/dev-replace.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/btrfs/dev-replace.c +1 -0
index 38ffd73..b26f68c 100644
@@ -803,6 +803,7 @@ static int btrfs_dev_replace_kthread(void *data)
 	struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace;
 	struct btrfs_ioctl_dev_replace_args *status_args;
 	u64 progress;
+	int ret;
 
 	status_args = kzalloc(sizeof(*status_args), GFP_NOFS);
 	if (status_args) {

fs/btrfs/dev-replace.c static int btrfs_dev_replace_kthread(void *data) · line 827

Quoted 8 lines
fs/btrfs/dev-replace.c +3 -1
@@ -820,7 +821,9 @@ static int btrfs_dev_replace_kthread(void *data)
 			"<missing target disk>",
 			(unsigned int)progress);
 	}
-	btrfs_dev_replace_continue_on_mount(fs_info);
+	ret = btrfs_dev_replace_continue_on_mount(fs_info);
+	if (ret)
+		return ret;
 	atomic_set(&fs_info->mutually_exclusive_operation_running, 0);

This atomic_set that you're skipping is really important.

-chris