Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=01b2d93ca4c495f056471189ac6c4e6ac4cbbccb
Commit:     01b2d93ca4c495f056471189ac6c4e6ac4cbbccb
Parent:     31fccf7fe4097e62f038bdfe8f4f68ecaea8ebe7
Author:     Vadim Lobanov <[EMAIL PROTECTED]>
AuthorDate: Fri Dec 22 01:10:43 2006 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Dec 22 08:55:50 2006 -0800

    [PATCH] fdtable: Provide free_fdtable() wrapper
    
    Christoph Hellwig has expressed concerns that the recent fdtable changes
    expose the details of the RCU methodology used to release no-longer-used
    fdtable structures to the rest of the kernel.  The trivial patch below
    addresses these concerns by introducing the appropriate free_fdtable()
    calls, which simply wrap the release RCU usage.  Since free_fdtable() is a
    one-liner, it makes sense to promote it to an inline helper.
    
    Signed-off-by: Vadim Lobanov <[EMAIL PROTECTED]>
    Cc: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/file.c            |    2 +-
 include/linux/file.h |    5 +++++
 kernel/exit.c        |    2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/file.c b/fs/file.c
index 857fa49..c5575de 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -206,7 +206,7 @@ static int expand_fdtable(struct files_struct *files, int 
nr)
                copy_fdtable(new_fdt, cur_fdt);
                rcu_assign_pointer(files->fdt, new_fdt);
                if (cur_fdt->max_fds > NR_OPEN_DEFAULT)
-                       call_rcu(&cur_fdt->rcu, free_fdtable_rcu);
+                       free_fdtable(cur_fdt);
        } else {
                /* Somebody else expanded, so undo our attempt */
                free_fdarr(new_fdt);
diff --git a/include/linux/file.h b/include/linux/file.h
index edca361..a59001e 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -80,6 +80,11 @@ extern int expand_files(struct files_struct *, int nr);
 extern void free_fdtable_rcu(struct rcu_head *rcu);
 extern void __init files_defer_init(void);
 
+static inline void free_fdtable(struct fdtable *fdt)
+{
+       call_rcu(&fdt->rcu, free_fdtable_rcu);
+}
+
 static inline struct file * fcheck_files(struct files_struct *files, unsigned 
int fd)
 {
        struct file * file = NULL;
diff --git a/kernel/exit.c b/kernel/exit.c
index 122fadb..85917c2 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -468,7 +468,7 @@ void fastcall put_files_struct(struct files_struct *files)
                fdt = files_fdtable(files);
                if (fdt != &files->fdtab)
                        kmem_cache_free(files_cachep, files);
-               call_rcu(&fdt->rcu, free_fdtable_rcu);
+               free_fdtable(fdt);
        }
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to