diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/buffer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index bff571dc7bc3..bcabb69e7462 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3015,8 +3015,16 @@ void guard_bio_eod(int op, struct bio *bio) sector_t maxsector; struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1]; unsigned truncated_bytes; + struct hd_struct *part; + + rcu_read_lock(); + part = __disk_get_part(bio->bi_disk, bio->bi_partno); + if (part) + maxsector = part_nr_sects_read(part); + else + maxsector = get_capacity(bio->bi_disk); + rcu_read_unlock(); - maxsector = get_capacity(bio->bi_disk); if (!maxsector) return; |