File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments