From 2d67c1abec150306cd8106609617160d8955f6b7 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 17 May 2010 01:30:52 +0000 Subject: [PATCH] Update patches from Tejun Heo for HPA workaround svn path=/dists/sid/linux-2.6/; revision=15694 --- debian/changelog | 9 ++- ...estart-partition-scan-after-resizing.patch | 58 +++++++++++++------ ...invalidate_bdev-drain-all-add-caches.patch | 38 ++++++++++++ debian/patches/series/13 | 1 + 4 files changed, 84 insertions(+), 22 deletions(-) create mode 100644 debian/patches/bugfix/all/buffer-make-invalidate_bdev-drain-all-add-caches.patch diff --git a/debian/changelog b/debian/changelog index b00f1bda2..66c9a9501 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,9 +34,12 @@ linux-2.6 (2.6.32-13) UNRELEASED; urgency=low (Closes: #580710; works-around: #581173) * rtl8192su: Add IDs for several more devices (Closes: #580740) * Add drm and sfc changes from stable 2.6.33.4 - * SCSI/libata: Disable HPA if it overlaps a partition (Closes: #572618) - * partitions: Rescan partition tables after HPA is disabled - * libata: Disable HPA if it is only enabled after suspend + * Improve workaround for HPAs (Host Protected Areas) overlapping + partitions, thanks to Tejun Heo: + - SCSI/libata: Disable HPA if it overlaps a partition (Closes: #572618) + - buffer: Make invalidate_bdev() drain all percpu LRU add caches + - block: Rescan partition tables after HPA is disabled + - libata: Disable HPA if it is only enabled after suspend * V4L/DVB: budget: Select correct frontend drivers (Closes: #575223) * 3c503: Fix IRQ probing (Closes: #566522) * sis-agp: Remove SIS 760, handled by amd64-agp diff --git a/debian/patches/bugfix/all/block-restart-partition-scan-after-resizing.patch b/debian/patches/bugfix/all/block-restart-partition-scan-after-resizing.patch index ffa3c2c9f..23f95a7f9 100644 --- a/debian/patches/bugfix/all/block-restart-partition-scan-after-resizing.patch +++ b/debian/patches/bugfix/all/block-restart-partition-scan-after-resizing.patch @@ -1,32 +1,35 @@ From: Tejun Heo -To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org -Cc: ben@decadent.org.uk, Tejun Heo -Date: Thu, 13 May 2010 17:56:43 +0200 -Subject: [PATCH 1/4] block: restart partition scan after resizing a device +To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org, ben@decadent.org.uk, davem@davemloft.net, bzolnier@gmail.com +Cc: Tejun Heo +Date: Sat, 15 May 2010 20:09:28 +0200 +Subject: [PATCH 2/8] block: restart partition scan after resizing a device Device resize via ->set_capacity() can reveal new partitions (e.g. in chained partition table formats such as dos extended parts). Restart -partition scan from the beginning after resizing a device. +partition scan from the beginning after resizing a device. This +change also makes libata always revalidate the disk after resize which +makes lower layer native capacity unlocking implementation simpler and +more robust as resize can be handled in the usual path. Signed-off-by: Tejun Heo Reported-by: Ben Hutchings --- - fs/partitions/check.c | 7 ++++--- - 1 files changed, 4 insertions(+), 3 deletions(-) + fs/partitions/check.c | 16 ++++++---------- + 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/partitions/check.c b/fs/partitions/check.c -index e238ab2..f80a58d 100644 +index e238ab2..8f01df3 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c -@@ -550,7 +550,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) - res = invalidate_partition(disk, 0); - if (res) - return res; +@@ -544,7 +544,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) + struct hd_struct *part; + struct parsed_partitions *state; + int p, highest, res; - +rescan: - disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); - while ((part = disk_part_iter_next(&piter))) - delete_partition(disk, part->partno); + if (bdev->bd_part_count) + return -EBUSY; + res = invalidate_partition(disk, 0); @@ -581,7 +581,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) /* add partitions */ for (p = 1; p < state->limit; p++) { @@ -36,11 +39,28 @@ index e238ab2..f80a58d 100644 size = state->parts[p].size; if (!size) continue; -@@ -612,7 +612,8 @@ try_scan: - check_disk_size_change(disk, bdev); - bdev->bd_invalidated = 0; - } +@@ -596,7 +596,6 @@ try_scan: + + if (from + size > get_capacity(disk)) { + const struct block_device_operations *bdops = disk->fops; +- unsigned long long capacity; + + printk(KERN_WARNING + "%s: p%d size %llu exceeds device capacity, ", +@@ -605,14 +604,11 @@ try_scan: + if (bdops->set_capacity && + (disk->flags & GENHD_FL_NATIVE_CAPACITY) == 0) { + printk(KERN_CONT "enabling native capacity\n"); +- capacity = bdops->set_capacity(disk, ~0ULL); ++ bdops->set_capacity(disk, ~0ULL); + disk->flags |= GENHD_FL_NATIVE_CAPACITY; +- if (capacity > get_capacity(disk)) { +- set_capacity(disk, capacity); +- check_disk_size_change(disk, bdev); +- bdev->bd_invalidated = 0; +- } - goto try_scan; ++ /* free state and restart */ + kfree(state); + goto rescan; } else { diff --git a/debian/patches/bugfix/all/buffer-make-invalidate_bdev-drain-all-add-caches.patch b/debian/patches/bugfix/all/buffer-make-invalidate_bdev-drain-all-add-caches.patch new file mode 100644 index 000000000..9e5759e29 --- /dev/null +++ b/debian/patches/bugfix/all/buffer-make-invalidate_bdev-drain-all-add-caches.patch @@ -0,0 +1,38 @@ +From: Tejun Heo +To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org, ben@decadent.org.uk, davem@davemloft.net, bzolnier@gmail.com +Cc: Tejun Heo +Date: Sat, 15 May 2010 20:09:27 +0200 +Subject: [PATCH 1/8] buffer: make invalidate_bdev() drain all percpu LRU + add caches + +invalidate_bdev() should release all page cache pages which are clean +and not being used; however, if some pages are still in the percpu LRU +add caches on other cpus, those pages are considered in used and don't +get released. Fix it by calling lru_add_drain_all() before trying to +invalidate pages. + +This problem was discovered while testing block automatic native +capacity unlocking. Null pages which were read before automatic +unlocking didn't get released by invalidate_bdev() and ended up +interfering with partition scan after unlocking. + +Signed-off-by: Tejun Heo +--- + fs/buffer.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/fs/buffer.c b/fs/buffer.c +index c9c266d..08e422d 100644 +--- a/fs/buffer.c ++++ b/fs/buffer.c +@@ -275,6 +275,7 @@ void invalidate_bdev(struct block_device *bdev) + return; + + invalidate_bh_lrus(); ++ lru_add_drain_all(); /* make sure all lru add caches are flushed */ + invalidate_mapping_pages(mapping, 0, -1); + } + EXPORT_SYMBOL(invalidate_bdev); +-- +1.6.4.2 + diff --git a/debian/patches/series/13 b/debian/patches/series/13 index eccb60f44..871b4b881 100644 --- a/debian/patches/series/13 +++ b/debian/patches/series/13 @@ -23,6 +23,7 @@ + bugfix/all/stable/2.6.33.4.patch + bugfix/all/drm-i915-Stop-trying-to-use-ACPI-lid-status-to-deter-2.patch + features/arm/guruplug.patch ++ bugfix/all/buffer-make-invalidate_bdev-drain-all-add-caches.patch + bugfix/all/block-restart-partition-scan-after-resizing.patch - debian/sd-libata-set-capacity-abi-changes.patch + bugfix/all/SCSI-implement-sd_set_capacity.patch