mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
Implement File Attribute Support
We add support for lsattr and chattr to resolve a regression caused
by 88c283952f that broke Python's
xattr.list(). That changet broke Gentoo Portage's FEATURES=xattr,
which depended on Python's xattr.list().
Only attributes common to both Solaris and Linux are supported. These
are 'a', 'd' and 'i' in Linux's lsattr and chattr commands. File
attributes exclusive to Solaris are present in the ZFS code, but cannot
be accessed or modified through this method. That was the case prior to
this patch. The resolution of issue zfsonlinux/zfs#229 should implement
some method to permit access and modification of Solaris-specific
attributes.
References:
https://bugs.gentoo.org/show_bug.cgi?id=483516
Original-patch-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1691
This commit is contained in:
committed by
Brian Behlendorf
parent
3b4f425a5a
commit
9d317793aa
@@ -446,6 +446,25 @@ error:
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
zfs_set_inode_flags(znode_t *zp, struct inode *ip)
|
||||
{
|
||||
/*
|
||||
* Linux and Solaris have different sets of file attributes, so we
|
||||
* restrict this conversion to the intersection of the two.
|
||||
*/
|
||||
|
||||
if (zp->z_pflags & ZFS_IMMUTABLE)
|
||||
ip->i_flags |= S_IMMUTABLE;
|
||||
else
|
||||
ip->i_flags &= ~S_IMMUTABLE;
|
||||
|
||||
if (zp->z_pflags & ZFS_APPENDONLY)
|
||||
ip->i_flags |= S_APPEND;
|
||||
else
|
||||
ip->i_flags &= ~S_APPEND;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the embedded inode given the znode. We should work toward
|
||||
* eliminating this function as soon as possible by removing values
|
||||
@@ -479,6 +498,7 @@ zfs_inode_update(znode_t *zp)
|
||||
ip->i_gid = SGID_TO_KGID(zp->z_gid);
|
||||
set_nlink(ip, zp->z_links);
|
||||
ip->i_mode = zp->z_mode;
|
||||
zfs_set_inode_flags(zp, ip);
|
||||
ip->i_blkbits = SPA_MINBLOCKSHIFT;
|
||||
dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &blksize,
|
||||
(u_longlong_t *)&ip->i_blocks);
|
||||
|
||||
Reference in New Issue
Block a user