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

fix readdir bug #65

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

fix readdir bug #65

wants to merge 6 commits into from

Conversation

realchonk
Copy link
Owner

Could you please repeat what you did in #56 and show me the output?

@realchonk realchonk requested a review from asomers August 20, 2024 15:28
@asomers
Copy link
Collaborator

asomers commented Aug 20, 2024

Could you please repeat what you did in #56 and show me the output?

[2024-08-20T16:57:11Z DEBUG fuser::request] FUSE(  5) ino 0x0000000000000001 GETATTR
[2024-08-20T16:57:11Z DEBUG fuser::request] FUSE(  6) ino 0x0000000000000001 LOOKUP name ".snap"
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    12,
    1,
    [
        46,
    ],
)
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    12,
    2,
    [
        46,
        46,
    ],
)
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    16,
    5,
    [
        46,
        115,
        110,
        97,
        112,
    ],
)
[2024-08-20T16:57:11Z DEBUG fuser::request] FUSE(  7) ino 0x0000000000000003 GETATTR
[2024-08-20T16:57:11Z DEBUG fuser::request] FUSE(  8) ino 0x0000000000000001 LOOKUP name ".snap"
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    12,
    1,
    [
        46,
    ],
)
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    12,
    2,
    [
        46,
        46,
    ],
)
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    16,
    5,
    [
        46,
        115,
        110,
        97,
        112,
    ],
)
[2024-08-20T16:57:11Z DEBUG fuser::request] FUSE(  9) ino 0x0000000000000003 GETATTR
[2024-08-20T16:57:11Z DEBUG fuser::request] FUSE( 10) ino 0x0000000000000003 OPENDIR flags 0x0
[2024-08-20T16:57:11Z DEBUG fuser::request] FUSE( 11) ino 0x0000000000000003 READDIR fh FileHandle(0), offset 0, size 4096
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    12,
    1,
    [
        46,
    ],
)
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    500,
    2,
    [
        46,
        46,
    ],
)
[src/ufs.rs:374:3] (reclen, namelen, &name) = (
    0,
    0,
    [],
)
thread 'main' panicked at src/ufs.rs:375:19:
attempt to subtract with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed/library/std/src/panicking.rs:662:5
   1: core::panicking::panic_fmt
             at /rustc/2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed/library/core/src/panicking.rs:74:14
   2: core::panicking::panic_const::panic_const_sub_overflow
             at /rustc/2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed/library/core/src/panicking.rs:181:21
   3: fuse_ufs::ufs::readdir_block
             at ./src/ufs.rs:375:13
   4: fuse_ufs::ufs::Ufs::readdir
             at ./src/ufs.rs:243:12
   5: <fuse_ufs::ufs::Ufs as fuser::Filesystem>::readdir::{{closure}}
             at ./src/ufs.rs:481:4
   6: core::ops::function::FnOnce::call_once
             at /rustc/2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed/library/core/src/ops/function.rs:250:5
   7: fuse_ufs::ufs::run
             at ./src/ufs.rs:335:2
   8: <fuse_ufs::ufs::Ufs as fuser::Filesystem>::readdir
             at ./src/ufs.rs:491:9
   9: fuser::request::Request::dispatch_req
             at /home/somers/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.14.0/src/request.rs:364:17
  10: fuser::request::Request::dispatch
             at /home/somers/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.14.0/src/request.rs:57:25
  11: fuser::session::Session<FS>::run
             at /home/somers/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.14.0/src/session.rs:135:34
  12: fuser::mount2::{{closure}}
             at /home/somers/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.14.0/src/lib.rs:1017:78
  13: core::result::Result<T,E>::and_then
             at /rustc/2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed/library/core/src/result.rs:1346:22
  14: fuser::mount2
             at /home/somers/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuser-0.14.0/src/lib.rs:1017:5
  15: fuse_ufs::main
             at ./src/main.rs:19:2
  16: core::ops::function::FnOnce::call_once
             at /rustc/2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[2024-08-20T16:57:11Z WARN  fuser::reply] Reply not sent for operation 11, replying with I/O error
[2024-08-20T16:57:11Z INFO  fuser::session] Unmounted /mnt

@realchonk
Copy link
Owner Author

could you try again? I'm not sure where the error lies.
I'll try to replicate this error later on my machine.

@asomers
Copy link
Collaborator

asomers commented Aug 21, 2024

Now I see this:

[2024-08-21T13:30:06Z DEBUG fuser::request] FUSE( 16) ino 0x0000000000000003 GETATTR
[2024-08-21T13:30:06Z DEBUG fuser::request] FUSE( 17) ino 0x0000000000000003 READDIR fh FileHandle(0), offset 0, size 4096
[src/ufs.rs:382:3] (reclen, namelen, &name) = (
    12,
    1,
    [
        46,
    ],
)
[src/ufs.rs:382:3] (reclen, namelen, &name) = (
    500,
    2,
    [
        46,
        46,
    ],
)
[2024-08-21T13:30:06Z WARN  fuse_ufs::ufs] readdir_block(3): directory entry for inode 213485 has an invalid reclen of 0
[2024-08-21T13:30:06Z DEBUG fuser::request] FUSE( 18) ino 0x0000000000000003 READDIR fh FileHandle(0), offset 2, size 4096
[2024-08-21T13:30:06Z DEBUG fuser::request] FUSE( 19) ino 0x0000000000000003 RELEASEDIR fh FileHandle(0), flags 0x0, flush false, lock owner Some(LockOwner(10291))

@asomers
Copy link
Collaborator

asomers commented Aug 21, 2024

Now I see a similar message:

[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  2) ino 0x0000000000000001 GETATTR
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  3) ino 0x0000000000000001 LOOKUP name ".snap"
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  4) ino 0x0000000000000003 GETATTR
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  5) ino 0x0000000000000001 LOOKUP name ".snap"
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  6) ino 0x0000000000000003 GETATTR
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  7) ino 0x0000000000000003 OPENDIR flags 0x0
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  8) ino 0x0000000000000003 READDIR fh FileHandle(0), offset 0, size 4096
[2024-08-21T15:14:53Z ERROR fuse_ufs::ufs] readdir_block(3): invalid namelen for inode 213485
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE(  9) ino 0x0000000000000003 READDIR fh FileHandle(0), offset 2, size 4096
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 10) ino 0x0000000000000003 RELEASEDIR fh FileHandle(0), flags 0x0, flush false, lock owner Some(LockOwner(10585))
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 11) ino 0x0000000000000001 LOOKUP name ".snap"
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 12) ino 0x0000000000000003 GETATTR
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 13) ino 0x0000000000000003 OPENDIR flags 0x0
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 14) ino 0x0000000000000001 LOOKUP name ".snap"
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 15) ino 0x0000000000000001 STATFS
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 16) ino 0x0000000000000003 GETATTR
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 17) ino 0x0000000000000003 READDIR fh FileHandle(0), offset 0, size 4096
[2024-08-21T15:14:53Z ERROR fuse_ufs::ufs] readdir_block(3): invalid namelen for inode 213485
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 18) ino 0x0000000000000003 READDIR fh FileHandle(0), offset 2, size 4096
[2024-08-21T15:14:53Z DEBUG fuser::request] FUSE( 19) ino 0x0000000000000003 RELEASEDIR fh FileHandle(0), flags 0x0, flush false, lock owner Some(LockOwner(10585))

@realchonk
Copy link
Owner Author

Is it only for .snap, or can you reproduce it on other files? Could it be, that .snap has to be handled as a special case. Otherwise I can't really explain, why it doesn't work.

@asomers
Copy link
Collaborator

asomers commented Aug 21, 2024

I'm only seeing it for .snap . But I see dozens of other errors for other directories, like:

[2024-08-21T15:28:30Z WARN  fuse_ufs::ufs] invalid inode 3132188
[2024-08-21T15:28:30Z ERROR fuse_ufs::ufs] Error: Invalid argument (os error 22)

@realchonk
Copy link
Owner Author

While mounting my live UFS, I get similar 'invalid inode' warnings.
I'll investigate them later, once I have more time, as it seems to be a difficult bug.
One of these files is /boot/kernel.old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants