Skip to content

Commit

Permalink
ceph: fix file offset wrapping at 4GB on 32-bit archs
Browse files Browse the repository at this point in the history
Cast the value before shifting so that we don't run out of bits with a
32-bit unsigned long.  This fixes wrapping of high file offsets into the
low 4GB of a file on disk, and the subsequent data corruption for large
files.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed Sep 11, 2010
1 parent 3612abb commit a77d9f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ static int ceph_writepages_start(struct address_space *mapping,
/* ok */
if (locked_pages == 0) {
/* prepare async write request */
offset = page->index << PAGE_CACHE_SHIFT;
offset = (unsigned long long)page->index
<< PAGE_CACHE_SHIFT;
len = wsize;
req = ceph_osdc_new_request(&client->osdc,
&ci->i_layout,
Expand Down

0 comments on commit a77d9f7

Please sign in to comment.