When running fsck_ffs(8) in background ensure that a superblock has been read.

Reported by:  Mikhail T.
PR:	      271352
MFC after:    1 week
Sponsored by: The FreeBSD Foundation
This commit is contained in:
Kirk McKusick 2023-05-25 18:56:22 -07:00
parent 0f2bb40bc7
commit 4b08a62ed4
2 changed files with 10 additions and 3 deletions

View File

@ -711,7 +711,10 @@ setup_bkgrdchk(struct statfs *mntp, int sbreadfailed, char **filesys)
}
free(sblock.fs_csp);
free(sblock.fs_si);
havesb = 0;
if (readsb() == 0) {
pwarn("CANNOT READ SNAPSHOT SUPERBLOCK\n");
return (0);
}
*filesys = snapname;
cmd.version = FFS_CMD_VERSION;
cmd.handle = fsreadfd;

View File

@ -88,8 +88,12 @@ setup(char *dev)
* We are expected to have an open file descriptor and a superblock.
*/
if (fsreadfd < 0 || havesb == 0) {
if (debug)
printf("setup: bad fsreadfd or missing superblock\n");
if (debug) {
if (fsreadfd < 0)
printf("setup: missing fsreadfd\n");
else
printf("setup: missing superblock\n");
}
return (0);
}
if (preen == 0)