summaryrefslogtreecommitdiff
path: root/sys/gnu/fs
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2000-07-24 05:28:33 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2000-07-24 05:28:33 +0000
commit9b97113391a63a82eeac6ccbbdf607f67bce1d08 (patch)
tree62690c6f979cb730f89f23fa1d8a48b3b0fc7626 /sys/gnu/fs
parent3adc8b3d1d5a8ce84f17b396ef9ccc3edf14f94e (diff)
Notes
Diffstat (limited to 'sys/gnu/fs')
-rw-r--r--sys/gnu/fs/ext2fs/ext2_bmap.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_bmap.c b/sys/gnu/fs/ext2fs/ext2_bmap.c
index ab4ac5295c98..40fdd65be291 100644
--- a/sys/gnu/fs/ext2fs/ext2_bmap.c
+++ b/sys/gnu/fs/ext2fs/ext2_bmap.c
@@ -147,7 +147,18 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
num = *nump;
if (num == 0) {
*bnp = blkptrtodb(ump, ip->i_db[bn]);
- if (*bnp == 0) {
+ /*
+ * Since this is FFS independent code, we are out of
+ * scope for the definitions of BLK_NOCOPY and
+ * BLK_SNAP, but we do know that they will fall in
+ * the range 1..um_seqinc, so we use that test and
+ * return a request for a zeroed out buffer if attempts
+ * are made to read a BLK_NOCOPY or BLK_SNAP block.
+ */
+ if ((ip->i_flags & SF_SNAPSHOT) &&
+ ip->i_db[bn] > 0 && ip->i_db[bn] < ump->um_seqinc) {
+ *bnp = -1;
+ } else if (*bnp == 0) {
if (ip->i_flags & SF_SNAPSHOT)
*bnp = blkptrtodb(ump, bn * ump->um_seqinc);
else
@@ -230,6 +241,17 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
if (bp)
bqrelse(bp);
+ /*
+ * Since this is FFS independent code, we are out of scope for the
+ * definitions of BLK_NOCOPY and BLK_SNAP, but we do know that they
+ * will fall in the range 1..um_seqinc, so we use that test and
+ * return a request for a zeroed out buffer if attempts are made
+ * to read a BLK_NOCOPY or BLK_SNAP block.
+ */
+ if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc){
+ *bnp = -1;
+ return (0);
+ }
*bnp = blkptrtodb(ump, daddr);
if (*bnp == 0) {
if (ip->i_flags & SF_SNAPSHOT)