Summary: | [dump] dump(8) can read garbage and loop forever | ||
---|---|---|---|
Product: | Base System | Reporter: | Eugene Grosbein <eugen> |
Component: | bin | Assignee: | freebsd-stable (Nobody) <stable> |
Status: | Closed Works As Intended | ||
Severity: | Affects Some People | CC: | fs, longwitz, mckusick |
Priority: | --- | ||
Version: | 11.1-STABLE | ||
Hardware: | Any | ||
OS: | Any |
Description
Eugene Grosbein
2018-05-11 22:21:20 UTC
Are you are dumping on a live filesystem? If so, is it possible that the file causing the problem is being written at the time that dump is trying to dump it? If so, then dump may read it in an inconsistent state (e.g., it has allocated, but not yet initialised one of its indirect blocks (hence the garbage value to see when it reads the not-yet initialised block. The reason for dumping a snapshot is to ensure that you get a consistent view of the filesystem. (In reply to Kirk McKusick from comment #1) Yes, this is mounted and live file system and files are created here. Does UFS2+SU snapshot guarantee that dump won't get uninitialized indirection blocks from the file system if snapshot creation occurs at same moment? I still believe dump should not loop forever and should perform some sanity checks on indirection blocks. Taking a snapshot is the same as if you unmounted the filesystem and dumped it. When you take a snapshot, the following steps are taken: 1) Any new system calls that want to write to the filesystem are suspended. 2) All system calls currently writing to the filesystem are allowed to finish. 3) All dirty blocks are flushed to the filesystem. 4) A snapshot of the fully flushed filesystem is taken. 5) The suspended system calls are awaken, but none of their changes appear in the snapshot. The dump of the snapshot therefore gets a consistent view of the filesystem. The date of the snapshot is recorded, so that when you later take a level-1 dump (using another snapshot) you get exactlty the changes between the two snapshots. Putting in error checking for every possible inconsistency is a massive undertaking. And the resulting dumps are inconsistent and prone to all sort of errors when you attempt to restore from them. That is why snapshots were added as they allow consistent and correct dumps to be made on a live system. |