Giter Club home page Giter Club logo

Comments (14)

mandree avatar mandree commented on August 11, 2024

This is the corresponding mount.exfat-fuse -d log for a "find" run on the root directory:

unique: 3275, opcode: OPENDIR (27), nodeid: 4, insize: 48, pid: 13107
   unique: 3275, success, outsize: 32
unique: 3276, opcode: RELEASEDIR (29), nodeid: 4, insize: 64, pid: 0
   unique: 3276, success, outsize: 16
unique: 3277, opcode: LOOKUP (1), nodeid: 4, insize: 49, pid: 13107
LOOKUP /DCIM/13460623
getattr /DCIM/13460623
   NODEID: 29
   unique: 3277, success, outsize: 144
unique: 3278, opcode: OPENDIR (27), nodeid: 29, insize: 48, pid: 13107
   unique: 3278, success, outsize: 32
unique: 3279, opcode: READDIR (28), nodeid: 29, insize: 80, pid: 13107
readdir[0] from 0
BUG: invalid cluster number 0.

from exfat.

relan avatar relan commented on August 11, 2024

Thanks for a good bugreport! Please run exfatfsck from the issue41 branch and post the output here. It contains additional diagnostic and should not abort.

from exfat.

mandree avatar mandree commented on August 11, 2024

This is the debug output, 579 lines. I need to reformat the card now, but I'm keeping a full image of the b0rked partition. Note that issue #42 is from the same FS. Concluding note from extfatfsck now is shown below, and is a figure that's much too low.

Totally 56 directories and 98 files.
File system checking finished. ERRORS FOUND: 1.

fsck-issue41-575bbe18.txt

from exfat.

mandree avatar mandree commented on August 11, 2024

Please note: It appears that the fuse module is now overly picky and will not show the contents of the DCIM directory any more at all because of the faulty sub-directory, where 1.2.4 still can list it. See excerpts from fuse/mount.exfat-fuse -d /dev/sdj1 as of 575bbe1:

...
DEBUG: entry 40030008 c61c0000 00000200 00000000 00000000 67120200 00000200 00000000.
DEBUG: entry 41005f00 32003200 38003000 37003300 5f000000 00000000 00000000 00000000.
FUSE library version: 2.9.2
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.23
flags=0x0003f7fb
max_readahead=0x00020000
   INIT: 7.19
   flags=0x00000031
   max_readahead=0x00020000
   max_write=0x00020000
   max_background=0
   congestion_threshold=0
   unique: 1, success, outsize: 40
unique: 2, opcode: STATFS (17), nodeid: 1, insize: 40, pid: 6173
statfs /
   unique: 2, success, outsize: 96
...
LOOKUP /DCIM
getattr /DCIM
   NODEID: 113
   unique: 231, success, outsize: 144
unique: 232, opcode: OPENDIR (27), nodeid: 113, insize: 48, pid: 9047
   unique: 232, success, outsize: 32
unique: 233, opcode: READDIR (28), nodeid: 113, insize: 80, pid: 9047
readdir[0] from 0
DEBUG: entry 8502eac7 10000000 0f9ae948 0f9ae948 0f9ae948 00000000 00000000 00000000.
DEBUG: entry c0010008 bebb0000 00000200 00000000 00000000 577e0200 00000200 00000000.
...
DEBUG: entry 85024c55 10000000 4e13d748 4e13d748 4e13d748 00000000 00000000 00000000.
DEBUG: entry c0010008 9bf30000 00000000 00000000 00000000 00000000 00000000 00000000.
DEBUG: entry c1003100 33003400 36003000 36003200 33000000 00000000 00000000 00000000.
ERROR: '13460623' directory points to invalid cluster 0.
ERROR: failed to open directory '/DCIM'.
   unique: 233, error: -5 (Input/output error), outsize: 16
unique: 234, opcode: RELEASEDIR (29), nodeid: 113, insize: 64, pid: 0
   unique: 234, success, outsize: 16
unique: 235, opcode: GETATTR (3), nodeid: 113, insize: 56, pid: 9047
getattr /DCIM
   unique: 235, success, outsize: 120
unique: 236, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 9047
   unique: 236, success, outsize: 32
unique: 237, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
   unique: 237, success, outsize: 16
unique: 238, opcode: LOOKUP (1), nodeid: 1, insize: 48, pid: 9047
LOOKUP /MP_ROOT
getattr /MP_ROOT
   NODEID: 114
   unique: 238, success, outsize: 144
unique: 239, opcode: OPENDIR (27), nodeid: 114, insize: 48, pid: 9047
   unique: 239, success, outsize: 32
unique: 240, opcode: READDIR (28), nodeid: 114, insize: 80, pid: 9047
readdir[0] from 0
DEBUG: entry 8502764e 10000000 4e067048 4e067048 4e067048 00000000 00000000 00000000.
DEBUG: entry c0010008 83f40000 00000200 00000000 00000000 3c020000 00000200 00000000.
DEBUG: entry c1003100 30003000 41004e00 56003000 31000000 00000000 00000000 00000000.
...

from exfat.

mandree avatar mandree commented on August 11, 2024

Also, for comparison, I have patched libexfat on the master branch locally to make it continue, and I get a quite different count of directories and files when compared to the issue41 branch. I am attaching the patch for your information, I do not currently propose to apply it beyond debugging:

fsck/exfatfsck /dev/sdj1 
exfatfsck 1.2.4
Checking file system on /dev/sdj1.
File system version           1.0
Sector size                 512 bytes
Cluster size                128 KB
Volume size                  59 GB
Used space                   57 GB
Available space            2593 MB
ERROR: [13460623] failed to read directory cluster 0.
Totally 85 directories and 3288 files.
File system checking finished. ERRORS FOUND: 1.

0001-Do-not-abort-on-directories-with-cluster-0.patch.txt

from exfat.

relan avatar relan commented on August 11, 2024

The problematic entry is 13460623 directory with 0 size and 0 start cluster. When I added such entry to a test volume, chkdsk from Windows 7 failed with

Error while checking files and directories.

Anyway, such directory is gracefully handled by Windows exFAT driver (user won't notice anything wrong).

I have patched libexfat on the master branch locally to make it continue, and I get a quite different count of directories and files when compared to the issue41 branch

That's expected because in issue41 branch the error is detected earlier. Yeah, not the best UX.

What's the exact model of this Sony camera?

from exfat.

mandree avatar mandree commented on August 11, 2024

The model is a RX-10, but parts of the card may have been written by an RX100-II or on Linux with an older version of the exfat driver (Ubuntu 14.04.X LTS at the time, or a somewhat newer release). For me the crucial point is "a fully patched Windows 7 Pro chkdsk /F does not complain/repair".

I figured that my cheapo hama 00114839 card writer with USB ID 05e3:0732 "Genesys Logic, Inc. All-in-One Cardreader" may also have its share, it's extremely flakey in USB 3.0 SuperSpeed mode and sometimes loses reads and the kernel needs to reset it, and it's somewhat more stable in HiSpeed mode on a USB 2.0 port. This triggers I/O errors and aborted file reads. Gotta replace that, too, and until then only use it for R/O access.

from exfat.

relan avatar relan commented on August 11, 2024

So, is it the cardreader that "created" this zero-sized directory?

from exfat.

mandree avatar mandree commented on August 11, 2024

I don't know. I have a full image of the file system if what we're dumping isn't the whole picture. Getting back to your July 29 comment, where you wrote that your Windows 7 chkdsk is complaining, but mine isn't, we're obviously looking at a situation where either we don't have the same version of chkdsk and/or exfat drivers in Windows, or where the situation you recreated, and the situation that used to be on my memory card, are not the same. I still have an image of the memory card, so I can dig up more if needed.

Also note that even if the cardreader aborted in the middle of a write or something, the same situation can also happen with faulty contacts inside a camera, a worn-out SDXC card, or thereabouts, so I wouldn't want to focus on the origin of the corruption.

from exfat.

relan avatar relan commented on August 11, 2024

Have you experienced this error after you've reformatted your SD card?

from exfat.

mandree avatar mandree commented on August 11, 2024

No I haven't seem similar issues yet, and I've replaced my card reader, too.

Still I propose that a file system driver handles corruption gracefully. It's not as if it a fs driver could make ANY assumption about the 1,000 variants of embedded firmware that writes exfat, gets somehow interrupted (for instance faulty battery in a camera, possibly out in the cold) and what gazillion other reasons can cause this.

from exfat.

relan avatar relan commented on August 11, 2024

Still I propose that a file system driver handles corruption gracefully.

Sure. Driver should never crash, no matter how much currupted an FS is. I've updated issue41 branch to return I/O error on attempt to open a 0-sized directory. Will push this change into v1.2.5.

from exfat.

relan avatar relan commented on August 11, 2024

Fix released in v1.2.5. Let's move on to other issues.

from exfat.

mandree avatar mandree commented on August 11, 2024

Fix confirmed on the broken image in v1.2.5. Thank you!

...
LOOKUP /DCIM/13460623
getattr /DCIM/13460623
   NODEID: 3055
   unique: 3238, success, outsize: 144
unique: 3239, opcode: OPENDIR (27), nodeid: 3055, insize: 48, pid: 13920
   unique: 3239, success, outsize: 32
unique: 3240, opcode: READDIR (28), nodeid: 3055, insize: 80, pid: 13920
readdir[0] from 0
ERROR: '13460623' directory starts with invalid cluster 0.
ERROR: failed to open directory '/DCIM/13460623'.
   unique: 3240, error: -5 (Input/output error), outsize: 16
unique: 3241, opcode: RELEASEDIR (29), nodeid: 3055, insize: 64, pid: 0
   unique: 3241, success, outsize: 16
...

FTR, the fix is in commit 575ba4b.

from exfat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.