|
|
f96e0b |
From d05e156bbc8198da89d45410b796a893e264229a Mon Sep 17 00:00:00 2001
|
|
|
f96e0b |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
Date: Fri, 22 Mar 2013 22:18:38 +0100
|
|
|
f96e0b |
Subject: [PATCH 225/482] * grub-core/fs/zfs/zfs.c: Fix incorrect
|
|
|
f96e0b |
handling of special volumes.
|
|
|
f96e0b |
|
|
|
f96e0b |
---
|
|
|
f96e0b |
ChangeLog | 4 ++++
|
|
|
f96e0b |
grub-core/fs/zfs/zfs.c | 59 ++++++++++++++++++++++++++++++++++++--------------
|
|
|
f96e0b |
2 files changed, 47 insertions(+), 16 deletions(-)
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/ChangeLog b/ChangeLog
|
|
|
f96e0b |
index 5582e13..8175269 100644
|
|
|
f96e0b |
--- a/ChangeLog
|
|
|
f96e0b |
+++ b/ChangeLog
|
|
|
f96e0b |
@@ -1,5 +1,9 @@
|
|
|
f96e0b |
2013-03-22 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
|
|
|
f96e0b |
+ * grub-core/fs/zfs/zfs.c: Fix incorrect handling of special volumes.
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+2013-03-22 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
+
|
|
|
f96e0b |
Add ability to generate newc additions on runtime.
|
|
|
f96e0b |
|
|
|
f96e0b |
2013-03-22 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
|
|
|
f96e0b |
index 822d65b..3d57978 100644
|
|
|
f96e0b |
--- a/grub-core/fs/zfs/zfs.c
|
|
|
f96e0b |
+++ b/grub-core/fs/zfs/zfs.c
|
|
|
f96e0b |
@@ -3695,7 +3695,7 @@ grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
|
|
|
f96e0b |
return err;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
-static void
|
|
|
f96e0b |
+static grub_err_t
|
|
|
f96e0b |
fill_fs_info (struct grub_dirhook_info *info,
|
|
|
f96e0b |
dnode_end_t mdn, struct grub_zfs_data *data)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -3716,30 +3716,32 @@ fill_fs_info (struct grub_dirhook_info *info,
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_dprintf ("zfs", "failed here\n");
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
+ return err;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- make_mdn (&mdn, data);
|
|
|
f96e0b |
+ err = make_mdn (&mdn, data);
|
|
|
f96e0b |
+ if (err)
|
|
|
f96e0b |
+ return err;
|
|
|
f96e0b |
err = dnode_get (&mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE,
|
|
|
f96e0b |
&dn, data);
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_dprintf ("zfs", "failed here\n");
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
+ return err;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
err = zap_lookup (&dn, ZFS_ROOT_OBJ, &objnum, data, 0);
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_dprintf ("zfs", "failed here\n");
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
+ return err;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
err = dnode_get (&mdn, objnum, 0, &dn, data);
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_dprintf ("zfs", "failed here\n");
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
+ return err;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
if (dn.dn.dn_bonustype == DMU_OT_SA)
|
|
|
f96e0b |
@@ -3757,12 +3759,12 @@ fill_fs_info (struct grub_dirhook_info *info,
|
|
|
f96e0b |
|
|
|
f96e0b |
err = zio_read (bp, dn.endian, &sahdrp, NULL, data);
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
+ return err;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
else
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_error (GRUB_ERR_BAD_FS, "filesystem is corrupt");
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
+ return grub_errno;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
hdrsize = SA_HDR_SIZE (((sa_hdr_phys_t *) sahdrp));
|
|
|
f96e0b |
@@ -3775,7 +3777,7 @@ fill_fs_info (struct grub_dirhook_info *info,
|
|
|
f96e0b |
info->mtimeset = 1;
|
|
|
f96e0b |
info->mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0], dn.endian);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- return;
|
|
|
f96e0b |
+ return 0;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
/* Helper for grub_zfs_dir. */
|
|
|
f96e0b |
@@ -3846,11 +3848,19 @@ iterate_zap_fs (const char *name, grub_uint64_t val,
|
|
|
f96e0b |
dnode_end_t mdn;
|
|
|
f96e0b |
err = dnode_get (&(ctx->data->mos), val, 0, &mdn, ctx->data);
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
- return 0;
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ grub_errno = 0;
|
|
|
f96e0b |
+ return 0;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
if (mdn.dn.dn_type != DMU_OT_DSL_DIR)
|
|
|
f96e0b |
return 0;
|
|
|
f96e0b |
|
|
|
f96e0b |
- fill_fs_info (&info, mdn, ctx->data);
|
|
|
f96e0b |
+ err = fill_fs_info (&info, mdn, ctx->data);
|
|
|
f96e0b |
+ if (err)
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ grub_errno = 0;
|
|
|
f96e0b |
+ return 0;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
return ctx->hook (name, &info, ctx->hook_data);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -3868,12 +3878,20 @@ iterate_zap_snap (const char *name, grub_uint64_t val,
|
|
|
f96e0b |
|
|
|
f96e0b |
err = dnode_get (&(ctx->data->mos), val, 0, &mdn, ctx->data);
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
- return 0;
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ grub_errno = 0;
|
|
|
f96e0b |
+ return 0;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
|
|
|
f96e0b |
if (mdn.dn.dn_type != DMU_OT_DSL_DATASET)
|
|
|
f96e0b |
return 0;
|
|
|
f96e0b |
|
|
|
f96e0b |
- fill_fs_info (&info, mdn, ctx->data);
|
|
|
f96e0b |
+ err = fill_fs_info (&info, mdn, ctx->data);
|
|
|
f96e0b |
+ if (err)
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ grub_errno = 0;
|
|
|
f96e0b |
+ return 0;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
|
|
|
f96e0b |
name2 = grub_malloc (grub_strlen (name) + 2);
|
|
|
f96e0b |
name2[0] = '@';
|
|
|
f96e0b |
@@ -3913,9 +3931,18 @@ grub_zfs_dir (grub_device_t device, const char *path,
|
|
|
f96e0b |
dnode_end_t dn;
|
|
|
f96e0b |
struct grub_dirhook_info info;
|
|
|
f96e0b |
|
|
|
f96e0b |
- fill_fs_info (&info, data->dnode, data);
|
|
|
f96e0b |
- hook ("@", &info, hook_data);
|
|
|
f96e0b |
-
|
|
|
f96e0b |
+ err = fill_fs_info (&info, data->dnode, data);
|
|
|
f96e0b |
+ if (err)
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ zfs_unmount (data);
|
|
|
f96e0b |
+ return err;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
+ if (hook ("@", &info, hook_data))
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ zfs_unmount (data);
|
|
|
f96e0b |
+ return GRUB_ERR_NONE;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
+
|
|
|
f96e0b |
childobj = grub_zfs_to_cpu64 (((dsl_dir_phys_t *) DN_BONUS (&data->dnode.dn))->dd_child_dir_zapobj, data->dnode.endian);
|
|
|
f96e0b |
headobj = grub_zfs_to_cpu64 (((dsl_dir_phys_t *) DN_BONUS (&data->dnode.dn))->dd_head_dataset_obj, data->dnode.endian);
|
|
|
f96e0b |
err = dnode_get (&(data->mos), childobj,
|
|
|
f96e0b |
--
|
|
|
f96e0b |
1.8.2.1
|
|
|
f96e0b |
|