summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Shellenbaum <[email protected]>2010-08-18 13:59:31 -0600
committerBrian Behlendorf <[email protected]>2013-11-04 10:54:48 -0800
commitc1fabe7961b100a7dfd77cddba1650d9a6580dc0 (patch)
tree4bc52e77f07aa786e756168dd93f92f4ec227785
parentc0ebc844c78cd40c086dd145dc129b73f17af21b (diff)
6977619 NULL pointer deference in sa_handle_get_from_db()
References: illumos/illumos-gate@44bffe012cad6481c82ad67bacd6b40bd29def2b Ported-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #1775
-rw-r--r--module/zfs/zfs_vfsops.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index d98bdb342..64e01e753 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -1476,7 +1476,7 @@ EXPORT_SYMBOL(zfs_suspend_fs);
int
zfs_resume_fs(zfs_sb_t *zsb, const char *osname)
{
- int err, err2;
+ int err;
ASSERT(RRW_WRITE_HELD(&zsb->z_teardown_lock));
ASSERT(RW_WRITE_HELD(&zsb->z_teardown_inactive_lock));
@@ -1488,18 +1488,33 @@ zfs_resume_fs(zfs_sb_t *zsb, const char *osname)
znode_t *zp;
uint64_t sa_obj = 0;
- err2 = zap_lookup(zsb->z_os, MASTER_NODE_OBJ,
- ZFS_SA_ATTRS, 8, 1, &sa_obj);
+ /*
+ * Make sure version hasn't changed
+ */
- if ((err || err2) && zsb->z_version >= ZPL_VERSION_SA)
+ err = zfs_get_zplprop(zsb->z_os, ZFS_PROP_VERSION,
+ &zsb->z_version);
+
+ if (err)
goto bail;
+ err = zap_lookup(zsb->z_os, MASTER_NODE_OBJ,
+ ZFS_SA_ATTRS, 8, 1, &sa_obj);
+
+ if (err && zsb->z_version >= ZPL_VERSION_SA)
+ goto bail;
if ((err = sa_setup(zsb->z_os, sa_obj,
zfs_attr_table, ZPL_END, &zsb->z_attr_table)) != 0)
goto bail;
+ if (zsb->z_version >= ZPL_VERSION_SA)
+ sa_register_update_callback(zsb->z_os,
+ zfs_sa_upgrade);
+
VERIFY(zfs_sb_setup(zsb, B_FALSE) == 0);
+
+ zfs_set_fuid_feature(zsb);
zsb->z_rollback_time = jiffies;
/*
@@ -1530,8 +1545,8 @@ bail:
if (err) {
/*
- * Since we couldn't reopen zfs_sb_t or, setup the
- * sa framework, force unmount this file system.
+ * Since we couldn't reopen zfs_sb_t or, or
+ * setup the sa framework force unmount this file system.
*/
if (zsb->z_os)
(void) zfs_umount(zsb->z_sb);
@@ -1601,8 +1616,7 @@ zfs_set_version(zfs_sb_t *zsb, uint64_t newvers)
zsb->z_version = newvers;
- if (zsb->z_version >= ZPL_VERSION_FUID)
- zfs_set_fuid_feature(zsb);
+ zfs_set_fuid_feature(zsb);
return (0);
}