VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / fs / file_table.c
index 5d56ec5..8996d4d 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/eventpoll.h>
 #include <linux/mount.h>
 #include <linux/cdev.h>
+#include <linux/vs_limit.h>
 
 /* sysctl tunables... */
 struct files_stat_struct files_stat = {
@@ -87,6 +88,7 @@ static int old_max;
                        f->f_owner.lock = RW_LOCK_UNLOCKED;
                        /* f->f_version: 0 */
                        INIT_LIST_HEAD(&f->f_list);
+                       vx_files_inc(f);
                        return f;
                }
        }
@@ -117,7 +119,7 @@ int open_private_file(struct file *filp, struct dentry *dentry, int flags)
        memset(filp, 0, sizeof(*filp));
        eventpoll_init_file(filp);
        filp->f_flags  = flags;
-       filp->f_mode   = (flags+1) & O_ACCMODE;
+       filp->f_mode   = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
        atomic_set(&filp->f_count, 1);
        filp->f_dentry = dentry;
        filp->f_mapping = dentry->d_inode->i_mapping;
@@ -184,6 +186,7 @@ void fastcall __fput(struct file *file)
        fops_put(file->f_op);
        if (file->f_mode & FMODE_WRITE)
                put_write_access(inode);
+       vx_files_dec(file);
        file_kill(file);
        file->f_dentry = NULL;
        file->f_vfsmnt = NULL;