OSDN Git Service

[PATCH] Fix possibly too long write in o2hb_setup_one_bio()
authorJan Kara <jack@suse.cz>
Wed, 10 Oct 2007 14:25:42 +0000 (16:25 +0200)
committerMark Fasheh <mark.fasheh@oracle.com>
Tue, 6 Nov 2007 23:35:35 +0000 (15:35 -0800)
We should subtract start of our IO from PAGE_CACHE_SIZE to get the right
length of the write we want to perform.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/cluster/heartbeat.c

index 9cc7c04..f02ccb3 100644 (file)
@@ -267,7 +267,7 @@ static struct bio *o2hb_setup_one_bio(struct o2hb_region *reg,
                current_page = cs / spp;
                page = reg->hr_slot_data[current_page];
 
-               vec_len = min(PAGE_CACHE_SIZE,
+               vec_len = min(PAGE_CACHE_SIZE - vec_start,
                              (max_slots-cs) * (PAGE_CACHE_SIZE/spp) );
 
                mlog(ML_HB_BIO, "page %d, vec_len = %u, vec_start = %u\n",