From owner-freebsd-fs@FreeBSD.ORG Tue Aug 28 15:01:41 2012 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06FCB106566C; Tue, 28 Aug 2012 15:01:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1724A8FC14; Tue, 28 Aug 2012 15:01:39 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA23086; Tue, 28 Aug 2012 18:01:34 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <503CDD4E.6050902@FreeBSD.org> Date: Tue, 28 Aug 2012 18:01:34 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120730 Thunderbird/14.0 MIME-Version: 1.0 To: Trent Nelson References: <20120824011517.GJ42732@snakebite.org> <503CD4F1.6060001@FreeBSD.org> In-Reply-To: <503CD4F1.6060001@FreeBSD.org> X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-fs@FreeBSD.org Subject: Re: chmod -h 000x against symlink has bizarre results on ZFS X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 15:01:41 -0000 on 28/08/2012 17:25 Andriy Gapon said the following: [snip] > I can reproduce this problem > I can also provide some additional bits of information using a modified version of > zdb: > > $ ln -fs definitelywaylongerthantwentyfour definitelywaylongerthantwentyfour.lnk > $ stat -s definitelywaylongerthantwentyfour.lnk > st_dev=3895460379 st_ino=27165 st_mode=0120755 st_nlink=1 st_uid=0 st_gid=0 > st_rdev=4294967295 st_size=33 st_atime=1346161009 st_mtime=1346161009 > st_ctime=1346161009 st_birthtime=1346161009 st_blksize=131072 st_blocks=1 st_flags=0 > $ zdb -ddddddd tank/tmp 27165 > Dataset tank/tmp [ZPL], ID 69, cr_txg 31, 4.57G, 24910 objects, rootbp > DVA[0]=<0:5c5375e000:200> DVA[1]=<0:4c1a80ce00:200> [L0 DMU objset] fletcher4 lzjb > LE contiguous unique double size=800L/200P birth=70882769L/70882769P fill=24910 > cksum=1c72e8f065:89bbdf9d575:1732432c541ff:2d672d98b0ff66 > > Object lvl iblk dblk dsize lsize %full type > 27165 1 16K 512 0 512 0.00 ZFS plain file (K=inherit) > (Z=inherit) > 209 bonus System attributes > dnode flags: USERUSED_ACCOUNTED > dnode maxblkid: 0 > path /definitelywaylongerthantwentyfour.lnk > uid 0 > gid 0 > atime Tue Aug 28 16:36:49 2012 > mtime Tue Aug 28 16:36:49 2012 > ctime Tue Aug 28 16:36:49 2012 > crtime Tue Aug 28 16:36:49 2012 > gen 70882769 > mode 120755 > size 33 > parent 3 > links 1 > pflags 40800000104 > symlink definitelywaylongerthantwentyfour > symlink size 33 > Indirect blocks: > > $ chmod -h 0007 definitelywaylongerthantwentyfour.lnk > $ stat -s definitelywaylongerthantwentyfour.lnk > st_dev=3895460379 st_ino=27165 st_mode=0120007 st_nlink=1 st_uid=0 st_gid=0 > st_rdev=4294967295 st_size=33 st_atime=1346161009 st_mtime=1346161009 > st_ctime=1346161227 st_birthtime=1346161227 st_blksize=131072 st_blocks=1 st_flags=0 > $ zdb -ddddddd tank/tmp 27165 > Dataset tank/tmp [ZPL], ID 69, cr_txg 31, 4.57G, 24910 objects, rootbp > DVA[0]=<0:5c556b4400:200> DVA[1]=<0:4c1a989600:200> [L0 DMU objset] fletcher4 lzjb > LE contiguous unique double size=800L/200P birth=70882812L/70882812P fill=24910 > cksum=170e778d58:737e87307d3:140a45f4106a6:283187f7da9de7 > > Object lvl iblk dblk dsize lsize %full type > 27165 1 16K 512 0 512 0.00 ZFS plain file (K=inherit) > (Z=inherit) > 216 bonus System attributes > dnode flags: USERUSED_ACCOUNTED > dnode maxblkid: 0 > path /definitelywaylongerthantwentyfour.lnk > uid 0 > gid 0 > atime Tue Aug 28 16:36:49 2012 > mtime Tue Aug 28 16:36:49 2012 > ctime Tue Aug 28 16:40:27 2012 > crtime Tue Aug 28 16:36:49 2012 > gen 70882769 > mode 120007 > size 33 > parent 3 > links 1 > pflags 40800000004 > symlink definitelywaylongerthant > symlink size 24 > Indirect blocks: > > Note how the file/object size remains 33, but size of ZPL_SYMLINK attribute is > changed to 24. > Will you be able to test the following patch? Preferably on a temporary test pool - I don't want to risk your data. diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c index 69374fb..7f61517 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c @@ -1695,6 +1695,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr, ASSERT(action == SA_REPLACE); SA_ADD_BULK_ATTR(attr_desc, j, attr, locator, datastart, buflen); + length_idx++; } else { length = SA_REGISTERED_LEN(sa, attr); if (length == 0) { -- Andriy Gapon