Skip to content

Fix a pile of 4GB file problems on 32-bit

Matthew Wilcox (Oracle) ceph-devel linux-btrfs linux-fsdevel lkml ocfs2-devel stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/79P: Cast to loff_t before multiplyingfs/9p/vfs_file.c+2 -23 replies
2/7buffer: Promote to unsigned long long before shiftingfs/buffer.c+1 -10 replies
3/7ceph: Promote to unsigned long long before shiftingfs/ceph/addr.c+1 -12 replies
4/7ocfs2: Promote to unsigned long long before shiftingfs/ocfs2/alloc.c+1 -10 replies
5/7btrfs: Promote to unsigned long long before shiftingfs/btrfs/ioctl.c+3 -32 replies
6/7btrfs: Promote to unsigned long long before shiftingfs/btrfs/raid56.c+1 -14 replies
7/7btrfs: Promote to unsigned long long before multiplyingfs/btrfs/scrub.c+16 -91 reply

Reviews trailers per patch

3 of 7 patches have a Reviewed-by or Acked-by.

PatchJeff LaytonJosef Bacik
1/7
2/7
3/7R-b
4/7
5/7R-b
6/7R-b
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] Fix a pile of 4GB file problems on 32-bit

I caught a bug in my own code where I forgot to cast to loff_t before shifting. So I thought I'd grep around and see if I could find any other occurrences. I found a few that were clearly bugs, and they're fixed below. There are other places where we don't cast, and I think they're OK. For example, some places we have a 'nr_pages' being shifted by PAGE_SHIFT, and that's probably OK because it's probably a single I/O.

Also, I didn't touch AFFS or ROMFS or some other filesystems which probably have never seen a 4GB file in their lives. Might be worth fixing to be sure nobody copies bad code from them, but not worth cc'ing stable for.

I didn't look for SECTOR_SHIFT or SECTOR_SIZE (or bare 9/512), just PAGE_SIZE and PAGE_SHIFT.

I can't find a GCC warning to enable for this pattern, so I filed
https://urldefense.com/v3/__https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97287__;!!GqivPVa7Brio!JmJRfLO1W1WY_UNpWJIfK5J2F0viNTrZ3l7xIrCKzl03yThvlPmVBeZHbHY6hZu2IJ2u7Q$

Matthew Wilcox (Oracle) (7):
9P: Cast to loff_t before multiplying
buffer: Promote to unsigned long long before shifting
ceph: Promote to unsigned long long before shifting
ocfs2: Promote to unsigned long long before shifting
btrfs: Promote to unsigned long long before shifting
btrfs: Promote to unsigned long long before shifting
btrfs: Promote to unsigned long long before multiplying

 fs/9p/vfs_file.c  |  4 ++--
 fs/btrfs/ioctl.c  |  6 +++---
 fs/btrfs/raid56.c |  2 +-
 fs/btrfs/scrub.c  | 25 ++++++++++++++++---------
 fs/buffer.c       |  2 +-
 fs/ceph/addr.c    |  2 +-
 fs/ocfs2/alloc.c  |  2 +-
 7 files changed, 25 insertions(+), 18 deletions(-)
Signature · 1 line
2.28.0