2.4.36-stable kernel tree
リビジョン | fe07ebe07a96e9e8b7cdf742779a726e169bbb15 (tree) |
---|---|
日時 | 2007-06-06 15:24:30 |
作者 | Willy Tarreau <w@1wt....> |
コミッター | Willy Tarreau |
[PATCH] lvm: update to latest fixes from the LVM package
greg@enjellic.com suggested to apply the recommended patches from
the LVM package, as every LVM user will have to generate them and
apply them anyway. Heinz Mauelshagen agreed, except for the list_del
chunk in the snapshot code which was identified as responsible for
oopses encountered in RHEL3.
Now with this patch in 2.4, it should be safe(r) to not apply the
LVM patches anymore.
@@ -45,6 +45,7 @@ extern int loadtime; | ||
45 | 45 | extern const char *const lvm_name; |
46 | 46 | |
47 | 47 | |
48 | +extern uint vg_count; | |
48 | 49 | extern vg_t *vg[]; |
49 | 50 | extern struct file_operations lvm_chr_fops; |
50 | 51 |
@@ -547,15 +547,17 @@ int lvm_snapshot_alloc_hash_table(lv_t * lv) | ||
547 | 547 | |
548 | 548 | int lvm_snapshot_alloc(lv_t * lv_snap) |
549 | 549 | { |
550 | - int ret; | |
550 | + int ret, max_sectors; | |
551 | 551 | |
552 | 552 | /* allocate kiovec to do chunk io */ |
553 | 553 | ret = alloc_kiovec(1, &lv_snap->lv_iobuf); |
554 | 554 | if (ret) |
555 | 555 | goto out; |
556 | 556 | |
557 | - ret = lvm_snapshot_alloc_iobuf_pages(lv_snap->lv_iobuf, | |
558 | - KIO_MAX_SECTORS); | |
557 | + max_sectors = KIO_MAX_SECTORS << (PAGE_SHIFT - 9); | |
558 | + | |
559 | + ret = | |
560 | + lvm_snapshot_alloc_iobuf_pages(lv_snap->lv_iobuf, max_sectors); | |
559 | 561 | if (ret) |
560 | 562 | goto out_free_kiovec; |
561 | 563 |
@@ -1584,10 +1584,8 @@ static int lvm_do_vg_create(void *arg, int minor) | ||
1584 | 1584 | minor = vg_ptr->vg_number; |
1585 | 1585 | |
1586 | 1586 | /* check limits */ |
1587 | - if (minor >= ABS_MAX_VG) { | |
1588 | - kfree(vg_ptr); | |
1587 | + if (minor >= ABS_MAX_VG) | |
1589 | 1588 | return -EFAULT; |
1590 | - } | |
1591 | 1589 | |
1592 | 1590 | /* Validate it */ |
1593 | 1591 | if (vg[VG_CHR(minor)] != NULL) { |
@@ -1655,7 +1653,8 @@ static int lvm_do_vg_create(void *arg, int minor) | ||
1655 | 1653 | P_IOCTL |
1656 | 1654 | ("ERROR: copying LV ptr %p (%d bytes)\n", |
1657 | 1655 | lvp, sizeof(lv_t)); |
1658 | - goto copy_fault; | |
1656 | + lvm_do_vg_remove(minor); | |
1657 | + return -EFAULT; | |
1659 | 1658 | } |
1660 | 1659 | if (lv.lv_access & LV_SNAPSHOT) { |
1661 | 1660 | snap_lv_ptr[ls] = lvp; |
@@ -1666,7 +1665,8 @@ static int lvm_do_vg_create(void *arg, int minor) | ||
1666 | 1665 | vg_ptr->lv[l] = NULL; |
1667 | 1666 | /* only create original logical volumes for now */ |
1668 | 1667 | if (lvm_do_lv_create(minor, lv.lv_name, &lv) != 0) { |
1669 | - goto copy_fault; | |
1668 | + lvm_do_vg_remove(minor); | |
1669 | + return -EFAULT; | |
1670 | 1670 | } |
1671 | 1671 | } |
1672 | 1672 | } |
@@ -1676,10 +1676,12 @@ static int lvm_do_vg_create(void *arg, int minor) | ||
1676 | 1676 | for (l = 0; l < ls; l++) { |
1677 | 1677 | lv_t *lvp = snap_lv_ptr[l]; |
1678 | 1678 | if (copy_from_user(&lv, lvp, sizeof(lv_t)) != 0) { |
1679 | - goto copy_fault; | |
1679 | + lvm_do_vg_remove(minor); | |
1680 | + return -EFAULT; | |
1680 | 1681 | } |
1681 | 1682 | if (lvm_do_lv_create(minor, lv.lv_name, &lv) != 0) { |
1682 | - goto copy_fault; | |
1683 | + lvm_do_vg_remove(minor); | |
1684 | + return -EFAULT; | |
1683 | 1685 | } |
1684 | 1686 | } |
1685 | 1687 |
@@ -1694,10 +1696,6 @@ static int lvm_do_vg_create(void *arg, int minor) | ||
1694 | 1696 | vg_ptr->vg_status |= VG_ACTIVE; |
1695 | 1697 | |
1696 | 1698 | return 0; |
1697 | -copy_fault: | |
1698 | - lvm_do_vg_remove(minor); | |
1699 | - vfree(snap_lv_ptr); | |
1700 | - return -EFAULT; | |
1701 | 1699 | } /* lvm_do_vg_create() */ |
1702 | 1700 | |
1703 | 1701 |
@@ -2689,10 +2687,6 @@ static int lvm_do_lv_status_byname(vg_t * vg_ptr, void *arg) | ||
2689 | 2687 | (&lv_status_byname_req.lv->lv_current_pe, |
2690 | 2688 | &saved_ptr1, sizeof(void *)) != 0) |
2691 | 2689 | return -EFAULT; |
2692 | - if (copy_to_user | |
2693 | - (&lv_status_byname_req.lv->lv_block_exception, | |
2694 | - &saved_ptr2, sizeof(void *)) != 0) | |
2695 | - return -EFAULT; | |
2696 | 2690 | return 0; |
2697 | 2691 | } |
2698 | 2692 | } |
@@ -2747,10 +2741,6 @@ static int lvm_do_lv_status_byindex(vg_t * vg_ptr, void *arg) | ||
2747 | 2741 | (&lv_status_byindex_req.lv->lv_current_pe, &saved_ptr1, |
2748 | 2742 | sizeof(void *)) != 0) |
2749 | 2743 | return -EFAULT; |
2750 | - if (copy_to_user | |
2751 | - (&lv_status_byindex_req.lv->lv_block_exception, &saved_ptr2, | |
2752 | - sizeof(void *)) != 0) | |
2753 | - return -EFAULT; | |
2754 | 2744 | |
2755 | 2745 | return 0; |
2756 | 2746 | } /* lvm_do_lv_status_byindex() */ |
@@ -2809,10 +2799,6 @@ static int lvm_do_lv_status_bydev(vg_t * vg_ptr, void *arg) | ||
2809 | 2799 | (&lv_status_bydev_req.lv->lv_current_pe, &saved_ptr1, |
2810 | 2800 | sizeof(void *)) != 0) |
2811 | 2801 | return -EFAULT; |
2812 | - if (copy_to_user | |
2813 | - (&lv_status_bydev_req.lv->lv_block_exception, &saved_ptr2, | |
2814 | - sizeof(void *)) != 0) | |
2815 | - return -EFAULT; | |
2816 | 2802 | |
2817 | 2803 | return 0; |
2818 | 2804 | } /* lvm_do_lv_status_bydev() */ |