X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzfs_vfsops.c;h=77bef009bc5f11fb283049d313e04a236624848e;hb=e0f3df67e5174cd51284f0c26779046facfc95e0;hp=f68dde85f82eddebda6e63a5e367b2ae08740c4c;hpb=428870ff734fdaccc342b33fc53cf94724409a46;p=zfs.git diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index f68dde8..77bef00 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -65,6 +65,7 @@ #include #include "zfs_comutil.h" +#ifdef HAVE_ZPL int zfsfstype; vfsops_t *zfs_vfsops = NULL; static major_t zfs_major; @@ -166,7 +167,7 @@ zfs_sync(vfs_t *vfsp, short flag, cred_t *cr) } if (zfsvfs->z_log != NULL) - zil_commit(zfsvfs->z_log, UINT64_MAX, 0); + zil_commit(zfsvfs->z_log, 0); ZFS_EXIT(zfsvfs); } else { @@ -417,7 +418,8 @@ zfs_register_callbacks(vfs_t *vfsp) * of mount options, we stash away the current values and * restore them after we register the callbacks. */ - if (vfs_optionisset(vfsp, MNTOPT_RO, NULL)) { + if (vfs_optionisset(vfsp, MNTOPT_RO, NULL) || + !spa_writeable(dmu_objset_spa(os))) { readonly = B_TRUE; do_readonly = B_TRUE; } else if (vfs_optionisset(vfsp, MNTOPT_RW, NULL)) { @@ -559,6 +561,7 @@ unregister: return (error); } +#endif /* HAVE_ZPL */ static int zfs_space_delta_cb(dmu_object_type_t bonustype, void *data, @@ -609,6 +612,7 @@ zfs_space_delta_cb(dmu_object_type_t bonustype, void *data, return (error); } +#ifdef HAVE_ZPL static void fuidstr_to_sid(zfsvfs_t *zfsvfs, const char *fuidstr, char *domainbuf, int buflen, uid_t *ridp) @@ -821,23 +825,14 @@ zfs_owner_overquota(zfsvfs_t *zfsvfs, znode_t *zp, boolean_t isgroup) { uint64_t fuid; uint64_t quotaobj; - uid_t id; quotaobj = isgroup ? zfsvfs->z_groupquota_obj : zfsvfs->z_userquota_obj; - id = isgroup ? zp->z_gid : zp->z_uid; + fuid = isgroup ? zp->z_gid : zp->z_uid; if (quotaobj == 0 || zfsvfs->z_replay) return (B_FALSE); - if (IS_EPHEMERAL(id)) { - VERIFY(0 == sa_lookup(zp->z_sa_hdl, - isgroup ? SA_ZPL_GID(zfsvfs) : SA_ZPL_UID(zfsvfs), - &fuid, sizeof (fuid))); - } else { - fuid = (uint64_t)id; - } - return (zfs_fuid_overquota(zfsvfs, isgroup, fuid)); } @@ -922,7 +917,10 @@ zfsvfs_create(const char *osname, zfsvfs_t **zfvp) sa_obj = 0; } - zfsvfs->z_attr_table = sa_setup(os, sa_obj, zfs_attr_table, ZPL_END); + error = sa_setup(os, sa_obj, zfs_attr_table, ZPL_END, + &zfsvfs->z_attr_table); + if (error) + goto out; if (zfsvfs->z_version >= ZPL_VERSION_SA) sa_register_update_callback(os, zfs_sa_upgrade); @@ -1043,12 +1041,15 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t mounting) * allocated and in the unlinked set, and there is an * intent log record saying to allocate it. */ - if (zil_replay_disable) { - zil_destroy(zfsvfs->z_log, B_FALSE); - } else { - zfsvfs->z_replay = B_TRUE; - zil_replay(zfsvfs->z_os, zfsvfs, zfs_replay_vector); - zfsvfs->z_replay = B_FALSE; + if (spa_writeable(dmu_objset_spa(zfsvfs->z_os))) { + if (zil_replay_disable) { + zil_destroy(zfsvfs->z_log, B_FALSE); + } else { + zfsvfs->z_replay = B_TRUE; + zil_replay(zfsvfs->z_os, zfsvfs, + zfs_replay_vector); + zfsvfs->z_replay = B_FALSE; + } } zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */ } @@ -1172,6 +1173,7 @@ zfs_domount(vfs_t *vfsp, char *osname) goto out; xattr_changed_cb(zfsvfs, pval); zfsvfs->z_issnap = B_TRUE; + zfsvfs->z_os->os_sync = ZFS_SYNC_DISABLED; mutex_enter(&zfsvfs->z_os->os_user_ptr_lock); dmu_objset_set_user(zfsvfs->z_os, zfsvfs); @@ -1808,10 +1810,10 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) /* * Evict cached data */ - if (dmu_objset_evict_dbufs(zfsvfs->z_os)) { - txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0); - (void) dmu_objset_evict_dbufs(zfsvfs->z_os); - } + if (dmu_objset_is_dirty_anywhere(zfsvfs->z_os)) + if (!(zfsvfs->z_vfs->vfs_flag & VFS_RDONLY)) + txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0); + (void) dmu_objset_evict_dbufs(zfsvfs->z_os); return (0); } @@ -2031,8 +2033,9 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname) goto bail; - zfsvfs->z_attr_table = sa_setup(zfsvfs->z_os, sa_obj, - zfs_attr_table, ZPL_END); + if ((err = sa_setup(zfsvfs->z_os, sa_obj, + zfs_attr_table, ZPL_END, &zfsvfs->z_attr_table)) != 0) + goto bail; VERIFY(zfsvfs_setup(zfsvfs, B_FALSE) == 0); @@ -2127,10 +2130,12 @@ zfs_vfsinit(int fstype, char *name) return (0); } +#endif /* HAVE_ZPL */ void zfs_init(void) { +#ifdef HAVE_ZPL /* * Initialize .zfs directory structures */ @@ -2140,6 +2145,7 @@ zfs_init(void) * Initialize znode cache, vnode ops, etc... */ zfs_znode_init(); +#endif /* HAVE_ZPL */ dmu_objset_register_type(DMU_OST_ZFS, zfs_space_delta_cb); } @@ -2147,16 +2153,13 @@ zfs_init(void) void zfs_fini(void) { +#ifdef HAVE_ZPL zfsctl_fini(); zfs_znode_fini(); +#endif /* HAVE_ZPL */ } -int -zfs_busy(void) -{ - return (zfs_active_fs_count != 0); -} - +#ifdef HAVE_ZPL int zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers) { @@ -2224,6 +2227,7 @@ zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers) return (0); } +#endif /* HAVE_ZPL */ /* * Read a property stored within the master node. @@ -2267,15 +2271,17 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value) return (error); } +#ifdef HAVE_ZPL static vfsdef_t vfw = { VFSDEF_VERSION, MNTTYPE_ZFS, zfs_vfsinit, VSW_HASPROTO|VSW_CANRWRO|VSW_CANREMOUNT|VSW_VOLATILEDEV|VSW_STATS| - VSW_XID, + VSW_XID|VSW_ZMOUNT, &zfs_mntopts }; struct modlfs zfs_modlfs = { &mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw }; +#endif /* HAVE_ZPL */