Skip to content

Commit 754d6c6

Browse files
committed
Merge: xfs: allow SECURE namespace xattrs to use reserved block pool
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5015 JIRA: https://issues.redhat.com/browse/RHEL-49806 Upstream Status: RHEL-only Signed-off-by: Pavel Reichl <preichl@redhat.com> Approved-by: Eric Sandeen <esandeen@redhat.com> Approved-by: Carlos Maiolino <cmaiolino@redhat.com> Approved-by: Bill O'Donnell <bodonnel@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents c282d3e + 63883fe commit 754d6c6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,11 +966,29 @@ xfs_attr_set(
966966
struct xfs_inode *dp = args->dp;
967967
struct xfs_mount *mp = dp->i_mount;
968968
struct xfs_trans_res tres;
969-
bool rsvd = (args->attr_filter & XFS_ATTR_ROOT);
969+
bool rsvd;
970970
int error, local;
971971
int rmt_blks = 0;
972972
unsigned int total;
973973

974+
/*
975+
* Some xattrs must be resistant to allocation failure at ENOSPC, e.g.
976+
* creating an inode with ACLs or security attributes requires the
977+
* allocation of the xattr holding that information to succeed. Hence
978+
* we allow xattrs in the VFS TRUSTED, SYSTEM, POSIX_ACL and SECURITY
979+
* (LSM xattr) namespaces to dip into the reserve block pool to allow
980+
* manipulation of these xattrs when at ENOSPC. These VFS xattr
981+
* namespaces translate to the XFS_ATTR_ROOT and XFS_ATTR_SECURE on-disk
982+
* namespaces.
983+
*
984+
* For most of these cases, these special xattrs will fit in the inode
985+
* itself and so consume no extra space or only require temporary extra
986+
* space while an overwrite is being made. Hence the use of the reserved
987+
* pool is largely to avoid the worst case reservation from preventing
988+
* the xattr from being created at ENOSPC.
989+
*/
990+
rsvd = (args->attr_filter & (XFS_ATTR_ROOT | XFS_ATTR_SECURE));
991+
974992
if (xfs_is_shutdown(dp->i_mount))
975993
return -EIO;
976994

0 commit comments

Comments
 (0)