]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] fdtable: Provide free_fdtable() wrapper
authorVadim Lobanov <vlobanov@speakeasy.net>
Fri, 22 Dec 2006 09:10:43 +0000 (01:10 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 22 Dec 2006 16:55:50 +0000 (08:55 -0800)
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 <vlobanov@speakeasy.net>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/file.c
include/linux/file.h
kernel/exit.c

index 857fa49e984ca025b36a653aced4af23d56f20b5..c5575de01113eb24aa182c77b35d46d0f0fced48 100644 (file)
--- 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);
index edca361f2ab4c7babd090e42b5a43ffc64eb54ef..a59001e9ea58bb2cd91c999d6b0f9dba6ac06f7e 100644 (file)
@@ -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;
index 122fadb972fc2dd9ff3fda5cf15c3c0432a50007..85917c2bf06557b61f1c08773d32b3a044a90c34 100644 (file)
@@ -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);
        }
 }