2001-02-02 15:51:03

by Alan

[permalink] [raw]
Subject: RAMFS

Random quick poking

Does this fix the ramfs problem in -ac ?


--- fs/ramfs/inode.c~ Wed Jan 31 22:02:16 2001
+++ fs/ramfs/inode.c Fri Feb 2 14:51:47 2001
@@ -174,7 +174,6 @@
inode->i_blocks += IBLOCKS_PER_PAGE;
rsb->free_pages--;
SetPageDirty(page);
- UnlockPage(page);
} else {
ClearPageUptodate(page);
ret = 0;
@@ -264,6 +263,7 @@

if (! ramfs_alloc_page(inode, page))
return -ENOSPC;
+ UnlockPage(page);
return 0;
}


2001-02-02 17:57:32

by Ingo Oeser

[permalink] [raw]
Subject: Re: RAMFS

On Fri, Feb 02, 2001 at 03:51:53PM +0000, Alan Cox wrote:
> Does this fix the ramfs problem in -ac ?
>
> --- fs/ramfs/inode.c~ Wed Jan 31 22:02:16 2001
> +++ fs/ramfs/inode.c Fri Feb 2 14:51:47 2001
> @@ -174,7 +174,6 @@
> inode->i_blocks += IBLOCKS_PER_PAGE;
> rsb->free_pages--;
> SetPageDirty(page);
> - UnlockPage(page);
> } else {
> ClearPageUptodate(page);
> ret = 0;
> @@ -264,6 +263,7 @@
>
> if (! ramfs_alloc_page(inode, page))
> return -ENOSPC;
> + UnlockPage(page);
> return 0;
> }

No, so have to unlock it also, if you return -ENOSPC.

So the correct fix seems to be:

--- linux/fs/ramfs/inode.c~ Wed Jan 31 22:02:16 2001
+++ linux/fs/ramfs/inode.c Fri Feb 2 14:51:47 2001
@@ -174,7 +174,6 @@
inode->i_blocks += IBLOCKS_PER_PAGE;
rsb->free_pages--;
SetPageDirty(page);
- UnlockPage(page);
} else {
ClearPageUptodate(page);
ret = 0;
@@ -264,6 +263,9 @@

- if (! ramfs_alloc_page(inode, page))
+ if (! ramfs_alloc_page(inode, page)) {
+ UnlockPage(page);
return -ENOSPC;
+ }
+ UnlockPage(page);
return 0;
}

This currently works for me (but using 2.4.0 + dwg-ramfs.patch + this patch)

Regards

Ingo Oeser
--
10.+11.03.2001 - 3. Chemnitzer LinuxTag <http://www.tu-chemnitz.de/linux/tag>
<<<<<<<<<<<< come and join the fun >>>>>>>>>>>>

2001-02-02 19:24:52

by Mike Galbraith

[permalink] [raw]
Subject: Re: RAMFS

On Fri, 2 Feb 2001, Ingo Oeser wrote:

> No, so have to unlock it also, if you return -ENOSPC.
>
> So the correct fix seems to be:
>
> --- linux/fs/ramfs/inode.c~ Wed Jan 31 22:02:16 2001
> +++ linux/fs/ramfs/inode.c Fri Feb 2 14:51:47 2001
> @@ -174,7 +174,6 @@
> inode->i_blocks += IBLOCKS_PER_PAGE;
> rsb->free_pages--;
> SetPageDirty(page);
> - UnlockPage(page);
> } else {
> ClearPageUptodate(page);
> ret = 0;
> @@ -264,6 +263,9 @@
>
> - if (! ramfs_alloc_page(inode, page))
> + if (! ramfs_alloc_page(inode, page)) {
> + UnlockPage(page);
> return -ENOSPC;
> + }
> + UnlockPage(page);
> return 0;
> }
>
> This currently works for me (but using 2.4.0 + dwg-ramfs.patch + this patch)

Have you stressed it? (I see leakiness)

-Mike

2001-02-02 20:41:50

by Ingo Oeser

[permalink] [raw]
Subject: Re: RAMFS

On Fri, Feb 02, 2001 at 08:24:19PM +0100, Mike Galbraith wrote:
> On Fri, 2 Feb 2001, Ingo Oeser wrote:
> > No, so have to unlock it also, if you return -ENOSPC.
> >
> > So the correct fix seems to be:
[...]
> > This currently works for me (but using 2.4.0 + dwg-ramfs.patch + this patch)
>
> Have you stressed it? (I see leakiness)

I do reads and writes to it every 5 seconds and sometimes more (
mounted on /tmp, /var/run and the like ) and had an uptime of
about a week (I use it in an embedded-like system and we
sometimes change the system image).

There might be a dentry or inode leak, but that doesn't bite me,
because I only create the files I need once and extend or shrink
them.

But I couldn't stress it too much.

Where exactly do you see the leaks?

PS: For reference, I put the diff to 2.4.0 that I use to
http://www.tu-chemnitz.de/~ioe/dwg-ramfs.patch

The original patch has _not_ been done by me, but by
David Gibson, Linuxcare Australia.

PPS: It would be surprising anyway, if I used the right patch all
the time, while the wrong one was in acX. That's why I didn't
submit anything ;-)

Regards

Ingo Oeser
--
10.+11.03.2001 - 3. Chemnitzer LinuxTag <http://www.tu-chemnitz.de/linux/tag>
<<<<<<<<<<<< come and join the fun >>>>>>>>>>>>

2001-02-02 21:04:21

by Mike Galbraith

[permalink] [raw]
Subject: Re: RAMFS

On Fri, 2 Feb 2001, Ingo Oeser wrote:

> On Fri, Feb 02, 2001 at 08:24:19PM +0100, Mike Galbraith wrote:
> > On Fri, 2 Feb 2001, Ingo Oeser wrote:
> > > No, so have to unlock it also, if you return -ENOSPC.
> > >
> > > So the correct fix seems to be:
> [...]
> > > This currently works for me (but using 2.4.0 + dwg-ramfs.patch + this patch)
> >
> > Have you stressed it? (I see leakiness)
>
> I do reads and writes to it every 5 seconds and sometimes more (
> mounted on /tmp, /var/run and the like ) and had an uptime of
> about a week (I use it in an embedded-like system and we
> sometimes change the system image).
>
> There might be a dentry or inode leak, but that doesn't bite me,
> because I only create the files I need once and extend or shrink
> them.

That won't show it. I can do that kind of stuff all day long, no
problem whatsoever.

> But I couldn't stress it too much.
>
> Where exactly do you see the leaks?

(I don't have a solid grip yet.. just starting to seek)

> PS: For reference, I put the diff to 2.4.0 that I use to
> http://www.tu-chemnitz.de/~ioe/dwg-ramfs.patch
>
> The original patch has _not_ been done by me, but by
> David Gibson, Linuxcare Australia.

I'll take a look at this.. thanks.

2001-02-03 07:14:22

by Mike Galbraith

[permalink] [raw]
Subject: Re: RAMFS

On Fri, 2 Feb 2001, Mike Galbraith wrote:

> > Where exactly do you see the leaks?
>
> (I don't have a solid grip yet.. just starting to seek)

Heh. I figured this must be a nice defenseless little buglet
I could pick on (ramfs is pretty darn simple). Critter might
not be quite as defenseless as I presumed ;-)

Using ramfs under vm pressure breaks (hmm.. spinlock) instantly
on my UP box.

-Mike