Disable fuid features
[zfs.git] / module / zfs / zfs_vfsops.c
index 80cdb21..14411b8 100644 (file)
 #include "zfs_comutil.h"
 
 #ifdef HAVE_ZPL
-extern int sys_shutdown;
-
-static char *noatime_cancel[] = { MNTOPT_ATIME, NULL };
-static char *atime_cancel[] = { MNTOPT_NOATIME, NULL };
-static char *noxattr_cancel[] = { MNTOPT_XATTR, NULL };
-static char *xattr_cancel[] = { MNTOPT_NOXATTR, NULL };
-
-/*
- * MO_DEFAULT is not used since the default value is determined
- * by the equivalent property.
- */
-static mntopt_t mntopts[] = {
-       { MNTOPT_NOXATTR, noxattr_cancel, NULL, 0, NULL },
-       { MNTOPT_XATTR, xattr_cancel, NULL, 0, NULL },
-       { MNTOPT_NOATIME, noatime_cancel, NULL, 0, NULL },
-       { MNTOPT_ATIME, atime_cancel, NULL, 0, NULL }
-};
-
-static mntopts_t zfs_mntopts = {
-       sizeof (mntopts) / sizeof (mntopt_t),
-       mntopts
-};
 
 /*ARGSUSED*/
 int
@@ -97,16 +75,7 @@ zfs_sync(vfs_t *vfsp, short flag, cred_t *cr)
         * Data integrity is job one.  We don't want a compromised kernel
         * writing to the storage pool, so we never sync during panic.
         */
-       if (panicstr)
-               return (0);
-
-       /*
-        * SYNC_ATTR is used by fsflush() to force old filesystems like UFS
-        * to sync metadata, which they would otherwise cache indefinitely.
-        * Semantically, the only requirement is that the sync be initiated.
-        * The DMU syncs out txgs frequently, so there's nothing to do.
-        */
-       if (flag & SYNC_ATTR)
+       if (unlikely(oops_in_progress))
                return (0);
 
        if (vfsp != NULL) {
@@ -119,14 +88,19 @@ zfs_sync(vfs_t *vfsp, short flag, cred_t *cr)
                ZFS_ENTER(zfsvfs);
                dp = dmu_objset_pool(zfsvfs->z_os);
 
+#ifdef HAVE_SHUTDOWN
                /*
                 * If the system is shutting down, then skip any
                 * filesystems which may exist on a suspended pool.
+                *
+                * XXX: This can be implemented using the Linux reboot
+                *      notifiers: {un}register_reboot_notifier().
                 */
                if (sys_shutdown && spa_suspended(dp->dp_spa)) {
                        ZFS_EXIT(zfsvfs);
                        return (0);
                }
+#endif /* HAVE_SHUTDOWN */
 
                if (zfsvfs->z_log != NULL)
                        zil_commit(zfsvfs->z_log, 0);
@@ -1004,6 +978,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs)
        kmem_free(zfsvfs, sizeof (zfsvfs_t));
 }
 
+#ifdef HAVE_FUID_FEATURES
 static void
 zfs_set_fuid_feature(zfsvfs_t *zfsvfs)
 {
@@ -1018,6 +993,7 @@ zfs_set_fuid_feature(zfsvfs_t *zfsvfs)
        }
        zfsvfs->z_use_sa = USE_SA(zfsvfs->z_version, zfsvfs->z_os);
 }
+#endif /* HAVE_FUID_FEATURES */
 
 int
 zfs_domount(vfs_t *vfsp, char *osname)
@@ -1059,6 +1035,7 @@ zfs_domount(vfs_t *vfsp, char *osname)
        vfsp->vfs_fsid.val[0] = fsid_guid;
        vfsp->vfs_fsid.val[1] = ((fsid_guid>>32) << 8);
 
+#ifdef HAVE_FUID_FEATURES
        /*
         * Set features for file system.
         */
@@ -1072,6 +1049,7 @@ zfs_domount(vfs_t *vfsp, char *osname)
                vfs_set_feature(vfsp, VFSFT_CASEINSENSITIVE);
        }
        vfs_set_feature(vfsp, VFSFT_ZEROCOPY_SUPPORTED);
+#endif /* HAVE_FUID_FEATURES */
 
        if (dmu_objset_is_snapshot(zfsvfs->z_os)) {
                uint64_t pval;
@@ -1703,8 +1681,10 @@ zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers)
 
        zfsvfs->z_version = newvers;
 
+#ifdef HAVE_FUID_FEATURES
        if (zfsvfs->z_version >= ZPL_VERSION_FUID)
                zfs_set_fuid_feature(zfsvfs);
+#endif /* HAVE_FUID_FEATURES */
 
        return (0);
 }