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

restore: "We seem to be looping" can get lost #59

Open
chrysn opened this issue Aug 23, 2017 · 7 comments
Open

restore: "We seem to be looping" can get lost #59

chrysn opened this issue Aug 23, 2017 · 7 comments
Labels
bug
Projects

Comments

@chrysn
Copy link

@chrysn chrysn commented Aug 23, 2017

when btrfs restore is run with output redirection (which i'd assume not to be uncommon due to the amount of output), the "We seem to be looping" message can get lost in the buffers. (the operator would be confused by the lack of progress, but not see any indication of a question being asked in the logs of stdout or stderr; i only found the issue because i straced the presumably hanging process).

a fflush(stdout) after the again: jump mark in cmds-restore.c should do the trick. it might be worth considering to write the messages (the question and the loop question) to stderr instead, which afaik should be unbuffered anyway.

@kdave kdave added the bug label Aug 25, 2017
@kdave kdave added this to TODO in Fixes Feb 27, 2018
@lakeman
Copy link

@lakeman lakeman commented Mar 18, 2018

Blocking for user input during a restore is a bad idea anyway IMHO. Files with a lot of churn like logs and databases can easily hit the current loop counter limit.
Obviously we should be defensive against any kind of broken filesystem, but can we actually detect the kinds of looping problems we need to deal with?
Or at least provide a command line flag to suppress the prompt?
Plus I believe that there is another bug here as we are assuming that stdin is not being buffered. Leading the user to add a line-feed to the input, which is assumed to mean STOP for the next prompt.

@tomato42
Copy link
Contributor

@tomato42 tomato42 commented May 3, 2018

if the checksums are correct, why report it at all?

@lakeman
Copy link

@lakeman lakeman commented May 4, 2018

A hypothetical software bug could have created a valid circular loop in the filesystem?

@tomato42
Copy link
Contributor

@tomato42 tomato42 commented May 4, 2018

unlike the quite common hardware failure?

if software bug really is a possibility, provide a switch for a last resort attempt, but if everything works exactly as designed on the software side, there's no point in bothering the user

@lakeman
Copy link

@lakeman lakeman commented May 4, 2018

btrfs restore is the last resort, when everything else has failed. So it should be as defensive as possible to anything that any version of btrfs, past or future, might have done to the on disk structure.

@tomato42
Copy link
Contributor

@tomato42 tomato42 commented May 4, 2018

is the documentation outdated then?

https://btrfs.wiki.kernel.org/index.php/Btrfsck

  • btrfs restore will help you copy data off a broken btrfs filesystem. See its page: Restore
  • btrfs check --repair, aka btrfsck is your last option if the ones above have not worked.
@unquietwiki
Copy link

@unquietwiki unquietwiki commented Jun 1, 2019

This issue still exists in 5.1. *static enum loop_response ask_to_continue(const char file) in https://github.com/kdave/btrfs-progs/blob/master/cmds-restore.c ; probably need to add a static int as a boolean to add a 4th option.

unquietwiki added a commit to unquietwiki/btrfs-progs that referenced this issue Jun 1, 2019
Attempt to fix Issue kdave#59
unquietwiki added a commit to unquietwiki/btrfs-progs that referenced this issue Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Fixes
TODO
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.