ramfs leak
Quoted 2 lines · Padraig Brady
When I remove files from a ramfs the space is not reclaimed? What am I doing wrong? Details below.
Nothing. We've noticed the same thing. It's a bug and was first reported back in July, but no one has provided a fix yet. I've had a brief look at the source code, but nothing obvious pops out at me.
As you mention, this problem is trivially reproducable by creating and then deleting a file. Doing that over and over eventually leads to the ramfs becoming full. Only a reboot (or perhaps a umount/mount) makes it usable again.
Chris Martin
Catnap Consultants
Hello,
At Fri, 9 Nov 2001 15:40:43 -0500 (EST),
Quoted 9 lines · W Christopher Martin
Quoted 2 lines · Padraig Brady
When I remove files from a ramfs the space is not reclaimed? What am I doing wrong? Details below.
Nothing. We've noticed the same thing. It's a bug and was first reported back in July, but no one has provided a fix yet. I've had a brief look at the source code, but nothing obvious pops out at me.
I think you should use tmpfs instead of ramfs, but if you really want to use ramfs, the patch below may fix the problem.
fs/ramfs/inode.c +2 -5
@@ -182,12 +182,9 @@ {struct ramfs_sb_info *rsb =RAMFS_SB (inode->i_sb); -if (!Page_Uptodate (page)) -return ; -lock_rsb (rsb); - -ClearPageDirty (page); +if (Page_Uptodate (page)) +ClearPageDirty (page); rsb->free_pages++; inode->i_blocks -=IBLOCKS_PER_PAGE ;
Quoted 28 lines · Tachino Nobuhiro
Hello,
At Fri, 9 Nov 2001 15:40:43 -0500 (EST),
Quoted 10 lines · W Christopher Martin
Quoted 3 lines · Padraig Brady
When I remove files from a ramfs the space is not reclaimed? What am I doing wrong? Details below.
Nothing. We've noticed the same thing. It's a bug and was first reported back in July, but no one has provided a fix yet. I've had a brief look at the source code, but nothing obvious pops out at me.
I think you should use tmpfs instead of ramfs, but if you really want to use ramfs, the patch below may fix the problem.
diff -Nur
linux-2.4.13-ac7.org/fs/ramfs/inode.clinux-2.4.13-ac7/fs/ramfs/inode.cfs/ramfs/inode.c +0
-1@@ -182,12 +182,9 @@ {struct ramfs_sb_info *rsb =RAMFS_SB (inode->i_sb); -if (!Page_Uptodate (page))
fs/ramfs/inode.c line 190
Quoted 10 lines
fs/ramfs/inode.c +2
-4-return ; -lock_rsb (rsb); - -ClearPageDirty (page); +if (Page_Uptodate (page)) +ClearPageDirty (page); rsb->free_pages++; inode->i_blocks -=IBLOCKS_PER_PAGE ;
Cool, this fixes it,
and I was just getting to the bottom of it myself :-) None of this accounting stuff is in 2.4.15-pre3, so Alan can you apply this?
cheers,
Padraig.
Quoted 3 lines
and I was just getting to the bottom of it myself :-) None of this accounting stuff is in 2.4.15-pre3, so Alan can you apply this?
RAMfs is 2.4.16 stuff I think