Commit 83208cbf authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 8528bde1
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1939,8 +1939,7 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type,

	if (IS_ERR(sb)) {
		ret = PTR_ERR(sb);
		ret = bch2_err_class(ret);
		return ERR_PTR(ret);
		goto err;
	}

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