Bug 178329 - [zfs] extended attributes leak
Summary: [zfs] extended attributes leak
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-04 02:00 UTC by nowak
Modified: 2017-03-21 12:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nowak 2013-05-04 02:00:00 UTC
ZFS objects used to store extended attributes are not deleted when parent file/directory is deleted. Those objects still occupy disk space but are otherwise unreferenced and can't be deleted.

So far I've traced it down to sys\cddl\contrib\opensolaris\uts\common\fs\zfs\zfs_dir.c:zfs_rmnode.
ZTOV(zp) is NULL for extended attributes directory (object 9) so zfs_purgedir is not called and object 10 is left alone.

How-To-Repeat: # zfs create -o mountpoint=/test root/test
# touch /test/file1
# setextattr user test abc /test/file1
# zdb root/test
    Object  lvl   iblk   dblk  dsize  lsize   %full  type
         8    1    16K    512      0    512    0.00  ZFS plain file
         9    1    16K    512     1K    512  100.00  ZFS directory
        10    1    16K    512    512    512  100.00  ZFS plain file

object 8 - the file,
object 9 - extended attributes directory,
object 10 - value of the 'test' extended attribute ("abc")

# rm /test/file1
# zdb root/test

    Object  lvl   iblk   dblk  dsize  lsize   %full  type
        10    1    16K    512    512    512  100.00  ZFS plain file

objects 8 and 9 are deleted, object 10 is still there (leaked).
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2013-05-04 18:26:19 UTC
Can not reproduce with head code.

-- 
Andriy Gapon
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2013-05-04 22:38:43 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 3 nowak 2013-05-04 23:00:36 UTC
On 2013-05-04 19:26, Andriy Gapon wrote:
> Can not reproduce with head code.

Appears to be fixed in 9.1-STABLE too.

But the problem of already leaked objects remain:
1) zpool scrub will not delete leaked objects,
2) zfs send will include leaked objects.

Maybe patch scrub to detect and remove leaked objects (sysctl flag 
disabled by default)?