LinearTapeFileSystem / ltfs

Reference implementation of the LTFS format Spec for stand alone tape drive
BSD 3-Clause "New" or "Revised" License
255 stars 76 forks source link

Unable to sync ltfs index manually using sg device #478

Closed tonyperk closed 3 months ago

tonyperk commented 3 months ago

Describe the bug I am trying to perform a setxattr on "ltfs.sync" but it fails when LTFS is mounted with an sg device (/dev/sg3). I would like to manually sync the tape index.

To Reproduce Steps to reproduce the behavior:

  1. ltfs -o devname=/dev/sg3 /mnt (tried with different options)
  2. Try to perform setxattr on /mnt with attribute "ltfs.sync"

Expected behavior Succeeds with value 0.

Desktop (please complete the following information):

piste-jp commented 3 months ago

Could you provide more specific information about step2?

piste-jp commented 3 months ago

On my bench, it works as expected.

OS: Ubuntu 22.04.4 (aarch64) Commit: 29b6f34@master

Operation

  1. Mount LTFS (with file backend for this confirmation)
    • ./ltfs-oss/bin/ltfs -o tape_backend=file -o verbose=303 -o devname=/home/piste/ltfstape ./mnt -f
  2. Open another window
  3. Create a file
    • touch ./mnt/aaa
  4. Touch ltfs.sync VEA
    • attr -s ltfs.sync -V 1 ./mnt

Operation Log

piste@ua64240232:~$ touch ./mnt/aaa
piste@ua64240232:~$ attr -s ltfs.sync -V 1 ./mnt
Attribute "ltfs.sync" set to a 1 byte value for ./mnt:
1
piste@ua64240232:~$ echo $?
0

Log of ltfs process

61fb LTFS14000I LTFS starting, LTFS version 2.5.0.0 (Prelim), log level 303.
61fb LTFS14058I LTFS Format Specification version 2.4.0.
61fb LTFS14104I Launched by "./ltfs-oss/bin/ltfs -o tape_backend=file -o verbose=303 -o devname=/home/piste/ltfstape ./mnt -f".
61fb LTFS14105I This binary is built for Linux (unknown).
61fb LTFS14106I GCC version is 11.4.0.
61fb LTFS17087I Kernel version: Linux version 5.15.0-113-generic (buildd@bos01-arm64-038) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #123-Ubuntu SMP Mon Jun 10 08:16:46 UTC 2024 unknown.
61fb LTFS17089I Distribution: DISTRIB_ID=Ubuntu.
61fb LTFS17089I Distribution: PRETTY_NAME="Ubuntu 22.04.4 LTS".
61fb LTFS14063I Sync type is "time", Sync time is 300 sec.
61fb LTFS17085I Plugin: Loading "file" tape backend.
61fb LTFS17085I Plugin: Loading "unified" iosched backend.
61fb LTFS14095I Set the tape device write-anywhere mode to avoid cartridge ejection.
61fb LTFS30000I Opening a device through generic file driver (/home/piste/ltfstape).
61fb LTFS30003I Opening a directory through generic file driver (/home/piste/ltfstape).
61fb LTFS12023D Reserving device.
61fb LTFS12028D Unlocking medium.
61fb LTFS30061E Cannot unlock medium: unit not ready.
61fb LTFS17160I Maximum device block size is 4194304.
61fb LTFS11330I Loading cartridge.
...
61fb LTFS17227I Tape attribute: Vendor = IBM     .
61fb LTFS17227I Tape attribute: Application Name = LTFS                            .
61fb LTFS17227I Tape attribute: Application Version = 2.5.0.0 .
61fb LTFS17227I Tape attribute: Medium Label = .
61fb LTFS17228I Tape attribute: Text Localization ID = 0x81.
61fb LTFS17227I Tape attribute: Barcode =                                 .
61fb LTFS17227I Tape attribute: Application Format Version = 2.4.0           .
61fb LTFS17228I Tape attribute: Volume Lock Status = 0x00.
61fb LTFS17227I Tape attribute: Media Pool name = .
61fb LTFS11031I Volume mounted successfully. NO_BARCODE : Gen = 1 / (a, 5) -> (b, 5) / DUMMY.
61fb LTFS14122I Index will not be captured.
61fb LTFS14111I Initial setup completed successfully.
61fb LTFS14112I Invoke 'mount' command to check the result of final setup.
61fb LTFS14113I Specified mount point is listed if succeeded.
61fe LTFS13015D Unified I/O scheduler initialized.
61fe LTFS14029I Ready to receive file system requests.
61fe LTFS17065D Periodic sync thread initialized.
61fe LTFS14040D FUSE create file '/aaa'.
61fe LTFS11337I Update index-dirty flag (1) - NO_BARCODE (0x0xaaaac48c8cc0).
61ff LTFS14037D FUSE flush '/aaa'.
61fe LTFS14038D FUSE set times '/aaa'.
61ff LTFS14037D FUSE flush '/aaa'.
61fe LTFS14035D FUSE release file '/aaa'.
61fe LTFS11338I Syncing index of NO_BARCODE DUMMY.
61fe LTFS17068I Syncing index of NO_BARCODE (Reason: Sync by EA) DUMMY.
61fe LTFS30197D Backend readattr: (0, 5667).
61fe LTFS11339D Read volume lock status (0).
61fe LTFS30197D Backend locate: (1, 18446744073709551615).
61fe LTFS17235I Writing index of NO_BARCODE to b (Reason: Sync by EA, 1 files) DUMMY.
61fe LTFS30028D Backend write file marks: 1 (at position=(1, 7), FMs 4).
61fe LTFS30197D Backend writeattr: (0, 9).
61fe LTFS30016D Backend write: 1411 bytes (at position=(1, 8), FMs 5).
61fe LTFS30028D Backend write file marks: 1 (at position=(1, 9), FMs 5).
61fe LTFS30197D Backend readattr: (0, 9).
61fe LTFS30197D Backend writeattr: (0, 2060).
61fe LTFS30197D Backend writeattr: (1, 2060).
61fe LTFS17236I Wrote index of NO_BARCODE (Gen = 2, Part = b, Pos = 8, DUMMY).
61fe LTFS11337I Update index-dirty flag (0) - NO_BARCODE (0x0xaaaac48c8cc0).
61fe LTFS17070I Synced index of NO_BARCODE (0) DUMMY.