All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] bugfix: two read_inode() calls without clear_inode() call between
@ 2005-08-05 13:33 Vasily Averin
  2005-08-05 13:42 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Vasily Averin @ 2005-08-05 13:33 UTC (permalink / raw)
  To: Artem B. Bityuckiy, Christoph Hellwig, linux-kernel

Hello,

Could you please explain me, why we need to wake up somebody right 
before freeing an inode? It seems for me, if somebody really wait on 
this inode, then they have a good chance to access already freed memory.

Thank you,
	Vasily Averin


diff --git a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -282,6 +282,13 @@ static void dispose_list(struct list_hea
  		if (inode->i_data.nrpages)
  			truncate_inode_pages(&inode->i_data, 0);
  		clear_inode(inode);
+
+		spin_lock(&inode_lock);
+		hlist_del_init(&inode->i_hash);
+		list_del_init(&inode->i_sb_list);
+		spin_unlock(&inode_lock);
+
+		wake_up_inode(inode);
                 ^^^^^^^^^^^^^^^^^^^^
  		destroy_inode(inode);
  		nr_disposed++;
  	}

tree b4e0b69dbf3d2da69aa49423227a1da6036e9566
parent 168a9fd6a1bf91041adf9909f6c72cf747f0ca8c
author Artem B. Bityuckiy <dedekind@infradead.org>
committer Linus Torvalds <torvalds@g5.osdl.org>

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] bugfix: two read_inode() calls without clear_inode() call between
  2005-08-05 13:33 [PATCH] bugfix: two read_inode() calls without clear_inode() call between Vasily Averin
@ 2005-08-05 13:42 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2005-08-05 13:42 UTC (permalink / raw)
  To: vvs; +Cc: dedekind, hch, linux-kernel

> Could you please explain me, why we need to wake up somebody right 
> before freeing an inode? It seems for me, if somebody really wait on 
> this inode, then they have a good chance to access already freed memory.

find_inode() needs to be woken up (__wait_on_freeing_inode) when an
inode being freed is actually taken off the hash list .  And it's
careful not to touch it after being woken up.

Miklos

> diff --git a/fs/inode.c b/fs/inode.c
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -282,6 +282,13 @@ static void dispose_list(struct list_hea
>   		if (inode->i_data.nrpages)
>   			truncate_inode_pages(&inode->i_data, 0);
>   		clear_inode(inode);
> +
> +		spin_lock(&inode_lock);
> +		hlist_del_init(&inode->i_hash);
> +		list_del_init(&inode->i_sb_list);
> +		spin_unlock(&inode_lock);
> +
> +		wake_up_inode(inode);
>                  ^^^^^^^^^^^^^^^^^^^^
>   		destroy_inode(inode);
>   		nr_disposed++;
>   	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-05 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-05 13:33 [PATCH] bugfix: two read_inode() calls without clear_inode() call between Vasily Averin
2005-08-05 13:42 ` Miklos Szeredi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.