clr-boot-manager icon indicating copy to clipboard operation
clr-boot-manager copied to clipboard

While having `boot.mount` active, CBM should "lock" it.

Open ahkok opened this issue 6 years ago • 1 comments

Now that fwupd and other tools potentially also mount and unmount /boot, we need to assure that, while manipulations are made, the filesystem isn't unmounted by someone else.

The easiest and cleanest solution @fenrus75 and me came up with at lunch is to use opendir() and keep the DIR entry open as long as operations are proceeding.

The reason we don't want to lock a file is because we don't want to create lockfiles for no reason.

opendir() will prevent unmounting. We can lazy unmount as well to further make things more reliable.

	DIR *d = opendir("/boot/loader");
	//do work
	closedir(d);

ahkok avatar Oct 22 '19 20:10 ahkok

Note: the reason we use opendir is because fusermount and lsof will indicate it's holding a file descriptor open.

ahkok avatar Oct 22 '19 20:10 ahkok