fsck_ffs: don't try to write in read-only mode

Skip trying to change fs_mtime for SU+J if we are running read-only.

Reviewed by:    mckusick
Sponsored by:	Netflix
This commit is contained in:
Chuck Silvers 2021-06-29 14:29:15 -07:00
parent 2ef5995f49
commit ed1a156b03

View File

@ -441,17 +441,19 @@ checkfilesys(char *filesys)
sujrecovery = 0;
printf("** Skipping journal, falling through to full fsck\n\n");
}
/*
* Write the superblock so we don't try to recover the
* journal on another pass. If this is the only change
* to the filesystem, we do not want it to be called
* out as modified.
*/
sblock.fs_mtime = time(NULL);
sbdirty();
ofsmodified = fsmodified;
flush(fswritefd, &sblk);
fsmodified = ofsmodified;
if (fswritefd != -1) {
/*
* Write the superblock so we don't try to recover the
* journal on another pass. If this is the only change
* to the filesystem, we do not want it to be called
* out as modified.
*/
sblock.fs_mtime = time(NULL);
sbdirty();
ofsmodified = fsmodified;
flush(fswritefd, &sblk);
fsmodified = ofsmodified;
}
}
/*
* If the filesystem was run on an old kernel that did not