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

3 duplicates of the file MEGAsync.cfg.bak in the same directory #498

Closed
Zesko opened this issue Jul 30, 2022 · 5 comments
Closed

3 duplicates of the file MEGAsync.cfg.bak in the same directory #498

Zesko opened this issue Jul 30, 2022 · 5 comments
Labels
question Not a bug, clarifications, undocumented behaviour

Comments

@Zesko
Copy link

Zesko commented Jul 30, 2022

I noticed there are 3 same file MEGAsync.cfg.bak, every file has the same checksum.
These duplicates were detected by restic backup process

find ~/ -name "*MEGAsync.cfg.bak*"
/home/zesko/.local/share/data/Mega Limited/MEGAsync/MEGAsync.cfg.bak
/home/zesko/.local/share/data/Mega Limited/MEGAsync/MEGAsync.cfg.bak
/home/zesko/.local/share/data/Mega Limited/MEGAsync/MEGAsync.cfg.bak

I deleted these duplicates, then restart of MEGAsync, but these same duplicates appear.
I deleted all BTRFS snapshots of home directory. That does not help, still 3 duplicates.

OS: Manjaro KDE (Latest version)
Linux Kernel: 5.18.15

megasync --version 
MEGAsync v4.6.7 (c4d241d)

Filesystem: Btrfs: btrfs-progs v5.18.1

@Zesko
Copy link
Author

Zesko commented Jul 30, 2022

Solution:

  1. I stopped MEGAsync process.
  2. I tried to move this directory /MEGAsync to the other partition EXT4.
    I got the error message:
$ mv "Mega Limited"/MEGAsync /Ext4/test
mv: cannot remove 'Mega Limited/MEGAsync/MEGAsync.cfg.bak': No such file or directory
mv: cannot remove 'Mega Limited/MEGAsync/MEGAsync.cfg.bak': No such file or directory
  1. Then I check with ls -al MEGAsync
$ ls -al "Mega Limited"/MEGAsync/
lsd: Mega Limited/MEGAsync/MEGAsync.cfg.bak: No such file or directory (os error 2).
lsd: Mega Limited/MEGAsync/MEGAsync.cfg.bak: No such file or directory (os error 2).
  1. I tried to delete the broken directory
$ sudo rm -rf MEGAsync
  1. Then I moved the directory back, then start MEGAsync process, the issue is gone. No duplicate.

Perhaps you can investigate why these duplicates had appeared?

@kdave
Copy link
Owner

kdave commented Aug 16, 2022

Is there some other layer involved? Like FUSE or overlayfs. Creating a file on regular filesystem is not supposed to work, it's serialized, a bug possibility is always there but there's not enough data to analyze why. If you see this again, please save output of mount, and ls -li. You can also check if the files exist when the service is not running.

@kdave kdave added the question Not a bug, clarifications, undocumented behaviour label Aug 16, 2022
@Zesko
Copy link
Author

Zesko commented Aug 16, 2022

@kdave

This duplicate of MEGA config file was in home directory in home subvolume that never uses other layer, e.g Overlayfs.

Home subvolume and root subvolume are separated in the same btrfs filesystem.

The root directory / is on Btrfs filesystem. I chose a read-only root-snapshot in GRUB to boot into Overlayfs, then restore this root-snapshot, but it has nothing to do with home subvolume.

Only this MEGA config file happened only once. Rest all fine, no duplicate.

I think that I first installed Linux Kernel 5.10 on my device using Btrfs, maybe it could cause this duplicate before upgrade many Linux Kernels ... to 5.18.

@Zygo
Copy link

Zygo commented Aug 16, 2022

In 5.14 there was a change that made duplicate dirents frequently during log tree replay, which was fixed in 5.16-rc1 (9a35fc9542fa btrfs: change error handling for btrfs_delete_*_in_log). The repro recipe is something like "do a lot of renames while the filesystem is busy flushing, then crash and run log tree replay on the next mount." Kernels before 5.14 could also produce duplicate dirents, but much less often.

If the machine has been running 5.14 at any point, then this is almost certainly the cause. If it was running earlier kernels then it's less likely, but still possible. The duplicate entries can be removed by deleting all other entries in the directory, then removing the directory.

@Zesko
Copy link
Author

Zesko commented Aug 16, 2022

If you want to know when it happened in the past

It happened in Linux Kernel 5.10
https://forum.manjaro.org/t/more-than-18-files-xorg-0-log-with-same-timestamp/91252

Linux Kernel 5.10.36
https://forum.manjaro.org/t/btrfs-kernel-bug-duplicate-file-names/68260

@Zesko Zesko closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Not a bug, clarifications, undocumented behaviour
Projects
None yet
Development

No branches or pull requests

3 participants