Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Created February 12, 2015 21:44
Show Gist options
  • Save invisiblek/21bba82b6551dd50a867 to your computer and use it in GitHub Desktop.
Save invisiblek/21bba82b6551dd50a867 to your computer and use it in GitHub Desktop.
diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c
index 87ee542..26d65a8 100644
--- a/fs_mgr/fs_mgr.c
+++ b/fs_mgr/fs_mgr.c
@@ -449,6 +449,8 @@ int fs_mgr_do_mount(struct fstab *fstab, char *n_name, char *n_blk_device,
int mount_errors = 0;
int first_mount_errno = 0;
char *m;
+ int cmp_len;
+ char *detected_fs_type;
if (!fstab) {
return ret;
@@ -475,8 +477,16 @@ int fs_mgr_do_mount(struct fstab *fstab, char *n_name, char *n_blk_device,
}
if (fstab->recs[i].fs_mgr_flags & MF_CHECK) {
- check_fs(n_blk_device, fstab->recs[i].fs_type,
- fstab->recs[i].mount_point);
+ /* Skip file system check unless we are sure we are the right type */
+ detected_fs_type = blkid_get_tag_value(NULL, "TYPE", fstab->recs[i].blk_device);
+ if (detected_fs_type) {
+ cmp_len = (!strncmp(detected_fs_type, "ext", 3) &&
+ strlen(detected_fs_type) == 4) ? 3 : strlen(detected_fs_type);
+ if (!strncmp(fstab->recs[i].fs_type, detected_fs_type, cmp_len)) {
+ check_fs(n_blk_device, fstab->recs[i].fs_type,
+ fstab->recs[i].mount_point);
+ }
+ }
}
if ((fstab->recs[i].fs_mgr_flags & MF_VERIFY) &&
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment