hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/nilfs2/bmap.c
....@@ -67,20 +67,28 @@
6767
6868 down_read(&bmap->b_sem);
6969 ret = bmap->b_ops->bop_lookup(bmap, key, level, ptrp);
70
- if (ret < 0) {
71
- ret = nilfs_bmap_convert_error(bmap, __func__, ret);
70
+ if (ret < 0)
7271 goto out;
73
- }
72
+
7473 if (NILFS_BMAP_USE_VBN(bmap)) {
7574 ret = nilfs_dat_translate(nilfs_bmap_get_dat(bmap), *ptrp,
7675 &blocknr);
7776 if (!ret)
7877 *ptrp = blocknr;
78
+ else if (ret == -ENOENT) {
79
+ /*
80
+ * If there was no valid entry in DAT for the block
81
+ * address obtained by b_ops->bop_lookup, then pass
82
+ * internal code -EINVAL to nilfs_bmap_convert_error
83
+ * to treat it as metadata corruption.
84
+ */
85
+ ret = -EINVAL;
86
+ }
7987 }
8088
8189 out:
8290 up_read(&bmap->b_sem);
83
- return ret;
91
+ return nilfs_bmap_convert_error(bmap, __func__, ret);
8492 }
8593
8694 int nilfs_bmap_lookup_contig(struct nilfs_bmap *bmap, __u64 key, __u64 *ptrp,