chmod -h 000x against symlink has bizarre results on ZFS
Andriy Gapon
avg at FreeBSD.org
Tue Aug 28 15:01:41 UTC 2012
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
More information about the freebsd-fs
mailing list