9422 zfs diff and zdb should explicitly mark objects that are on the deleted 
queue

Reviewed by: Matt Ahrens <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>

It is possible for zfs to "leak" objects in such a way that they are not freed, 
but are also not accessible via
the POSIX interface. As the only way to know that this is happened is to see 
one of them directly in a zdb run,
or by noting unaccounted space usage, zdb should be enhanced to count these 
objects and return failure if some
are detected.

We have access to the delete queue through the zfs_get_deleteq function; we 
should call it in dump_znode to
determine if the object is on the delete queue. This is not the most efficient 
possible method, but it is the
simplest to implement, and should suffice for the common case where there few 
objects on the delete queue.

Also zfs diff and zdb currently traverse every single dnode in a dataset and 
tries to figure out the path of
the object by following it's parent.  When an object is placed on the delete 
queue, for all practical purposes
it's already discarded, it's parent might not exist anymore, and another object 
might now have the object number
that belonged to the parent.  While all of the above makes sense, when trying 
to figure out the path of an object
that is on the delete queue, we can run into issues where either it is 
impossible to determine the path because
the parent is gone, or another dnode has taken it's place and thus we are 
returned a wrong path.

We should therefore avoid trying to determine the path of an object on the 
delete queue and mark the object itself
as being on the delete queue to avoid confusion. To achieve this, we currently 
have two ideas:
1. When putting an object on the delete queue, change it's parent object number 
to a known constant that means NULL.
2. When displaying objects, first check if it is present on the delete queue.

Upstream bug: DLPX-48472 DLPX-46593
You can view, comment on, or merge this pull request online at:

  https://github.com/openzfs/openzfs/pull/604

-- Commit Summary --

  * 9421 zdb should detect and print out the number of "leaked" objects

-- File Changes --

    M usr/src/cmd/zdb/zdb.c (15)
    M usr/src/lib/libzfs/common/libzfs_diff.c (7)
    M usr/src/uts/common/fs/zfs/zfs_znode.c (11)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/604.patch
https://github.com/openzfs/openzfs/pull/604.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/604

------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/discussions/T107f5566021da6b1-M818c8c870974ada3478399eb
Delivery options: https://openzfs.topicbox.com/groups

Reply via email to