mmap and FUSE on 32bit systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I had a user of my FUSE based filesystem report corruption while using
an app which used mmap for file IO on a Raspberry Pi 3B. Files would
be corrupted only if greater than 4GB. I replicated the behavior with
a simple test app[0] on a RPi2 using the latest Raspbian (Linux
raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l
GNU/Linux) and i686 Debian 9 in a VM (Linux debian 4.9.0-8-686 #1 SMP
Debian 4.9.144-3.1 (2019-02-19) i686 GNU/Linux).

What appears to happen is that after the offset reaches (st_size &
0xFFFFFFFF) bytes the FUSE server no longer receives write requests
for modified pages. If the file size is exactly 4GB it won't ever
receive a write. Reads still come in for all addresses and there are
no errors on the client's side.

Easiest way to reproduce is probably the following:

$ sudo apt install mergerfs
$ mkdir /tmp/mergerfs
$ sudo mergerfs -d -o allow_other,default_permissions ~/ /tmp/mergerfs
$ # in another shell
$ cd /tmp
$ wget https://gist.githubusercontent.com/trapexit/82187c6a74a3df66753caa74df8c8232/raw/47bb6f1085ca847c15c7c31a57f822c3b72ed982/mmap-test.c
$ gcc -D_FILE_OFFSET_BITS=64 -o mmap-test mmap-test.c
$ cd mergerfs
$ ../mmap-test 8
offset: 0x0
offset: 0x20000
offset: 0x40000
offset: 0x60000
offset: 0x80000
offset: 0xa0000
offset: 0xc0000
offset: 0xe0000
$ hexdump test.img
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0020000 0000 0000 0000 0000 0000 0000 0000 0000
*
100020000

In the mergerfs terminal you'll see libfuse debug info which should
include reads (and initially some writes).

[0] https://gist.githubusercontent.com/trapexit/82187c6a74a3df66753caa74df8c8232/raw/47bb6f1085ca847c15c7c31a57f822c3b72ed982/mmap-test.c



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux