X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Ffile_table.c;h=9d71ae0806a3de083d7554fd4d2cf29b9d2255b4;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=8996d4d1189241a9188af9889129bca651c50f31;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/fs/file_table.c b/fs/file_table.c index 8996d4d11..9d71ae080 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -17,6 +17,7 @@ #include #include #include +#include /* sysctl tunables... */ struct files_stat_struct files_stat = { @@ -88,6 +89,8 @@ static int old_max; f->f_owner.lock = RW_LOCK_UNLOCKED; /* f->f_version: 0 */ INIT_LIST_HEAD(&f->f_list); + // set_vx_info(&f->f_vx_info, current->vx_info); + f->f_xid = current->xid; vx_files_inc(f); return f; } @@ -108,52 +111,6 @@ fail: EXPORT_SYMBOL(get_empty_filp); -/* - * Clear and initialize a (private) struct file for the given dentry, - * allocate the security structure, and call the open function (if any). - * The file should be released using close_private_file. - */ -int open_private_file(struct file *filp, struct dentry *dentry, int flags) -{ - int error; - memset(filp, 0, sizeof(*filp)); - eventpoll_init_file(filp); - filp->f_flags = flags; - 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; - filp->f_uid = current->fsuid; - filp->f_gid = current->fsgid; - filp->f_op = dentry->d_inode->i_fop; - INIT_LIST_HEAD(&filp->f_list); - error = security_file_alloc(filp); - if (!error) - if (filp->f_op && filp->f_op->open) { - error = filp->f_op->open(dentry->d_inode, filp); - if (error) - security_file_free(filp); - } - return error; -} - -EXPORT_SYMBOL(open_private_file); - -/* - * Release a private file by calling the release function (if any) and - * freeing the security structure. - */ -void close_private_file(struct file *file) -{ - struct inode * inode = file->f_dentry->d_inode; - - if (file->f_op && file->f_op->release) - file->f_op->release(inode, file); - security_file_free(file); -} - -EXPORT_SYMBOL(close_private_file); - void fastcall fput(struct file *file) { if (atomic_dec_and_test(&file->f_count)) @@ -171,6 +128,7 @@ void fastcall __fput(struct file *file) struct vfsmount *mnt = file->f_vfsmnt; struct inode *inode = dentry->d_inode; + might_sleep(); /* * The function eventpoll_release() should be the first called * in the file cleanup chain. @@ -187,6 +145,7 @@ void fastcall __fput(struct file *file) if (file->f_mode & FMODE_WRITE) put_write_access(inode); vx_files_dec(file); + file->f_xid = 0; file_kill(file); file->f_dentry = NULL; file->f_vfsmnt = NULL; @@ -242,6 +201,8 @@ void put_filp(struct file *file) { if (atomic_dec_and_test(&file->f_count)) { security_file_free(file); + vx_files_dec(file); + file->f_xid = 0; file_kill(file); file_free(file); }