growfs: allow operation on RW-mounted filesystems

growfs supports growing mounted filesystems (writes are temporarily
suspended while the grow happens).  Drop the check for fs_clean == 0
to restore this case.  Leave fs_flags check for FS_UNCLEAN or
FS_NEEDSFSCK which represent the state of the filesystem when it was
mounted, and fsck should be run first if they are set.

PR:		253754
Reviewed by:	mckusick
MFC after:	3 days
Fixes:		6eb925f845 ("Filesystem utilities that modify the...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29021
This commit is contained in:
Ed Maste 2021-03-02 17:35:48 -05:00
parent 78991a93eb
commit 0dcde5cc12

View File

@ -1461,10 +1461,9 @@ main(int argc, char **argv)
} }
} }
/* /*
* Check for unclean filesystem. * Check for filesystem that was unclean at mount time.
*/ */
if (fs->fs_clean == 0 || if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0)
(fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0)
errx(1, "%s is not clean - run fsck.\n", *argv); errx(1, "%s is not clean - run fsck.\n", *argv);
memcpy(&osblock, fs, fs->fs_sbsize); memcpy(&osblock, fs, fs->fs_sbsize);
free(fs); free(fs);