diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-06-22 11:12:14 +0200 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-06-22 11:12:14 +0200 |
commit | 5657e8fa45cf230df278040c420fb80e06309d8f (patch) | |
tree | 7817e1bd6c9b721be85fe54a1aec6ef971d7d96b /drivers/md/dm-log.c | |
parent | dm: avoid unsupported spanning of md stripe boundaries (diff) | |
download | linux-5657e8fa45cf230df278040c420fb80e06309d8f.tar.xz linux-5657e8fa45cf230df278040c420fb80e06309d8f.zip |
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-log.c')
-rw-r--r-- | drivers/md/dm-log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index 6fa8ccf91c70..6352a9ad4446 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -416,7 +416,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, bitset_size, ti->limits.logical_block_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); |