diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-06-22 05:12:14 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-06-22 05:12:14 -0400 |
commit | 5657e8fa45cf230df278040c420fb80e06309d8f (patch) | |
tree | 7817e1bd6c9b721be85fe54a1aec6ef971d7d96b /drivers/md/dm-table.c | |
parent | 8cbeb67ad50f7d68e5e83be2cb2284de8f9c03b5 (diff) |
dm: use i_size_read
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).
Cc: stable@kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index e9a73bb242b0..0e2210c0c168 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -388,7 +388,8 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md) | |||
388 | static int check_device_area(struct dm_dev_internal *dd, sector_t start, | 388 | static int check_device_area(struct dm_dev_internal *dd, sector_t start, |
389 | sector_t len) | 389 | sector_t len) |
390 | { | 390 | { |
391 | sector_t dev_size = dd->dm_dev.bdev->bd_inode->i_size >> SECTOR_SHIFT; | 391 | sector_t dev_size = i_size_read(dd->dm_dev.bdev->bd_inode) >> |
392 | SECTOR_SHIFT; | ||
392 | 393 | ||
393 | if (!dev_size) | 394 | if (!dev_size) |
394 | return 1; | 395 | return 1; |