Skip to content

Commit 83208cb

Browse files
author
Kent Overstreet
committed
bcachefs: Don't return -EROFS from mount on inconsistency error
We were accidentally returning -EROFS during recovery on filesystem inconsistency - since this is what the journal returns on emergency shutdown. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 8528bde commit 83208cb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

fs/bcachefs/fs.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,8 +1939,7 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type,
19391939

19401940
if (IS_ERR(sb)) {
19411941
ret = PTR_ERR(sb);
1942-
ret = bch2_err_class(ret);
1943-
return ERR_PTR(ret);
1942+
goto err;
19441943
}
19451944

19461945
c = sb->s_fs_info;
@@ -2016,6 +2015,15 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type,
20162015
err_put_super:
20172016
__bch2_fs_stop(c);
20182017
deactivate_locked_super(sb);
2018+
err:
2019+
/*
2020+
* On an inconsistency error in recovery we might see an -EROFS derived
2021+
* errorcode (from the journal), but we don't want to return that to
2022+
* userspace as that causes util-linux to retry the mount RO - which is
2023+
* confusing:
2024+
*/
2025+
if (bch2_err_matches(ret, EROFS) && ret != -EROFS)
2026+
ret = -EIO;
20192027
return ERR_PTR(bch2_err_class(ret));
20202028
}
20212029

0 commit comments

Comments
 (0)