[PATCH] Re: bin/160400: zfs(1): zfs rename dumps core

Martin Matuska mm at FreeBSD.org
Wed Sep 28 08:59:14 UTC 2011


The reproduction of this issue can be simplified and similiar case has
already been reported on freebsd-fs@:
http://lists.freebsd.org/pipermail/freebsd-fs/2010-September/009379.html
http://lists.freebsd.org/pipermail/freebsd-fs/2011-August/012291.html

It is important that the mountpoint of the dataset to be renamed is set
to none or legacy, otherwise this assertion is not triggered.

# zfs create -o mountpoint=none tank/a
# zfs create tank/a/b
# zfs rename tank/a tank/c
Assertion failed: (!clp->cl_alldependents), file
/usr/src/cddl/lib/libzfs/../../../cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c,
line 470.
Abort (core dumped)

As to my code examination, the assertion in libzfs_changelist.c:
change_one() is inproper or invalid. The code path is called with
clp->cl_sorted = B_FALSE and  cl_alldependents = B_TRUE from
changelist_gather() if mountpoint is legacy or none.

This misbehaviour was introduced in this OpenSolaris commit:

changeset:   10196:210962933dfd
user:        William Gorrell <william.gorrell at sun.com>
date:        Wed Jul 29 08:49:33 2009 -0600
summary:     6612218 inherited zfs set mountpoint mounts children before
parent

https://github.com/illumos/illumos-gate/commit/3cc4a7920cf40de22a5c8c465a4676b2b7f620dd#usr/src/lib/libzfs/common/libzfs_changelist.c

I am generally putting in question why that assertion was in this place
at it concerns exclusively the case with mountpoint=none or
mountpoint=legacy and it manages only the order of the datasets being
processed. I suggest removing the assertion as we can safely try to
unmount the dependent filesystems.

Please review the attached patch.

-- 
Martin Matuska
FreeBSD committer
http://blog.vx.sk

-------------- next part --------------
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
===================================================================
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c	(revision 225689)
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c	(working copy)
@@ -467,7 +467,6 @@ change_one(zfs_handle_t *zhp, void *data)
 			 * This is necessary when the original mountpoint
 			 * is legacy or none.
 			 */
-			ASSERT(!clp->cl_alldependents);
 			verify(uu_list_insert_before(clp->cl_list,
 			    uu_list_first(clp->cl_list), cn) == 0);
 		}


More information about the zfs-devel mailing list