]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.30 dm patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Tue, 30 Jun 2009 19:03:14 +0000 (12:03 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 30 Jun 2009 19:03:14 +0000 (12:03 -0700)
queue-2.6.30/dm-exception-store-fix-exstore-lookup-to-be-case-insensitive.patch [new file with mode: 0644]
queue-2.6.30/dm-mpath-flush-keventd-queue-in-destructor.patch [new file with mode: 0644]
queue-2.6.30/dm-mpath-validate-hw_handler-argument-count.patch [new file with mode: 0644]
queue-2.6.30/dm-mpath-validate-table-argument-count.patch [new file with mode: 0644]
queue-2.6.30/dm-sysfs-skip-output-when-device-is-being-destroyed.patch [new file with mode: 0644]
queue-2.6.30/dm-use-i_size_read.patch [new file with mode: 0644]
queue-2.6.30/series

diff --git a/queue-2.6.30/dm-exception-store-fix-exstore-lookup-to-be-case-insensitive.patch b/queue-2.6.30/dm-exception-store-fix-exstore-lookup-to-be-case-insensitive.patch
new file mode 100644 (file)
index 0000000..5c2ff89
--- /dev/null
@@ -0,0 +1,35 @@
+From f6bd4eb73cdf2a5bf954e497972842f39cabb7e3 Mon Sep 17 00:00:00 2001
+From: Jonathan Brassow <jbrassow@redhat.com>
+Date: Mon, 22 Jun 2009 10:12:15 +0100
+Subject: dm exception store: fix exstore lookup to be case insensitive
+
+From: Jonathan Brassow <jbrassow@redhat.com>
+
+commit f6bd4eb73cdf2a5bf954e497972842f39cabb7e3 upstream.
+
+When snapshots are created using 'p' instead of 'P' as the
+exception store type, the device-mapper table loading fails.
+
+This patch makes the code case insensitive as intended and fixes some
+regressions reported with device-mapper snapshots.
+
+Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
+Signed-off-by: Alasdair G Kergon <agk@redhat.com>
+Cc: Arjan van de Ven <arjan@infradead.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/dm-exception-store.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/md/dm-exception-store.c
++++ b/drivers/md/dm-exception-store.c
+@@ -216,7 +216,7 @@ int dm_exception_store_create(struct dm_
+               return -EINVAL;
+       }
+-      type = get_type(argv[1]);
++      type = get_type(&persistent);
+       if (!type) {
+               ti->error = "Exception store type not recognised";
+               r = -EINVAL;
diff --git a/queue-2.6.30/dm-mpath-flush-keventd-queue-in-destructor.patch b/queue-2.6.30/dm-mpath-flush-keventd-queue-in-destructor.patch
new file mode 100644 (file)
index 0000000..efc1310
--- /dev/null
@@ -0,0 +1,42 @@
+From 53b351f972a882ea8b6cdb19602535f1057c884a Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Mon, 22 Jun 2009 10:12:13 +0100
+Subject: dm mpath: flush keventd queue in destructor
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 53b351f972a882ea8b6cdb19602535f1057c884a upstream.
+
+The commit fe9cf30eb8186ef267d1868dc9f12f2d0f40835a moves dm table event
+submission from kmultipath queue to kernel kevent queue to avoid a
+deadlock.
+
+There is a possibility of race condition because kevent queue is not flushed
+in the multipath destructor. The scenario is:
+- some event happens and is queued to keventd
+- keventd thread is delayed due to scheuling latency or some other work
+- multipath device is destroyed
+- keventd now attempts to process work_struct that is residing in already
+  released memory.
+
+The patch flushes the keventd queue in multipath constructor.
+I've already fixed similar bug in dm-raid1.
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Alasdair G Kergon <agk@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/dm-mpath.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/md/dm-mpath.c
++++ b/drivers/md/dm-mpath.c
+@@ -847,6 +847,7 @@ static void multipath_dtr(struct dm_targ
+       flush_workqueue(kmpath_handlerd);
+       flush_workqueue(kmultipathd);
++      flush_scheduled_work();
+       free_multipath(m);
+ }
diff --git a/queue-2.6.30/dm-mpath-validate-hw_handler-argument-count.patch b/queue-2.6.30/dm-mpath-validate-hw_handler-argument-count.patch
new file mode 100644 (file)
index 0000000..187cb2d
--- /dev/null
@@ -0,0 +1,33 @@
+From e094f4f15f5169526c7200b9bde44b900548a81e Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Mon, 22 Jun 2009 10:12:10 +0100
+Subject: dm mpath: validate hw_handler argument count
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit e094f4f15f5169526c7200b9bde44b900548a81e upstream.
+
+Fix arg count parsing error in hw handlers.
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Alasdair G Kergon <agk@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/dm-mpath.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/md/dm-mpath.c
++++ b/drivers/md/dm-mpath.c
+@@ -699,6 +699,11 @@ static int parse_hw_handler(struct arg_s
+       if (!hw_argc)
+               return 0;
++      if (hw_argc > as->argc) {
++              ti->error = "not enough arguments for hardware handler";
++              return -EINVAL;
++      }
++
+       m->hw_handler_name = kstrdup(shift(as), GFP_KERNEL);
+       request_module("scsi_dh_%s", m->hw_handler_name);
+       if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {
diff --git a/queue-2.6.30/dm-mpath-validate-table-argument-count.patch b/queue-2.6.30/dm-mpath-validate-table-argument-count.patch
new file mode 100644 (file)
index 0000000..f95430a
--- /dev/null
@@ -0,0 +1,40 @@
+From 0e0497c0c017664994819f4602dc07fd95896c52 Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Mon, 22 Jun 2009 10:08:02 +0100
+Subject: dm mpath: validate table argument count
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 0e0497c0c017664994819f4602dc07fd95896c52 upstream.
+
+The parser reads the argument count as a number but doesn't check that
+sufficient arguments are supplied. This command triggers the bug:
+
+dmsetup create mpath --table "0 `blockdev --getsize /dev/mapper/cr0`
+    multipath 0 0 2 1 round-robin 1000 0 1 1 /dev/mapper/cr0
+    round-robin 0 1 1 /dev/mapper/cr1 1000"
+kernel BUG at drivers/md/dm-mpath.c:530!
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Alasdair G Kergon <agk@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/dm-mpath.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/md/dm-mpath.c
++++ b/drivers/md/dm-mpath.c
+@@ -553,6 +553,12 @@ static int parse_path_selector(struct ar
+               return -EINVAL;
+       }
++      if (ps_argc > as->argc) {
++              dm_put_path_selector(pst);
++              ti->error = "not enough arguments for path selector";
++              return -EINVAL;
++      }
++
+       r = pst->create(&pg->ps, ps_argc, as->argv);
+       if (r) {
+               dm_put_path_selector(pst);
diff --git a/queue-2.6.30/dm-sysfs-skip-output-when-device-is-being-destroyed.patch b/queue-2.6.30/dm-sysfs-skip-output-when-device-is-being-destroyed.patch
new file mode 100644 (file)
index 0000000..fe7471b
--- /dev/null
@@ -0,0 +1,36 @@
+From 4d89b7b4e4726893453d0fb4ddbb5b3e16353994 Mon Sep 17 00:00:00 2001
+From: Milan Broz <mbroz@redhat.com>
+Date: Mon, 22 Jun 2009 10:12:11 +0100
+Subject: dm: sysfs skip output when device is being destroyed
+
+From: Milan Broz <mbroz@redhat.com>
+
+commit 4d89b7b4e4726893453d0fb4ddbb5b3e16353994 upstream.
+
+Do not process sysfs attributes when device is being destroyed.
+
+Otherwise code can cause
+  BUG_ON(test_bit(DMF_FREEING, &md->flags));
+in dm_put() call.
+
+Signed-off-by: Milan Broz <mbroz@redhat.com>
+Signed-off-by: Alasdair G Kergon <agk@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/dm.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/md/dm.c
++++ b/drivers/md/dm.c
+@@ -1780,6 +1780,10 @@ struct mapped_device *dm_get_from_kobjec
+       if (&md->kobj != kobj)
+               return NULL;
++      if (test_bit(DMF_FREEING, &md->flags) ||
++          test_bit(DMF_DELETING, &md->flags))
++              return NULL;
++
+       dm_get(md);
+       return md;
+ }
diff --git a/queue-2.6.30/dm-use-i_size_read.patch b/queue-2.6.30/dm-use-i_size_read.patch
new file mode 100644 (file)
index 0000000..02c2f49
--- /dev/null
@@ -0,0 +1,62 @@
+From 5657e8fa45cf230df278040c420fb80e06309d8f Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Mon, 22 Jun 2009 10:12:14 +0100
+Subject: dm: use i_size_read
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 5657e8fa45cf230df278040c420fb80e06309d8f upstream.
+
+Use i_size_read() instead of reading i_size.
+
+If someone changes the size of the device simultaneously, i_size_read
+is guaranteed to return a valid value (either the old one or the new one).
+
+i_size can return some intermediate invalid value (on 32-bit computers
+with 64-bit i_size, the reads to both halves of i_size can be interleaved
+with updates to i_size, resulting in garbage being returned).
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Alasdair G Kergon <agk@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/md/dm-exception-store.h |    2 +-
+ drivers/md/dm-log.c             |    2 +-
+ drivers/md/dm-table.c           |    3 ++-
+ 3 files changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/md/dm-exception-store.h
++++ b/drivers/md/dm-exception-store.h
+@@ -156,7 +156,7 @@ static inline void dm_consecutive_chunk_
+  */
+ static inline sector_t get_dev_size(struct block_device *bdev)
+ {
+-      return bdev->bd_inode->i_size >> SECTOR_SHIFT;
++      return i_size_read(bdev->bd_inode) >> SECTOR_SHIFT;
+ }
+ static inline chunk_t sector_to_chunk(struct dm_exception_store *store,
+--- a/drivers/md/dm-log.c
++++ b/drivers/md/dm-log.c
+@@ -415,7 +415,7 @@ static int create_log_context(struct dm_
+               buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) +
+                                      bitset_size, ti->limits.hardsect_size);
+-              if (buf_size > dev->bdev->bd_inode->i_size) {
++              if (buf_size > i_size_read(dev->bdev->bd_inode)) {
+                       DMWARN("log device %s too small: need %llu bytes",
+                               dev->name, (unsigned long long)buf_size);
+                       kfree(lc);
+--- a/drivers/md/dm-table.c
++++ b/drivers/md/dm-table.c
+@@ -387,7 +387,8 @@ static void close_dev(struct dm_dev_inte
+ static int check_device_area(struct dm_dev_internal *dd, sector_t start,
+                            sector_t len)
+ {
+-      sector_t dev_size = dd->dm_dev.bdev->bd_inode->i_size >> SECTOR_SHIFT;
++      sector_t dev_size = i_size_read(dd->dm_dev.bdev->bd_inode) >>
++                          SECTOR_SHIFT;
+       if (!dev_size)
+               return 1;
index a6f9034527ee698cc848658aab932ba4bef89962..8dddc540b595551bee1767907127c5b9888cab8e 100644 (file)
@@ -91,3 +91,9 @@ pci-pm-fix-handling-of-devices-without-pm-support-by-pci_target_state.patch
 pci-pm-follow-pci_pm_ctrl_no_soft_reset-during-transitions-from-d3.patch
 qla2xxx-correct-overflow-during-dump-processing-on-large-memory-isp23xx-parts.patch
 mm-fix-handling-of-pagesets-for-downed-cpus.patch
+dm-mpath-validate-hw_handler-argument-count.patch
+dm-mpath-validate-table-argument-count.patch
+dm-sysfs-skip-output-when-device-is-being-destroyed.patch
+dm-mpath-flush-keventd-queue-in-destructor.patch
+dm-exception-store-fix-exstore-lookup-to-be-case-insensitive.patch
+dm-use-i_size_read.patch