]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.27 kernel
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Jun 2010 21:37:51 +0000 (14:37 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Jun 2010 21:37:51 +0000 (14:37 -0700)
queue-2.6.27/md-fix-read-balancing-in-raid1-and-raid10-on-drives-2tb.patch [new file with mode: 0644]
queue-2.6.27/md-raid1-fix-counting-of-write-targets.patch [new file with mode: 0644]
queue-2.6.27/md-set-mddev-readonly-flag-on-blkdev-blkroset-ioctl.patch [new file with mode: 0644]
queue-2.6.27/series

diff --git a/queue-2.6.27/md-fix-read-balancing-in-raid1-and-raid10-on-drives-2tb.patch b/queue-2.6.27/md-fix-read-balancing-in-raid1-and-raid10-on-drives-2tb.patch
new file mode 100644 (file)
index 0000000..fd69942
--- /dev/null
@@ -0,0 +1,55 @@
+From af3a2cd6b8a479345786e7fe5e199ad2f6240e56 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Sat, 8 May 2010 08:20:17 +1000
+Subject: md: Fix read balancing in RAID1 and RAID10 on drives > 2TB
+
+From: NeilBrown <neilb@suse.de>
+
+commit af3a2cd6b8a479345786e7fe5e199ad2f6240e56 upstream.
+
+read_balance uses a "unsigned long" for a sector number which
+will get truncated beyond 2TB.
+This will cause read-balancing to be non-optimal, and can cause
+data to be read from the 'wrong' branch during a resync.  This has a
+very small chance of returning wrong data.
+
+Reported-by: Jordan Russell <jr-list-2010@quo.to>
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/raid1.c  |    4 ++--
+ drivers/md/raid10.c |    2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/md/raid1.c
++++ b/drivers/md/raid1.c
+@@ -413,7 +413,7 @@ static void raid1_end_write_request(stru
+  */
+ static int read_balance(conf_t *conf, r1bio_t *r1_bio)
+ {
+-      const unsigned long this_sector = r1_bio->sector;
++      const sector_t this_sector = r1_bio->sector;
+       int new_disk = conf->last_used, disk = new_disk;
+       int wonly_disk = -1;
+       const int sectors = r1_bio->sectors;
+@@ -429,7 +429,7 @@ static int read_balance(conf_t *conf, r1
+  retry:
+       if (conf->mddev->recovery_cp < MaxSector &&
+           (this_sector + sectors >= conf->next_resync)) {
+-              /* Choose the first operation device, for consistancy */
++              /* Choose the first operational device, for consistancy */
+               new_disk = 0;
+               for (rdev = rcu_dereference(conf->mirrors[new_disk].rdev);
+--- a/drivers/md/raid10.c
++++ b/drivers/md/raid10.c
+@@ -490,7 +490,7 @@ static int raid10_mergeable_bvec(struct
+  */
+ static int read_balance(conf_t *conf, r10bio_t *r10_bio)
+ {
+-      const unsigned long this_sector = r10_bio->sector;
++      const sector_t this_sector = r10_bio->sector;
+       int disk, slot, nslot;
+       const int sectors = r10_bio->sectors;
+       sector_t new_distance, current_distance;
diff --git a/queue-2.6.27/md-raid1-fix-counting-of-write-targets.patch b/queue-2.6.27/md-raid1-fix-counting-of-write-targets.patch
new file mode 100644 (file)
index 0000000..830097e
--- /dev/null
@@ -0,0 +1,45 @@
+From 964147d5c86d63be79b442c30f3783d49860c078 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Tue, 18 May 2010 15:27:13 +1000
+Subject: md/raid1: fix counting of write targets.
+
+From: NeilBrown <neilb@suse.de>
+
+commit 964147d5c86d63be79b442c30f3783d49860c078 upstream.
+
+There is a very small race window when writing to a
+RAID1 such that if a device is marked faulty at exactly the wrong
+time, the write-in-progress will not be sent to the device,
+but the bitmap (if present) will be updated to say that
+the write was sent.
+
+Then if the device turned out to still be usable as was re-added
+to the array, the bitmap-based-resync would skip resyncing that
+block, possibly leading to corruption.  This would only be a problem
+if no further writes were issued to that area of the device (i.e.
+that bitmap chunk).
+
+Suitable for any pending -stable kernel.
+
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/raid1.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/md/raid1.c
++++ b/drivers/md/raid1.c
+@@ -879,9 +879,10 @@ static int make_request(struct request_q
+                       if (test_bit(Faulty, &rdev->flags)) {
+                               rdev_dec_pending(rdev, mddev);
+                               r1_bio->bios[i] = NULL;
+-                      } else
++                      } else {
+                               r1_bio->bios[i] = bio;
+-                      targets++;
++                              targets++;
++                      }
+               } else
+                       r1_bio->bios[i] = NULL;
+       }
diff --git a/queue-2.6.27/md-set-mddev-readonly-flag-on-blkdev-blkroset-ioctl.patch b/queue-2.6.27/md-set-mddev-readonly-flag-on-blkdev-blkroset-ioctl.patch
new file mode 100644 (file)
index 0000000..b6055b0
--- /dev/null
@@ -0,0 +1,71 @@
+From e2218350465e7e0931676b4849b594c978437bce Mon Sep 17 00:00:00 2001
+From: Dan Williams <dan.j.williams@intel.com>
+Date: Wed, 12 May 2010 08:25:37 +1000
+Subject: md: set mddev readonly flag on blkdev BLKROSET ioctl
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+commit e2218350465e7e0931676b4849b594c978437bce upstream.
+
+When the user sets the block device to readwrite then the mddev should
+follow suit.  Otherwise, the BUG_ON in md_write_start() will be set to
+trigger.
+
+The reverse direction, setting mddev->ro to match a set readonly
+request, can be ignored because the blkdev level readonly flag precludes
+the need to have mddev->ro set correctly.  Nevermind the fact that
+setting mddev->ro to 1 may fail if the array is in use.
+
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/md.c |   29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -4816,6 +4816,7 @@ static int md_ioctl(struct inode *inode,
+       int err = 0;
+       void __user *argp = (void __user *)arg;
+       mddev_t *mddev = NULL;
++      int ro;
+       if (!capable(CAP_SYS_ADMIN))
+               return -EACCES;
+@@ -4951,6 +4952,34 @@ static int md_ioctl(struct inode *inode,
+                       err = do_md_stop (mddev, 1, 1);
+                       goto done_unlock;
++              case BLKROSET:
++                      if (get_user(ro, (int __user *)(arg))) {
++                              err = -EFAULT;
++                              goto done_unlock;
++                      }
++                      err = -EINVAL;
++
++                      /* if the bdev is going readonly the value of mddev->ro
++                       * does not matter, no writes are coming
++                       */
++                      if (ro)
++                              goto done_unlock;
++
++                      /* are we are already prepared for writes? */
++                      if (mddev->ro != 1)
++                              goto done_unlock;
++
++                      /* transitioning to readauto need only happen for
++                       * arrays that call md_write_start
++                       */
++                      if (mddev->pers) {
++                              err = restart_array(mddev);
++                              if (err == 0) {
++                                      mddev->ro = 2;
++                                      set_disk_ro(mddev->gendisk, 0);
++                              }
++                      }
++                      goto done_unlock;
+       }
+       /*
index 9bb181c8823d47ef3560292859ecf1678a024585..b29b12cca02771afceb4723779f7a11413a0d2c5 100644 (file)
@@ -4,3 +4,6 @@ arcnet-limit-com20020-pci-id-matches-for-sohard-cards.patch
 powerpc-fix-handling-of-strncmp-with-zero-len.patch
 powerpc-pseries-only-call-start-cpu-when-a-cpu-is-stopped.patch
 powerpc-oprofile-fix-potential-buffer-overrun-in-op_model_cell.c.patch
+md-raid1-fix-counting-of-write-targets.patch
+md-fix-read-balancing-in-raid1-and-raid10-on-drives-2tb.patch
+md-set-mddev-readonly-flag-on-blkdev-blkroset-ioctl.patch