]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.drivers/bdev-resize-call-flush_disk
Revert "Move xen patchset to new version's subdir."
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.drivers / bdev-resize-call-flush_disk
CommitLineData
00e5a55c
BS
1Subject: Call flush_disk() after detecting an online resize.
2From: Andrew Patterson <andrew.patterson@hp.com>
3Date: Thu Oct 9 08:56:13 2008 +0200:
4Git: 608aeef17a91747d6303de4df5e2c2e6899a95e8
5References: FATE#302348,FATE#303786
6
7We call flush_disk() to make sure the buffer cache for the disk is
8flushed after a disk resize. There are two resize cases, growing and
9shrinking. Given that users can shrink/then grow a disk before
10revalidate_disk() is called, we treat the grow case identically to
11shrinking. We need to flush the buffer cache after an online shrink
12because, as James Bottomley puts it,
13
14 The two use cases for shrinking I can see are
15
16 1. planned: the fs is already shrunk to within the new boundaries
17 and all data is relocated, so invalidate is fine (any dirty
18 buffers that might exist in the shrunk region are there only
19 because they were relocated but not yet written to their
20 original location).
21 2. unplanned: In this case, the fs is probably toast, so whether
22 we invalidate or not isn't going to make a whole lot of
23 difference; it's still going to try to read or write from
24 sectors beyond the new size and get I/O errors.
25
26Immediately invalidating shrunk disks will cause errors for outstanding
27I/Os for reads/write beyond the new end of the disk to be generated
28earlier then if we waited for the normal buffer cache operation. It also
29removes a potential security hole where we might keep old data around
30from beyond the end of the shrunk disk if the disk was not invalidated.
31
32Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
33Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
34Signed-off-by: Hannes Reinecke <hare@suse.de>
35---
36 fs/block_dev.c | 1 +
37 1 file changed, 1 insertion(+)
38
39--- a/fs/block_dev.c
40+++ b/fs/block_dev.c
41@@ -918,6 +918,7 @@ void check_disk_size_change(struct gendi
42 "%s: detected capacity change from %lld to %lld\n",
43 name, bdev_size, disk_size);
44 i_size_write(bdev->bd_inode, disk_size);
45+ flush_disk(bdev);
46 }
47 }
48 EXPORT_SYMBOL(check_disk_size_change);