Opened 17 months ago

Last modified 6 months ago

#18126 new bug

RAMFS: does not reserve memory for files

Reported by: waddlesplash Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: File Systems/RAMFS Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

As in title. This can get us in to trouble, in that files which have been resized do not actually have the necessary capacity and can have errors occur at write time (or page faults in applications that have mmap'ed them) in low memory situations.

Change History (2)

comment:1 by pulkomandy, 6 months ago

Sparse files are a thing on filesystems (similar to overcommitting in RAM) and may lead to the same problems on a traditional block device backed filesystem.

Is there anything special about ramfs here? Write and read on block devices can fail, that can be handled by the corresponding APIs returning an error. And if you use mmap, likewise, if you plan to have the file added to your address space as you access it, you should be prepared to handle errors (by catching signals when accessing it, I assume). But that is also not different from any other filesystem.

comment:2 by waddlesplash, 6 months ago

Well, another thing we may want to implement would be a global quota for RAMFS, so that one can restrict it to only use some maximum size or percent of system RAM, or not allocate more RAM if only so much is available. At present there's no mechanism for that either.

Note: See TracTickets for help on using tickets.