Skip to content

systemd part 3: Cgroup2 partial stubbing#285

Open
arihant2math wants to merge 1 commit intohexagonal-sun:masterfrom
arihant2math:new-systemd3
Open

systemd part 3: Cgroup2 partial stubbing#285
arihant2math wants to merge 1 commit intohexagonal-sun:masterfrom
arihant2math:new-systemd3

Conversation

@arihant2math
Copy link
Copy Markdown
Collaborator

This pull request adds support for the /proc/[pid]/cgroup file and integrates basic cgroup registration and unregistration for thread groups. It also changes the mount syscall to improve filesystem type handling.

}

if cgroupfs().has_live_processes_direct(&child) {
return Err(FsError::DirectoryNotEmpty.into());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think according to the man page this should be EBUSY.

fn alloc_inode_id(&self) -> InodeId {
InodeId::from_fsid_and_inodeid(
CGROUPFS_ID,
self.next_inode_id.fetch_add(1, Ordering::SeqCst),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get away with Relaxed ordering here.

#[async_trait]
impl Inode for CgroupDirInode {
fn id(&self) -> InodeId {
self.id
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning the raw unshifted value here will eventually collide with your control inode IDs returned in file_inode_id. Maybe in alloc_inode_id you could increment in the stride of your shift:

 fn alloc_inode_id(&self) -> InodeId {
     InodeId::from_fsid_and_inodeid(
         CGROUPFS_ID,
        // Or whatever shift you choose.
         self.next_inode_id.fetch_add(16, Ordering::Relaxed),
     )
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants