From: Tejun Heo <tj@kernel.org>
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 <tj@kernel.org>
Subject: [PATCH 1/4] block: restart partition scan after resizing a device
Date: Thu, 13 May 2010 17:56:43 +0200 [thread overview]
Message-ID: <1273766206-17402-2-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1273766206-17402-1-git-send-email-tj@kernel.org>
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.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ben Hutchings <ben@decadent.org.uk>
---
fs/partitions/check.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index e238ab2..f80a58d 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;
-
+rescan:
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter)))
delete_partition(disk, part->partno);
@@ -581,7 +581,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
/* add partitions */
for (p = 1; p < state->limit; p++) {
sector_t size, from;
-try_scan:
+
size = state->parts[p].size;
if (!size)
continue;
@@ -612,7 +612,8 @@ try_scan:
check_disk_size_change(disk, bdev);
bdev->bd_invalidated = 0;
}
- goto try_scan;
+ kfree(state);
+ goto rescan;
} else {
/*
* we can not ignore partitions of broken tables
--
1.6.4.2
next prev parent reply other threads:[~2010-05-13 15:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 15:56 [PATCHSET] libata: implement ->set_capacity() Tejun Heo
2010-05-13 15:56 ` Tejun Heo [this message]
2010-05-13 15:56 ` [PATCH 2/4] SCSI: implement sd_set_capacity() Tejun Heo
2010-05-13 15:56 ` [PATCH 3/4] libata: use the enlarged capacity after late HPA unlock Tejun Heo
2010-05-13 15:56 ` [PATCH 4/4] libata: implement on-demand HPA unlocking Tejun Heo
2010-05-13 16:06 ` [PATCHSET] libata: implement ->set_capacity() James Bottomley
2010-05-13 16:22 ` Tejun Heo
2010-05-13 16:38 ` James Bottomley
2010-05-13 16:54 ` Tejun Heo
2010-05-13 17:18 ` James Bottomley
2010-05-13 18:40 ` Tejun Heo
2010-05-13 17:13 ` Alan Cox
2010-05-13 17:40 ` Jens Axboe
2010-05-13 18:25 ` Tejun Heo
2010-05-15 13:22 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273766206-17402-2-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=James.Bottomley@suse.de \
--cc=ben@decadent.org.uk \
--cc=jeff@garzik.org \
--cc=jens.axboe@oracle.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).