Re: [RFC][PATCH 6/8] mm: handle_speculative_fault()

From: Peter Zijlstra
Date: Tue Jan 05 2010 - 04:37:58 EST


On Mon, 2010-01-04 at 19:13 -0800, Linus Torvalds wrote:
>
> Protecting the vma isn't enough. You need to protect the whole FS stack
> with rcu. Probably by moving _all_ of "free_vma()" into the RCU path
> (which means that the whole file/inode gets de-allocated at that later RCU
> point, rather than synchronously). Not just the actual kfree.

Right, looking at that I found another interesting challenge, fput() can
sleep and I suspect that even with call_srcu() its callbacks have to be
atomic.

While looking at that code, I found the placement of might_sleep() a tad
confusing, I'd expect that to be in fput() since that is the regular
entry point (all except AIO, which does crazy things).

---
fs/file_table.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/file_table.c b/fs/file_table.c
index 69652c5..6070c32 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -196,6 +196,8 @@ EXPORT_SYMBOL(alloc_file);

void fput(struct file *file)
{
+ might_sleep();
+
if (atomic_long_dec_and_test(&file->f_count))
__fput(file);
}
@@ -236,8 +238,6 @@ void __fput(struct file *file)
struct vfsmount *mnt = file->f_path.mnt;
struct inode *inode = dentry->d_inode;

- might_sleep();
-
fsnotify_close(file);
/*
* The function eventpoll_release() should be the first called


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