patch-2.4.7 linux/drivers/md/lvm.c
Next file: linux/drivers/md/raid5.c
Previous file: linux/drivers/isdn/tpam/tpam_main.c
Back to the patch index
Back to the overall index
- Lines: 32
- Date:
Wed Jul 11 16:35:37 2001
- Orig file:
v2.4.6/linux/drivers/md/lvm.c
- Orig date:
Sat Apr 21 10:37:16 2001
diff -u --recursive --new-file v2.4.6/linux/drivers/md/lvm.c linux/drivers/md/lvm.c
@@ -988,6 +988,10 @@
case LV_BMAP:
/* turn logical block into (dev_t, block). non privileged. */
+ /* don't bmap a snapshot, since the mapping can change */
+ if (lv_ptr->lv_access & LV_SNAPSHOT)
+ return -EPERM;
+
return lvm_user_bmap(inode, (struct lv_bmap *) arg);
break;
@@ -1075,8 +1079,8 @@
return -EFAULT;
memset(&bh,0,sizeof bh);
- bh.b_rsector = block;
- bh.b_dev = bh.b_rdev = inode->i_dev;
+ bh.b_blocknr = block;
+ bh.b_dev = bh.b_rdev = inode->i_rdev;
bh.b_size = lvm_get_blksize(bh.b_dev);
if ((err=lvm_map(&bh, READ)) < 0) {
printk("lvm map failed: %d\n", err);
@@ -1084,7 +1088,8 @@
}
return put_user(kdev_t_to_nr(bh.b_rdev), &user_result->lv_dev) ||
- put_user(bh.b_rsector, &user_result->lv_block) ? -EFAULT : 0;
+ put_user(bh.b_rsector/(bh.b_size>>9), &user_result->lv_block) ?
+ -EFAULT : 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)