Zygo / bees

Best-Effort Extent-Same, a btrfs dedupe agent
GNU General Public License v3.0
669 stars 55 forks source link

crawl_transid fails #97

Open dim-geo opened 5 years ago

dim-geo commented 5 years ago

Hello,

I started bees on a file-system already occupied with many snapshots and this happened. The program continued to run. (Please have in mind that I don't use the default subvolume (5) and beesd wrote there its database. I don't know if this info helps or is related to the error)

Kernel version: Linux gentoo 4.14.78-ck

using the latest bees built from emerge 9999

19:41:00 gentoo beesd[29713]: crawl_transid[29744]: ---  END  TRACE --- exception ---
19:41:00 gentoo beesd[29713]: bees[29741]: Starting bees main loop...
19:41:00 gentoo beesd[29713]: crawl_transid[29744]:
19:41:00 gentoo beesd[29713]: crawl_transid[29744]: *** EXCEPTION ***
19:41:00 gentoo beesd[29713]: crawl_transid[29744]:         exception type std::system_error: BTRFS_IOC_TREE_SEARCH_V2: rv = readlink(path.c_str(), buf, size + 1): No such file or directory at fs.cc:850: No such file or directory
Ιαν 01 19:41:00 gentoo beesd[29713]: crawl_transid[29744]: ***
kakra commented 5 years ago

Bees needs to run from subvolume 5, and it also stores its database there. So it works as designed.

But if you didn't use the wrapper that actually mounts subvol 5, then it will fail to do anything useful. You need to run bees on subvol 5 for it to see all extents. Bees doesn't work on files, it works on the whole device and looks at extents. Thus it needs to see subvol 5.

Usually, this subvol will be mounted below the runtime directory structure /run/bees to keep it away from user accessible default folders.

Zygo commented 5 years ago

If you delete a snapshot while bees is running you will get a burst of those errors because bees will still have cached references to the now-deleted tree. This will stop when the cache is cleared (about once every 5 minutes given default btrfs mount options).

It's a known gotcha (https://zygo.github.io/bees/gotchas.html last paragraph).

Zygo commented 5 years ago

If you don't give bees subvol 5 you get a different exception:

2019-01-01 21:22:31 4231.4231<6> bees: btrfs send workaround disabled
2019-01-01 21:22:31 4231.4231<6> bees: set_root_path /tmp/
2019-01-01 21:22:31 4231.4231<6> bees: set_root_fd /tmp
2019-01-01 21:22:31 4231.4231<3> bees: set_root_fd /tmp
2019-01-01 21:22:31 4231.4231<3> bees: ---  END  TRACE --- exception ---
2019-01-01 21:22:31 4231.4231<3> bees: 
2019-01-01 21:22:31 4231.4231<3> bees: 
2019-01-01 21:22:31 4231.4231<3> bees: *** EXCEPTION ***
2019-01-01 21:22:31 4231.4231<3> bees:  exception type std::invalid_argument: root_fd_treeid = 41843 failed constraint check (root_fd_treeid == BTRFS_FS_TREE_OBJECTID) at bees-context.cc:924
2019-01-01 21:22:31 4231.4231<3> bees: ***
terminate called after throwing an instance of 'std::invalid_argument'
  what():  root_fd_treeid = 41843 failed constraint check (root_fd_treeid == BTRFS_FS_TREE_OBJECTID) at bees-context.cc:924

Note the BTRFS_FS_TREE_OBJECTID constraint check.

dim-geo commented 5 years ago

Thanks for the clarification! maybe it should be handled via #89 and closed.