/* * Get permission to use log-assisted atomic exchange of file extents. * Callers must not be running any transactions or hold any ILOCKs.
*/ staticinlineint
xfs_attr_grab_log_assist( struct xfs_mount *mp)
{ int error = 0;
/* xattr update log intent items are already enabled */ if (xfs_is_using_logged_xattrs(mp)) return 0;
/* * Check if the filesystem featureset is new enough to set this log * incompat feature bit. Strictly speaking, the minimum requirement is * a V5 filesystem for the superblock field, but we'll require rmap * or reflink to avoid having to deal with really old kernels.
*/ if (!xfs_has_reflink(mp) && !xfs_has_rmapbt(mp)) return -EOPNOTSUPP;
staticinlinebool
xfs_attr_want_log_assist( struct xfs_mount *mp)
{ #ifdef DEBUG /* Logged xattrs require a V5 super for log_incompat */ return xfs_has_crc(mp) && xfs_globals.larp; #else returnfalse; #endif
}
/* * Set or remove an xattr, having grabbed the appropriate logging resources * prior to calling libxfs. Callers of this function are only required to * initialize the inode, attr_filter, name, namelen, value, and valuelen fields * of @args.
*/ int
xfs_attr_change( struct xfs_da_args *args, enum xfs_attr_update op)
{ struct xfs_mount *mp = args->dp->i_mount; int error;
if (xfs_is_shutdown(mp)) return -EIO;
error = xfs_qm_dqattach(args->dp); if (error) return error;
/* * We have no control over the attribute names that userspace passes us * to remove, so we have to allow the name lookup prior to attribute * removal to fail as well.
*/
args->op_flags = XFS_DA_OP_OKNOENT;
if (xfs_attr_want_log_assist(mp)) {
error = xfs_attr_grab_log_assist(mp); if (error) return error;
/* * Some xattrs must be resistant to allocation failure at ENOSPC, e.g. * creating an inode with ACLs or security attributes requires the * allocation of the xattr holding that information to succeed. Hence * we allow xattrs in the VFS TRUSTED, SYSTEM, POSIX_ACL and SECURITY * (LSM xattr) namespaces to dip into the reserve block pool to allow * manipulation of these xattrs when at ENOSPC. These VFS xattr * namespaces translate to the XFS_ATTR_ROOT and XFS_ATTR_SECURE on-disk * namespaces. * * For most of these cases, these special xattrs will fit in the inode * itself and so consume no extra space or only require temporary extra * space while an overwrite is being made. Hence the use of the reserved * pool is largely to avoid the worst case reservation from preventing * the xattr from being created at ENOSPC.
*/ return xfs_attr_set(args, op,
args->attr_filter & (XFS_ATTR_ROOT | XFS_ATTR_SECURE));
}
staticvoid
xfs_xattr_put_listent( struct xfs_attr_list_context *context, int flags, unsignedchar *name, int namelen, void *value, int valuelen)
{ char *prefix; int prefix_len;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.