Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'll' operations fail when writeback cache is enabled #323

Closed
Roay opened this issue Nov 16, 2018 · 16 comments
Closed

'll' operations fail when writeback cache is enabled #323

Roay opened this issue Nov 16, 2018 · 16 comments

Comments

@Roay
Copy link

Roay commented Nov 16, 2018

Using FUSE3.2.6 to create file system, create a file on the mount directory, the file size is 1G. Format the file and mount it to the directory. After a few seconds, see the directory through the "ll" command.

#df -h 
fuse_hello1          1.0G  1.0G     0 100% /root/libfuse-fuse-3.2.6/example/fileDir

#ll -h /root/libfuse-fuse-3.2.6/example/fileDir
total 512K
-rw-r--r-- 1 root root 1.0G Nov 16 15:46 file

#mkfs.xfs /root/libfuse-fuse-3.2.6/example/fileDir/file
#mount /root/libfuse-fuse-3.2.6/example/fileDir/file /root/libfuse-fuse-3.2.6/example/mountDir
  • When writeback cache is enabled, the error occurs.
#ll /root/libfuse-fuse-3.2.6/example/mountDir
ls: cannot access mountDir: Input/output error
  • When writeback cache is disabled, successful.
# ll mountDir/
total 0

enable writeback_cache:conn->want |= FUSE_CAP_WRITEBACK_CACHE;
Incorrect usage or other reasons?

@Nikratio
Copy link
Contributor

Thanks for the report! What file system are you using? Are you able to reproduce the problem with examples/passthrough_ll.c? Most likely the problem is in the filesystem rather than libfuse.

@Roay
Copy link
Author

Roay commented Nov 16, 2018

linux kernel:4.18
FS: xfs

@Roay
Copy link
Author

Roay commented Nov 16, 2018

Sorry, I can't understand the description of "passthrough_ll.c", so I can't reproduce the problem, but you can easily reproduce the problem according to my code. Thank you.

@Nikratio
Copy link
Contributor

Nikratio commented Nov 16, 2018

I'm sorry, but I do not have enough time to review this. Unless you have some clear evidence that the problem is in libfuse rather than your code, I can't justify spending time on investigating further.

@Roay
Copy link
Author

Roay commented Nov 19, 2018

When I use examples/passthrough_ll.c starting at the root file system to reproduce the problem, An error occurred while executing the mkfs.xfs command.

# ll -h file1G 
-rwxrwxrwx 1 root root 1.0G Nov 19 10:03 file1G
# 
# mkfs.xfs file1G 
meta-data=file1G                 isize=512    agcount=4, agsize=65536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=262144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
mkfs.xfs: pwrite64 failed: Invalid argument

What is the reason?

@Nikratio
Copy link
Contributor

Could you please provide detailed, step-by-step instructions for reproducing this problem?

On my system:

$ example/passthrough_ll ~/tmp/mnt &
[1] 12963

$ dd if=/dev/zero of=bigfile bs=1k seek=1024k count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.000100174 s, 10.2 MB/s

$ ls -lh bigfile 
-rw-r--r-- 1 nikratio nikratio 1.1G Nov 19 12:36 bigfile

$ mkfs.xfs bigfile 
meta-data=bigfile                isize=512    agcount=4, agsize=65536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0, reflink=0
data     =                       bsize=4096   blocks=262144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$

@Roay
Copy link
Author

Roay commented Nov 19, 2018

# gcc -Wall passthrough_ll.c `pkg-config fuse3 --cflags --libs` -o passthrough_ll
# 
# ll -h passthrough_ll
-rwxr-xr-x 1 root root 25K Nov 19 20:46 passthrough_ll
# ./passthrough_ll fileDir/
# cd fileDir/

# dd if=/dev/zero of=bigfile bs=1k seek=1024k count=1
dd: failed to truncate to 1073741824 bytes in output file ‘bigfile’: Function not implemented

# dd if=/dev/zero of=bigfile bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 11.9256 s, 90.0 MB/s

# mkfs.xfs bigfile 
meta-data=bigfile                isize=512    agcount=4, agsize=65536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=262144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
mkfs.xfs: pwrite64 failed: Invalid argument

@Roay
Copy link
Author

Roay commented Nov 19, 2018

But in other directory (non mounted directory), like "/mnt".

# pwd
/mnt

# dd if=/dev/zero of=bigfile bs=1k seek=1k seek=1024k count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.000477441 s, 2.1 MB/s

# ll -h
total 4.0K
-rw-r--r-- 1 root root 1.1G Nov 19 20:59 bigfile

@Nikratio
Copy link
Contributor

Please update to libfuse 3.3 and try again.

@Roay
Copy link
Author

Roay commented Nov 20, 2018

Sorry, under the fuse3.3 version, dd if=/dev/zero of=bigfile bs=1k seek=1k seek=1024k count=1 executed successfully, but mkfs.xfs still reported errors.

# pkg-config --modversion fuse
3.3.0
# dd if=/dev/zero of=bigfile bs=1k seek=1024k count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.00049762 s, 2.1 MB/s
# ll bigfile -h
-rw-r--r-- 1 root root 1.1G Nov 20 09:19 bigfile
# mkfs.xfs bigfile 
meta-data=bigfile                isize=512    agcount=4, agsize=65536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=262144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
mkfs.xfs: pwrite64 failed: Invalid argument
  • The fuse debug info(./passthrough_ll testDir/ -d):
    unique: 572, opcode: LOOKUP (1), nodeid: 1, insize: 48, pid: 27241
    lo_lookup(parent=1, name=bigfile)
    1/bigfile -> 140583473656976
    unique: 572, success, outsize: 144
    unique: 573, opcode: LOOKUP (1), nodeid: 1, insize: 48, pid: 27512
    lo_lookup(parent=1, name=bigfile)
    1/bigfile -> 140583473656976
    unique: 573, success, outsize: 144
    unique: 574, opcode: OPEN (14), nodeid: 140583473656976, insize: 48, pid: 27512
    lo_open(ino=140583473656976, flags=32768)
    unique: 574, success, outsize: 32
    ...
    unique: 658, opcode: IOCTL (39), nodeid: 140583473656976, insize: 72, pid: 27512
    unique: 658, error: -38 (Function not implemented), outsize: 16

    unique: 659, opcode: WRITE (16), nodeid: 140583473656976, insize: 128080, pid: 27512
    lo_write(ino=140583473656976, size=128000, off=0)
    unique: 660, opcode: WRITE (16), nodeid: 140583473656976, insize: 3152, pid: 27512
    lo_write(ino=140583473656976, size=3072, off=128000)
    unique: 659, success, outsize: 24
    unique: 660, error: -22 (Invalid argument), outsize: 16
    unique: 661, opcode: FLUSH (25), nodeid: 140583473656976, insize: 64, pid: 27512
    unique: 661, success, outsize: 16
    unique: 662, opcode: RELEASE (18), nodeid: 140583473656976, insize: 64, pid: 0
    unique: 662, success, outsize: 16

@Nikratio
Copy link
Contributor

Could you please provide detailed, step-by-step instructions for reproducing this problem?

@Roay
Copy link
Author

Roay commented Nov 20, 2018

# gcc -Wall passthrough_ll.c `pkg-config fuse3 --cflags --libs` -o passthrough_ll
# ll -h passthrough_ll
-rwxr-xr-x 1 root root 36K Nov 20 19:57 passthrough_ll
# ./passthrough_ll testDir/
# cd testDir/
# dd if=/dev/zero of=bigfile bs=1k seek=1024k count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.000579427 s, 1.8 MB/s
# ll -h bigfile 
-rw-r--r-- 1 root root 1.1G Nov 20 20:00 bigfile
# mkfs.xfs bigfile 
meta-data=bigfile                isize=512    agcount=4, agsize=65536 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=262144, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
mkfs.xfs: pwrite64 failed: Invalid argument

@Roay
Copy link
Author

Roay commented Nov 20, 2018

# uname -r
4.18.15-1.el7.elrepo.x86_64
# pkg-config --modversion fuse
3.3.0
# python3 -V
Python 3.6.5
# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)

@Roay
Copy link
Author

Roay commented Nov 22, 2018

The same problem occurs on Ubuntu16.04

@Nikratio
Copy link
Contributor

Looks like on your system mkfs.xfs tries to use an ioctl which isn't available.. maybe the xfsutils version makes a difference?

$ mkfs.xfs -V
mkfs.xfs version 4.9.0

@Roay
Copy link
Author

Roay commented Nov 24, 2018

In CentOS 7, the latest version only supports mkfs.xfs version 4.5.0
https://pkgs.org/download/xfsprogs

Does this mean CentOS7.x can't use the libfuse3.x?

@Roay Roay closed this as completed Dec 6, 2018
spectral54 pushed a commit to spectral54/libfuse that referenced this issue Sep 14, 2022
I plan to use this matcher for some future `jj add` command (for
libfuse#323). The idea is that we'll do a path-restricted walk of the working
copy based on the intersection of the sparse patterns and any patterns
specified by the user. However, I think it will be useful before that,
for @arxanas's fsmonitor feature (libfuse#362).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants