Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
[linux-2.6-block.git] / fs / file.c
index a10487aa0a84359e42e689a3de941dacb20749e5..3da91a112babe874af392635a32e971d8885937f 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -706,7 +706,7 @@ void do_close_on_exec(struct files_struct *files)
        spin_unlock(&files->file_lock);
 }
 
-static struct file *__fget(unsigned int fd, fmode_t mask)
+static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int refs)
 {
        struct files_struct *files = current->files;
        struct file *file;
@@ -721,7 +721,7 @@ loop:
                 */
                if (file->f_mode & mask)
                        file = NULL;
-               else if (!get_file_rcu(file))
+               else if (!get_file_rcu_many(file, refs))
                        goto loop;
        }
        rcu_read_unlock();
@@ -729,15 +729,20 @@ loop:
        return file;
 }
 
+struct file *fget_many(unsigned int fd, unsigned int refs)
+{
+       return __fget(fd, FMODE_PATH, refs);
+}
+
 struct file *fget(unsigned int fd)
 {
-       return __fget(fd, FMODE_PATH);
+       return __fget(fd, FMODE_PATH, 1);
 }
 EXPORT_SYMBOL(fget);
 
 struct file *fget_raw(unsigned int fd)
 {
-       return __fget(fd, 0);
+       return __fget(fd, 0, 1);
 }
 EXPORT_SYMBOL(fget_raw);
 
@@ -768,7 +773,7 @@ static unsigned long __fget_light(unsigned int fd, fmode_t mask)
                        return 0;
                return (unsigned long)file;
        } else {
-               file = __fget(fd, mask);
+               file = __fget(fd, mask, 1);
                if (!file)
                        return 0;
                return FDPUT_FPUT | (unsigned long)file;