Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jun 2018 15:31:24 +0000
From:      Dave Baukus <daveb@spectralogic.com>
To:        Andriy Gapon <avg@FreeBSD.org>, "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>
Subject:   Re: ZFS file in a snapshot with a link count of 0
Message-ID:  <f94412e7-377c-5413-d51c-b7f8eb782f83@spectralogic.com>
In-Reply-To: <9c88705f-8af5-bf03-aa6b-fe4ecbad50e8@FreeBSD.org>
References:  <dcf02d30-a871-a5e4-b893-8eb85e8d8fd1@spectralogic.com> <9c88705f-8af5-bf03-aa6b-fe4ecbad50e8@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

On 06/22/2018 01:00 AM, Andriy Gapon wrote:
> On 22/06/2018 02:25, Dave Baukus wrote:
>> On a ZFS running something very close to 11.0-STABLE FreeBSD, I am able to get a
>> file with a link count of 0 into a snapshot. If this file also has an extattr attached to it then
>> this file appears to break zfs diff.
>>
>> The main question is: should a file with a link count of 0 get into the snap shot ?
> Yes.  The file is on disk, so it's in the snapshot as well.
>
>> #
>> zfs diff pool0/vol0@snapF1 pool0/vol0@snapF2
>> Unable to determine path or stats for object 1030 in pool0/vol0@snapF1: No such file or directory
> Is this a fatal error or merely a warning?
> If the former, then it needs to be fixed in zfs diff.
>
It is fatal. The bug here:
describe_free(FILE *fp, differ_info_t *di, uint64_t object, char *namebuf,
     int maxlen)
{
         struct zfs_stat sb;

         if (get_stats_for_obj(di, di->fromsnap, object, namebuf,
             maxlen, &sb) != 0) {
                 /* Let it slide, if in the delete queue on from side */
                 if (di->zerr == ENOENT && sb.zs_links == 0) {
                         di->zerr = 0;
                         return (0);
                 }
                 return (-1);
         }

         print_file(fp, di, ZDIFF_REMOVED, namebuf, &sb);
         return (0);
}

The object is the extattr-dir (1030) of the file (1029) that has been removed.
1029 has a zs_links == 0 so it passes the check above; 1030 has sz_links == 2 and zfs diff
exits with the error message above.
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f94412e7-377c-5413-d51c-b7f8eb782f83>