diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index e94b18eb5385eb0a47b7a15596b33f24c595b76d..7959d3c34d2017993ea62b25266db45392021666 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -478,9 +478,18 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr, ret = nilfs_btnode_submit_block(btnc, ptr, 0, REQ_OP_READ, 0, &bh, &submit_ptr); if (ret) { - if (ret != -EEXIST) - return ret; - goto out_check; + if (likely(ret == -EEXIST)) + goto out_check; + if (ret == -ENOENT) { + /* + * Block address translation failed due to invalid + * value of 'ptr'. In this case, return internal code + * -EINVAL (broken bmap) to notify bmap layer of fatal + * metadata corruption. + */ + ret = -EINVAL; + } + return ret; } if (ra) {