lkml.org 
[lkml]   [2005]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] bugfix: two read_inode() calls without clear_inode() call between
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>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-05 15:32    [W:0.035 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site