aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/vfs_addr.c2
-rw-r--r--fs/9p/vfs_dir.c4
-rw-r--r--fs/9p/vfs_file.c8
-rw-r--r--fs/Makefile3
-rw-r--r--fs/adfs/dir.c2
-rw-r--r--fs/affs/dir.c4
-rw-r--r--fs/afs/dir.c4
-rw-r--r--fs/afs/mntpt.c10
-rw-r--r--fs/autofs/root.c4
-rw-r--r--fs/autofs4/autofs_i.h3
-rw-r--r--fs/autofs4/root.c16
-rw-r--r--fs/befs/linuxvfs.c4
-rw-r--r--fs/bfs/dir.c2
-rw-r--r--fs/binfmt_aout.c8
-rw-r--r--fs/binfmt_elf.c6
-rw-r--r--fs/binfmt_elf_fdpic.c8
-rw-r--r--fs/binfmt_flat.c2
-rw-r--r--fs/binfmt_misc.c10
-rw-r--r--fs/block_dev.c204
-rw-r--r--fs/buffer.c33
-rw-r--r--fs/cifs/CHANGES3
-rw-r--r--fs/cifs/cifsencrypt.c4
-rw-r--r--fs/cifs/cifsfs.c4
-rw-r--r--fs/cifs/cifspdu.h8
-rw-r--r--fs/cifs/fcntl.c4
-rw-r--r--fs/cifs/file.c116
-rw-r--r--fs/cifs/readdir.c32
-rw-r--r--fs/coda/dir.c8
-rw-r--r--fs/coda/file.c14
-rw-r--r--fs/coda/inode.c2
-rw-r--r--fs/compat.c22
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/configfs/dir.c10
-rw-r--r--fs/configfs/file.c12
-rw-r--r--fs/cramfs/inode.c2
-rw-r--r--fs/direct-io.c323
-rw-r--r--fs/dnotify.c4
-rw-r--r--fs/dquot.c18
-rw-r--r--fs/ecryptfs/dentry.c3
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h16
-rw-r--r--fs/ecryptfs/file.c15
-rw-r--r--fs/ecryptfs/inode.c79
-rw-r--r--fs/ecryptfs/main.c5
-rw-r--r--fs/ecryptfs/mmap.c16
-rw-r--r--fs/efs/dir.c2
-rw-r--r--fs/eventpoll.c4
-rw-r--r--fs/exec.c17
-rw-r--r--fs/ext2/dir.c2
-rw-r--r--fs/ext2/ioctl.c2
-rw-r--r--fs/ext2/super.c6
-rw-r--r--fs/ext3/dir.c8
-rw-r--r--fs/ext3/file.c2
-rw-r--r--fs/ext3/ioctl.c2
-rw-r--r--fs/ext3/namei.c4
-rw-r--r--fs/ext3/super.c6
-rw-r--r--fs/ext4/dir.c8
-rw-r--r--fs/ext4/file.c2
-rw-r--r--fs/ext4/inode.c2
-rw-r--r--fs/ext4/ioctl.c2
-rw-r--r--fs/ext4/namei.c4
-rw-r--r--fs/fat/dir.c6
-rw-r--r--fs/fat/file.c2
-rw-r--r--fs/fcntl.c7
-rw-r--r--fs/file.c255
-rw-r--r--fs/file_table.c10
-rw-r--r--fs/freevxfs/vxfs_lookup.c2
-rw-r--r--fs/fuse/control.c2
-rw-r--r--fs/fuse/dir.c2
-rw-r--r--fs/fuse/file.c18
-rw-r--r--fs/gfs2/ops_file.c6
-rw-r--r--fs/hfs/dir.c2
-rw-r--r--fs/hfs/inode.c2
-rw-r--r--fs/hfsplus/dir.c2
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hostfs/hostfs_kern.c6
-rw-r--r--fs/hpfs/dir.c4
-rw-r--r--fs/hpfs/file.c2
-rw-r--r--fs/hppfs/hppfs_kern.c12
-rw-r--r--fs/hugetlbfs/inode.c6
-rw-r--r--fs/inode.c2
-rw-r--r--fs/inotify_user.c6
-rw-r--r--fs/ioctl.c14
-rw-r--r--fs/isofs/compress.c2
-rw-r--r--fs/isofs/dir.c5
-rw-r--r--fs/jbd/transaction.c2
-rw-r--r--fs/jffs/inode-v23.c6
-rw-r--r--fs/jffs2/dir.c6
-rw-r--r--fs/jfs/jfs_dtree.c2
-rw-r--r--fs/jfs/jfs_filsys.h42
-rw-r--r--fs/libfs.c14
-rw-r--r--fs/lockd/clntlock.c2
-rw-r--r--fs/lockd/clntproc.c2
-rw-r--r--fs/lockd/svclock.c16
-rw-r--r--fs/lockd/svcsubs.c2
-rw-r--r--fs/locks.c32
-rw-r--r--fs/minix/dir.c2
-rw-r--r--fs/namei.c15
-rw-r--r--fs/namespace.c113
-rw-r--r--fs/ncpfs/dir.c8
-rw-r--r--fs/ncpfs/file.c4
-rw-r--r--fs/ncpfs/inode.c4
-rw-r--r--fs/ncpfs/ioctl.c8
-rw-r--r--fs/ncpfs/mmap.c4
-rw-r--r--fs/nfs/dir.c18
-rw-r--r--fs/nfs/direct.c10
-rw-r--r--fs/nfs/file.c14
-rw-r--r--fs/nfs/getroot.c2
-rw-r--r--fs/nfs/idmap.c2
-rw-r--r--fs/nfs/inode.c6
-rw-r--r--fs/nfs/nfs3proc.c2
-rw-r--r--fs/nfs/proc.c2
-rw-r--r--fs/nfs/write.c4
-rw-r--r--fs/nfsd/nfs2acl.c8
-rw-r--r--fs/nfsd/nfs3acl.c8
-rw-r--r--fs/nfsd/nfs4recover.c2
-rw-r--r--fs/nfsd/nfs4state.c10
-rw-r--r--fs/nfsd/nfscache.c3
-rw-r--r--fs/nfsd/nfsctl.c2
-rw-r--r--fs/nfsd/vfs.c53
-rw-r--r--fs/ntfs/dir.c6
-rw-r--r--fs/ntfs/file.c2
-rw-r--r--fs/ocfs2/aops.c4
-rw-r--r--fs/ocfs2/dir.c2
-rw-r--r--fs/ocfs2/dlm/dlmfs.c4
-rw-r--r--fs/ocfs2/file.c34
-rw-r--r--fs/open.c30
-rw-r--r--fs/openpromfs/inode.c2
-rw-r--r--fs/partitions/Kconfig2
-rw-r--r--fs/partitions/check.c27
-rw-r--r--fs/pipe.c28
-rw-r--r--fs/pnode.c2
-rw-r--r--fs/pnode.h2
-rw-r--r--fs/proc/array.c18
-rw-r--r--fs/proc/base.c161
-rw-r--r--fs/proc/generic.c10
-rw-r--r--fs/proc/nommu.c4
-rw-r--r--fs/proc/proc_misc.c17
-rw-r--r--fs/proc/task_mmu.c8
-rw-r--r--fs/proc/task_nommu.c4
-rw-r--r--fs/qnx4/dir.c2
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/read_write.c20
-rw-r--r--fs/readdir.c2
-rw-r--r--fs/reiserfs/bitmap.c2
-rw-r--r--fs/reiserfs/dir.c4
-rw-r--r--fs/reiserfs/file.c4
-rw-r--r--fs/reiserfs/fix_node.c6
-rw-r--r--fs/reiserfs/inode.c12
-rw-r--r--fs/reiserfs/ioctl.c2
-rw-r--r--fs/reiserfs/namei.c6
-rw-r--r--fs/reiserfs/procfs.c2
-rw-r--r--fs/reiserfs/stree.c42
-rw-r--r--fs/reiserfs/super.c2
-rw-r--r--fs/reiserfs/tail_conversion.c4
-rw-r--r--fs/reiserfs/xattr.c10
-rw-r--r--fs/romfs/inode.c2
-rw-r--r--fs/select.c10
-rw-r--r--fs/seq_file.c2
-rw-r--r--fs/smbfs/cache.c2
-rw-r--r--fs/smbfs/dir.c6
-rw-r--r--fs/smbfs/file.c14
-rw-r--r--fs/smbfs/proc.c10
-rw-r--r--fs/smbfs/sock.c4
-rw-r--r--fs/splice.c18
-rw-r--r--fs/stack.c40
-rw-r--r--fs/stat.c2
-rw-r--r--fs/super.c2
-rw-r--r--fs/sync.c4
-rw-r--r--fs/sysfs/bin.c14
-rw-r--r--fs/sysfs/dir.c10
-rw-r--r--fs/sysfs/file.c16
-rw-r--r--fs/sysv/dir.c2
-rw-r--r--fs/udf/dir.c4
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/ufs/dir.c2
-rw-r--r--fs/xattr.c8
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c28
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c10
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c2
-rw-r--r--fs/xfs/xfs_dfrag.c4
182 files changed, 1299 insertions, 1351 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 9dfd259a70b4..cc24abf232d5 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -54,7 +54,7 @@ static int v9fs_vfs_readpage(struct file *filp, struct page *page)
54 int retval = -EIO; 54 int retval = -EIO;
55 loff_t offset = page_offset(page); 55 loff_t offset = page_offset(page);
56 int count = PAGE_CACHE_SIZE; 56 int count = PAGE_CACHE_SIZE;
57 struct inode *inode = filp->f_dentry->d_inode; 57 struct inode *inode = filp->f_path.dentry->d_inode;
58 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); 58 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
59 int rsize = v9ses->maxdata - V9FS_IOHDRSZ; 59 int rsize = v9ses->maxdata - V9FS_IOHDRSZ;
60 struct v9fs_fid *v9f = filp->private_data; 60 struct v9fs_fid *v9f = filp->private_data;
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 905c882f4e2f..3129688143ea 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -71,7 +71,7 @@ static inline int dt_type(struct v9fs_stat *mistat)
71static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir) 71static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
72{ 72{
73 struct v9fs_fcall *fcall = NULL; 73 struct v9fs_fcall *fcall = NULL;
74 struct inode *inode = filp->f_dentry->d_inode; 74 struct inode *inode = filp->f_path.dentry->d_inode;
75 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); 75 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
76 struct v9fs_fid *file = filp->private_data; 76 struct v9fs_fid *file = filp->private_data;
77 unsigned int i, n, s; 77 unsigned int i, n, s;
@@ -80,7 +80,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
80 struct v9fs_stat stat; 80 struct v9fs_stat stat;
81 int over = 0; 81 int over = 0;
82 82
83 dprintk(DEBUG_VFS, "name %s\n", filp->f_dentry->d_name.name); 83 dprintk(DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
84 84
85 fid = file->fid; 85 fid = file->fid;
86 86
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 79e6f9cd7340..e86a07151280 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -60,7 +60,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
60 60
61 dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file); 61 dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file);
62 62
63 vfid = v9fs_fid_lookup(file->f_dentry); 63 vfid = v9fs_fid_lookup(file->f_path.dentry);
64 if (!vfid) { 64 if (!vfid) {
65 dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n"); 65 dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n");
66 return -EBADF; 66 return -EBADF;
@@ -133,7 +133,7 @@ free_fcall:
133static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) 133static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
134{ 134{
135 int res = 0; 135 int res = 0;
136 struct inode *inode = filp->f_dentry->d_inode; 136 struct inode *inode = filp->f_path.dentry->d_inode;
137 137
138 dprintk(DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); 138 dprintk(DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
139 139
@@ -161,7 +161,7 @@ static ssize_t
161v9fs_file_read(struct file *filp, char __user * data, size_t count, 161v9fs_file_read(struct file *filp, char __user * data, size_t count,
162 loff_t * offset) 162 loff_t * offset)
163{ 163{
164 struct inode *inode = filp->f_dentry->d_inode; 164 struct inode *inode = filp->f_path.dentry->d_inode;
165 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); 165 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
166 struct v9fs_fid *v9f = filp->private_data; 166 struct v9fs_fid *v9f = filp->private_data;
167 struct v9fs_fcall *fcall = NULL; 167 struct v9fs_fcall *fcall = NULL;
@@ -225,7 +225,7 @@ static ssize_t
225v9fs_file_write(struct file *filp, const char __user * data, 225v9fs_file_write(struct file *filp, const char __user * data,
226 size_t count, loff_t * offset) 226 size_t count, loff_t * offset)
227{ 227{
228 struct inode *inode = filp->f_dentry->d_inode; 228 struct inode *inode = filp->f_path.dentry->d_inode;
229 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); 229 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
230 struct v9fs_fid *v9fid = filp->private_data; 230 struct v9fs_fid *v9fid = filp->private_data;
231 struct v9fs_fcall *fcall; 231 struct v9fs_fcall *fcall;
diff --git a/fs/Makefile b/fs/Makefile
index 9a5ce9323bfd..b9ffa63f77fc 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -10,7 +10,8 @@ obj-y := open.o read_write.o file_table.o super.o \
10 ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \ 10 ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \
11 attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \ 11 attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
12 seq_file.o xattr.o libfs.o fs-writeback.o \ 12 seq_file.o xattr.o libfs.o fs-writeback.o \
13 pnode.o drop_caches.o splice.o sync.o utimes.o 13 pnode.o drop_caches.o splice.o sync.o utimes.o \
14 stack.o
14 15
15ifeq ($(CONFIG_BLOCK),y) 16ifeq ($(CONFIG_BLOCK),y)
16obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o 17obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index d3c7905b2ddc..2b8903893d3f 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -28,7 +28,7 @@ static DEFINE_RWLOCK(adfs_dir_lock);
28static int 28static int
29adfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 29adfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
30{ 30{
31 struct inode *inode = filp->f_dentry->d_inode; 31 struct inode *inode = filp->f_path.dentry->d_inode;
32 struct super_block *sb = inode->i_sb; 32 struct super_block *sb = inode->i_sb;
33 struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir; 33 struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
34 struct object_info obj; 34 struct object_info obj;
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index 5d9649fa1814..cad3ee340063 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -41,7 +41,7 @@ struct inode_operations affs_dir_inode_operations = {
41static int 41static int
42affs_readdir(struct file *filp, void *dirent, filldir_t filldir) 42affs_readdir(struct file *filp, void *dirent, filldir_t filldir)
43{ 43{
44 struct inode *inode = filp->f_dentry->d_inode; 44 struct inode *inode = filp->f_path.dentry->d_inode;
45 struct super_block *sb = inode->i_sb; 45 struct super_block *sb = inode->i_sb;
46 struct buffer_head *dir_bh; 46 struct buffer_head *dir_bh;
47 struct buffer_head *fh_bh; 47 struct buffer_head *fh_bh;
@@ -71,7 +71,7 @@ affs_readdir(struct file *filp, void *dirent, filldir_t filldir)
71 stored++; 71 stored++;
72 } 72 }
73 if (f_pos == 1) { 73 if (f_pos == 1) {
74 if (filldir(dirent, "..", 2, f_pos, parent_ino(filp->f_dentry), DT_DIR) < 0) 74 if (filldir(dirent, "..", 2, f_pos, parent_ino(filp->f_path.dentry), DT_DIR) < 0)
75 return stored; 75 return stored;
76 filp->f_pos = f_pos = 2; 76 filp->f_pos = f_pos = 2;
77 stored++; 77 stored++;
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index a6ec75c56fcf..4acd04134055 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -392,10 +392,10 @@ static int afs_dir_readdir(struct file *file, void *cookie, filldir_t filldir)
392 unsigned fpos; 392 unsigned fpos;
393 int ret; 393 int ret;
394 394
395 _enter("{%Ld,{%lu}}", file->f_pos, file->f_dentry->d_inode->i_ino); 395 _enter("{%Ld,{%lu}}", file->f_pos, file->f_path.dentry->d_inode->i_ino);
396 396
397 fpos = file->f_pos; 397 fpos = file->f_pos;
398 ret = afs_dir_iterate(file->f_dentry->d_inode, &fpos, cookie, filldir); 398 ret = afs_dir_iterate(file->f_path.dentry->d_inode, &fpos, cookie, filldir);
399 file->f_pos = fpos; 399 file->f_pos = fpos;
400 400
401 _leave(" = %d", ret); 401 _leave(" = %d", ret);
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 99785a79d043..8f74e8450826 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -18,7 +18,7 @@
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/mount.h> 19#include <linux/mount.h>
20#include <linux/namei.h> 20#include <linux/namei.h>
21#include <linux/namespace.h> 21#include <linux/mnt_namespace.h>
22#include "super.h" 22#include "super.h"
23#include "cell.h" 23#include "cell.h"
24#include "volume.h" 24#include "volume.h"
@@ -136,11 +136,11 @@ static int afs_mntpt_open(struct inode *inode, struct file *file)
136{ 136{
137 kenter("%p,%p{%p{%s},%s}", 137 kenter("%p,%p{%p{%s},%s}",
138 inode, file, 138 inode, file,
139 file->f_dentry->d_parent, 139 file->f_path.dentry->d_parent,
140 file->f_dentry->d_parent ? 140 file->f_path.dentry->d_parent ?
141 file->f_dentry->d_parent->d_name.name : 141 file->f_path.dentry->d_parent->d_name.name :
142 (const unsigned char *) "", 142 (const unsigned char *) "",
143 file->f_dentry->d_name.name); 143 file->f_path.dentry->d_name.name);
144 144
145 return -EREMOTE; 145 return -EREMOTE;
146} /* end afs_mntpt_open() */ 146} /* end afs_mntpt_open() */
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 368a1c33a3c8..e698c51d2b02 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -45,7 +45,7 @@ static int autofs_root_readdir(struct file *filp, void *dirent, filldir_t filldi
45 struct autofs_dir_ent *ent = NULL; 45 struct autofs_dir_ent *ent = NULL;
46 struct autofs_dirhash *dirhash; 46 struct autofs_dirhash *dirhash;
47 struct autofs_sb_info *sbi; 47 struct autofs_sb_info *sbi;
48 struct inode * inode = filp->f_dentry->d_inode; 48 struct inode * inode = filp->f_path.dentry->d_inode;
49 off_t onr, nr; 49 off_t onr, nr;
50 50
51 lock_kernel(); 51 lock_kernel();
@@ -557,7 +557,7 @@ static int autofs_root_ioctl(struct inode *inode, struct file *filp,
557 case AUTOFS_IOC_SETTIMEOUT: 557 case AUTOFS_IOC_SETTIMEOUT:
558 return autofs_get_set_timeout(sbi, argp); 558 return autofs_get_set_timeout(sbi, argp);
559 case AUTOFS_IOC_EXPIRE: 559 case AUTOFS_IOC_EXPIRE:
560 return autofs_expire_run(inode->i_sb, sbi, filp->f_vfsmnt, 560 return autofs_expire_run(inode->i_sb, sbi, filp->f_path.mnt,
561 argp); 561 argp);
562 default: 562 default:
563 return -ENOSYS; 563 return -ENOSYS;
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index b13f32c8aeee..216b1a364ccb 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -150,7 +150,8 @@ static inline int autofs4_ispending(struct dentry *dentry)
150 150
151static inline void autofs4_copy_atime(struct file *src, struct file *dst) 151static inline void autofs4_copy_atime(struct file *src, struct file *dst)
152{ 152{
153 dst->f_dentry->d_inode->i_atime = src->f_dentry->d_inode->i_atime; 153 dst->f_path.dentry->d_inode->i_atime =
154 src->f_path.dentry->d_inode->i_atime;
154 return; 155 return;
155} 156}
156 157
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index c1493524da4d..8d05b9f7578d 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -74,7 +74,7 @@ struct inode_operations autofs4_dir_inode_operations = {
74static int autofs4_root_readdir(struct file *file, void *dirent, 74static int autofs4_root_readdir(struct file *file, void *dirent,
75 filldir_t filldir) 75 filldir_t filldir)
76{ 76{
77 struct autofs_sb_info *sbi = autofs4_sbi(file->f_dentry->d_sb); 77 struct autofs_sb_info *sbi = autofs4_sbi(file->f_path.dentry->d_sb);
78 int oz_mode = autofs4_oz_mode(sbi); 78 int oz_mode = autofs4_oz_mode(sbi);
79 79
80 DPRINTK("called, filp->f_pos = %lld", file->f_pos); 80 DPRINTK("called, filp->f_pos = %lld", file->f_pos);
@@ -95,8 +95,8 @@ static int autofs4_root_readdir(struct file *file, void *dirent,
95 95
96static int autofs4_dir_open(struct inode *inode, struct file *file) 96static int autofs4_dir_open(struct inode *inode, struct file *file)
97{ 97{
98 struct dentry *dentry = file->f_dentry; 98 struct dentry *dentry = file->f_path.dentry;
99 struct vfsmount *mnt = file->f_vfsmnt; 99 struct vfsmount *mnt = file->f_path.mnt;
100 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 100 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
101 struct dentry *cursor; 101 struct dentry *cursor;
102 int status; 102 int status;
@@ -172,7 +172,7 @@ out:
172 172
173static int autofs4_dir_close(struct inode *inode, struct file *file) 173static int autofs4_dir_close(struct inode *inode, struct file *file)
174{ 174{
175 struct dentry *dentry = file->f_dentry; 175 struct dentry *dentry = file->f_path.dentry;
176 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 176 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
177 struct dentry *cursor = file->private_data; 177 struct dentry *cursor = file->private_data;
178 int status = 0; 178 int status = 0;
@@ -204,7 +204,7 @@ out:
204 204
205static int autofs4_dir_readdir(struct file *file, void *dirent, filldir_t filldir) 205static int autofs4_dir_readdir(struct file *file, void *dirent, filldir_t filldir)
206{ 206{
207 struct dentry *dentry = file->f_dentry; 207 struct dentry *dentry = file->f_path.dentry;
208 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 208 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
209 struct dentry *cursor = file->private_data; 209 struct dentry *cursor = file->private_data;
210 int status; 210 int status;
@@ -858,14 +858,14 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp,
858 return autofs4_ask_reghost(sbi, p); 858 return autofs4_ask_reghost(sbi, p);
859 859
860 case AUTOFS_IOC_ASKUMOUNT: 860 case AUTOFS_IOC_ASKUMOUNT:
861 return autofs4_ask_umount(filp->f_vfsmnt, p); 861 return autofs4_ask_umount(filp->f_path.mnt, p);
862 862
863 /* return a single thing to expire */ 863 /* return a single thing to expire */
864 case AUTOFS_IOC_EXPIRE: 864 case AUTOFS_IOC_EXPIRE:
865 return autofs4_expire_run(inode->i_sb,filp->f_vfsmnt,sbi, p); 865 return autofs4_expire_run(inode->i_sb,filp->f_path.mnt,sbi, p);
866 /* same as above, but can send multiple expires through pipe */ 866 /* same as above, but can send multiple expires through pipe */
867 case AUTOFS_IOC_EXPIRE_MULTI: 867 case AUTOFS_IOC_EXPIRE_MULTI:
868 return autofs4_expire_multi(inode->i_sb,filp->f_vfsmnt,sbi, p); 868 return autofs4_expire_multi(inode->i_sb,filp->f_path.mnt,sbi, p);
869 869
870 default: 870 default:
871 return -ENOSYS; 871 return -ENOSYS;
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index bce402eee554..481e59b9d91c 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -212,7 +212,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
212static int 212static int
213befs_readdir(struct file *filp, void *dirent, filldir_t filldir) 213befs_readdir(struct file *filp, void *dirent, filldir_t filldir)
214{ 214{
215 struct inode *inode = filp->f_dentry->d_inode; 215 struct inode *inode = filp->f_path.dentry->d_inode;
216 struct super_block *sb = inode->i_sb; 216 struct super_block *sb = inode->i_sb;
217 befs_data_stream *ds = &BEFS_I(inode)->i_data.ds; 217 befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
218 befs_off_t value; 218 befs_off_t value;
@@ -222,7 +222,7 @@ befs_readdir(struct file *filp, void *dirent, filldir_t filldir)
222 char keybuf[BEFS_NAME_LEN + 1]; 222 char keybuf[BEFS_NAME_LEN + 1];
223 char *nlsname; 223 char *nlsname;
224 int nlsnamelen; 224 int nlsnamelen;
225 const char *dirname = filp->f_dentry->d_name.name; 225 const char *dirname = filp->f_path.dentry->d_name.name;
226 226
227 befs_debug(sb, "---> befs_readdir() " 227 befs_debug(sb, "---> befs_readdir() "
228 "name %s, inode %ld, filp->f_pos %Ld", 228 "name %s, inode %ld, filp->f_pos %Ld",
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index a650f1d0b85e..2a746e688df5 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -27,7 +27,7 @@ static struct buffer_head * bfs_find_entry(struct inode * dir,
27 27
28static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) 28static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir)
29{ 29{
30 struct inode * dir = f->f_dentry->d_inode; 30 struct inode * dir = f->f_path.dentry->d_inode;
31 struct buffer_head * bh; 31 struct buffer_head * bh;
32 struct bfs_dirent * de; 32 struct bfs_dirent * de;
33 unsigned int offset; 33 unsigned int offset;
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 517e111bb7ef..813a887cd2b3 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -274,7 +274,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
274 if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && 274 if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
275 N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || 275 N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) ||
276 N_TRSIZE(ex) || N_DRSIZE(ex) || 276 N_TRSIZE(ex) || N_DRSIZE(ex) ||
277 i_size_read(bprm->file->f_dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { 277 i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
278 return -ENOEXEC; 278 return -ENOEXEC;
279 } 279 }
280 280
@@ -389,7 +389,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
389 { 389 {
390 printk(KERN_WARNING 390 printk(KERN_WARNING
391 "fd_offset is not page aligned. Please convert program: %s\n", 391 "fd_offset is not page aligned. Please convert program: %s\n",
392 bprm->file->f_dentry->d_name.name); 392 bprm->file->f_path.dentry->d_name.name);
393 error_time = jiffies; 393 error_time = jiffies;
394 } 394 }
395 395
@@ -469,7 +469,7 @@ static int load_aout_library(struct file *file)
469 int retval; 469 int retval;
470 struct exec ex; 470 struct exec ex;
471 471
472 inode = file->f_dentry->d_inode; 472 inode = file->f_path.dentry->d_inode;
473 473
474 retval = -ENOEXEC; 474 retval = -ENOEXEC;
475 error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); 475 error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
@@ -506,7 +506,7 @@ static int load_aout_library(struct file *file)
506 { 506 {
507 printk(KERN_WARNING 507 printk(KERN_WARNING
508 "N_TXTOFF is not page aligned. Please convert library: %s\n", 508 "N_TXTOFF is not page aligned. Please convert library: %s\n",
509 file->f_dentry->d_name.name); 509 file->f_path.dentry->d_name.name);
510 error_time = jiffies; 510 error_time = jiffies;
511 } 511 }
512 down_write(&current->mm->mmap_sem); 512 down_write(&current->mm->mmap_sem);
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index be5869d34999..d3adfd353ff9 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1190,7 +1190,7 @@ static int maydump(struct vm_area_struct *vma)
1190 1190
1191 /* Dump shared memory only if mapped from an anonymous file. */ 1191 /* Dump shared memory only if mapped from an anonymous file. */
1192 if (vma->vm_flags & VM_SHARED) 1192 if (vma->vm_flags & VM_SHARED)
1193 return vma->vm_file->f_dentry->d_inode->i_nlink == 0; 1193 return vma->vm_file->f_path.dentry->d_inode->i_nlink == 0;
1194 1194
1195 /* If it hasn't been written to, don't write it out */ 1195 /* If it hasn't been written to, don't write it out */
1196 if (!vma->anon_vma) 1196 if (!vma->anon_vma)
@@ -1317,7 +1317,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
1317 prstatus->pr_pid = p->pid; 1317 prstatus->pr_pid = p->pid;
1318 prstatus->pr_ppid = p->parent->pid; 1318 prstatus->pr_ppid = p->parent->pid;
1319 prstatus->pr_pgrp = process_group(p); 1319 prstatus->pr_pgrp = process_group(p);
1320 prstatus->pr_sid = p->signal->session; 1320 prstatus->pr_sid = process_session(p);
1321 if (thread_group_leader(p)) { 1321 if (thread_group_leader(p)) {
1322 /* 1322 /*
1323 * This is the record for the group leader. Add in the 1323 * This is the record for the group leader. Add in the
@@ -1363,7 +1363,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
1363 psinfo->pr_pid = p->pid; 1363 psinfo->pr_pid = p->pid;
1364 psinfo->pr_ppid = p->parent->pid; 1364 psinfo->pr_ppid = p->parent->pid;
1365 psinfo->pr_pgrp = process_group(p); 1365 psinfo->pr_pgrp = process_group(p);
1366 psinfo->pr_sid = p->signal->session; 1366 psinfo->pr_sid = process_session(p);
1367 1367
1368 i = p->state ? ffz(~p->state) + 1 : 0; 1368 i = p->state ? ffz(~p->state) + 1 : 0;
1369 psinfo->pr_state = i; 1369 psinfo->pr_state = i;
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index ed9a61c6beb3..76f06f6bc2f6 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -855,7 +855,7 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
855 855
856dynamic_error: 856dynamic_error:
857 printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n", 857 printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
858 what, file->f_dentry->d_inode->i_ino); 858 what, file->f_path.dentry->d_inode->i_ino);
859 return -ELIBBAD; 859 return -ELIBBAD;
860} 860}
861 861
@@ -1186,7 +1186,7 @@ static int maydump(struct vm_area_struct *vma)
1186 1186
1187 /* Dump shared memory only if mapped from an anonymous file. */ 1187 /* Dump shared memory only if mapped from an anonymous file. */
1188 if (vma->vm_flags & VM_SHARED) { 1188 if (vma->vm_flags & VM_SHARED) {
1189 if (vma->vm_file->f_dentry->d_inode->i_nlink == 0) { 1189 if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) {
1190 kdcore("%08lx: %08lx: no (share)", vma->vm_start, vma->vm_flags); 1190 kdcore("%08lx: %08lx: no (share)", vma->vm_start, vma->vm_flags);
1191 return 1; 1191 return 1;
1192 } 1192 }
@@ -1322,7 +1322,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
1322 prstatus->pr_pid = p->pid; 1322 prstatus->pr_pid = p->pid;
1323 prstatus->pr_ppid = p->parent->pid; 1323 prstatus->pr_ppid = p->parent->pid;
1324 prstatus->pr_pgrp = process_group(p); 1324 prstatus->pr_pgrp = process_group(p);
1325 prstatus->pr_sid = p->signal->session; 1325 prstatus->pr_sid = process_session(p);
1326 if (thread_group_leader(p)) { 1326 if (thread_group_leader(p)) {
1327 /* 1327 /*
1328 * This is the record for the group leader. Add in the 1328 * This is the record for the group leader. Add in the
@@ -1371,7 +1371,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
1371 psinfo->pr_pid = p->pid; 1371 psinfo->pr_pid = p->pid;
1372 psinfo->pr_ppid = p->parent->pid; 1372 psinfo->pr_ppid = p->parent->pid;
1373 psinfo->pr_pgrp = process_group(p); 1373 psinfo->pr_pgrp = process_group(p);
1374 psinfo->pr_sid = p->signal->session; 1374 psinfo->pr_sid = process_session(p);
1375 1375
1376 i = p->state ? ffz(~p->state) + 1 : 0; 1376 i = p->state ? ffz(~p->state) + 1 : 0;
1377 psinfo->pr_state = i; 1377 psinfo->pr_state = i;
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index a62fd4018a20..ae8595d49856 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -429,7 +429,7 @@ static int load_flat_file(struct linux_binprm * bprm,
429 int ret; 429 int ret;
430 430
431 hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ 431 hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */
432 inode = bprm->file->f_dentry->d_inode; 432 inode = bprm->file->f_path.dentry->d_inode;
433 433
434 text_len = ntohl(hdr->data_start); 434 text_len = ntohl(hdr->data_start);
435 data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start); 435 data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start);
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 1713c48fef54..00687ea62738 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -542,7 +542,7 @@ static void kill_node(Node *e)
542static ssize_t 542static ssize_t
543bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) 543bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
544{ 544{
545 Node *e = file->f_dentry->d_inode->i_private; 545 Node *e = file->f_path.dentry->d_inode->i_private;
546 loff_t pos = *ppos; 546 loff_t pos = *ppos;
547 ssize_t res; 547 ssize_t res;
548 char *page; 548 char *page;
@@ -576,7 +576,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
576 size_t count, loff_t *ppos) 576 size_t count, loff_t *ppos)
577{ 577{
578 struct dentry *root; 578 struct dentry *root;
579 Node *e = file->f_dentry->d_inode->i_private; 579 Node *e = file->f_path.dentry->d_inode->i_private;
580 int res = parse_command(buffer, count); 580 int res = parse_command(buffer, count);
581 581
582 switch (res) { 582 switch (res) {
@@ -584,7 +584,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
584 break; 584 break;
585 case 2: set_bit(Enabled, &e->flags); 585 case 2: set_bit(Enabled, &e->flags);
586 break; 586 break;
587 case 3: root = dget(file->f_vfsmnt->mnt_sb->s_root); 587 case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
588 mutex_lock(&root->d_inode->i_mutex); 588 mutex_lock(&root->d_inode->i_mutex);
589 589
590 kill_node(e); 590 kill_node(e);
@@ -610,7 +610,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
610 Node *e; 610 Node *e;
611 struct inode *inode; 611 struct inode *inode;
612 struct dentry *root, *dentry; 612 struct dentry *root, *dentry;
613 struct super_block *sb = file->f_vfsmnt->mnt_sb; 613 struct super_block *sb = file->f_path.mnt->mnt_sb;
614 int err = 0; 614 int err = 0;
615 615
616 e = create_entry(buffer, count); 616 e = create_entry(buffer, count);
@@ -699,7 +699,7 @@ static ssize_t bm_status_write(struct file * file, const char __user * buffer,
699 switch (res) { 699 switch (res) {
700 case 1: enabled = 0; break; 700 case 1: enabled = 0; break;
701 case 2: enabled = 1; break; 701 case 2: enabled = 1; break;
702 case 3: root = dget(file->f_vfsmnt->mnt_sb->s_root); 702 case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
703 mutex_lock(&root->d_inode->i_mutex); 703 mutex_lock(&root->d_inode->i_mutex);
704 704
705 while (!list_empty(&entries)) 705 while (!list_empty(&entries))
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 13816b4d76f6..197f93921847 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -190,7 +190,7 @@ static int blkdev_commit_write(struct file *file, struct page *page, unsigned fr
190 190
191/* 191/*
192 * private llseek: 192 * private llseek:
193 * for a block special file file->f_dentry->d_inode->i_size is zero 193 * for a block special file file->f_path.dentry->d_inode->i_size is zero
194 * so we compute the size by hand (just as in block_read/write above) 194 * so we compute the size by hand (just as in block_read/write above)
195 */ 195 */
196static loff_t block_llseek(struct file *file, loff_t offset, int origin) 196static loff_t block_llseek(struct file *file, loff_t offset, int origin)
@@ -762,7 +762,7 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
762 if (!bo) 762 if (!bo)
763 return -ENOMEM; 763 return -ENOMEM;
764 764
765 mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION); 765 mutex_lock(&bdev->bd_mutex);
766 res = bd_claim(bdev, holder); 766 res = bd_claim(bdev, holder);
767 if (res == 0) { 767 if (res == 0) {
768 found = find_bd_holder(bdev, bo); 768 found = find_bd_holder(bdev, bo);
@@ -796,7 +796,7 @@ static void bd_release_from_kobject(struct block_device *bdev,
796 if (!kobj) 796 if (!kobj)
797 return; 797 return;
798 798
799 mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION); 799 mutex_lock(&bdev->bd_mutex);
800 bd_release(bdev); 800 bd_release(bdev);
801 if ((bo = del_bd_holder(bdev, kobj))) 801 if ((bo = del_bd_holder(bdev, kobj)))
802 free_bd_holder(bo); 802 free_bd_holder(bo);
@@ -854,22 +854,6 @@ struct block_device *open_by_devnum(dev_t dev, unsigned mode)
854 854
855EXPORT_SYMBOL(open_by_devnum); 855EXPORT_SYMBOL(open_by_devnum);
856 856
857static int
858blkdev_get_partition(struct block_device *bdev, mode_t mode, unsigned flags);
859
860struct block_device *open_partition_by_devnum(dev_t dev, unsigned mode)
861{
862 struct block_device *bdev = bdget(dev);
863 int err = -ENOMEM;
864 int flags = mode & FMODE_WRITE ? O_RDWR : O_RDONLY;
865 if (bdev)
866 err = blkdev_get_partition(bdev, mode, flags);
867 return err ? ERR_PTR(err) : bdev;
868}
869
870EXPORT_SYMBOL(open_partition_by_devnum);
871
872
873/* 857/*
874 * This routine checks whether a removable media has been changed, 858 * This routine checks whether a removable media has been changed,
875 * and invalidates all buffer-cache-entries in that case. This 859 * and invalidates all buffer-cache-entries in that case. This
@@ -916,66 +900,11 @@ void bd_set_size(struct block_device *bdev, loff_t size)
916} 900}
917EXPORT_SYMBOL(bd_set_size); 901EXPORT_SYMBOL(bd_set_size);
918 902
919static int __blkdev_put(struct block_device *bdev, unsigned int subclass) 903static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
920{ 904 int for_part);
921 int ret = 0; 905static int __blkdev_put(struct block_device *bdev, int for_part);
922 struct inode *bd_inode = bdev->bd_inode;
923 struct gendisk *disk = bdev->bd_disk;
924
925 mutex_lock_nested(&bdev->bd_mutex, subclass);
926 lock_kernel();
927 if (!--bdev->bd_openers) {
928 sync_blockdev(bdev);
929 kill_bdev(bdev);
930 }
931 if (bdev->bd_contains == bdev) {
932 if (disk->fops->release)
933 ret = disk->fops->release(bd_inode, NULL);
934 } else {
935 mutex_lock_nested(&bdev->bd_contains->bd_mutex,
936 subclass + 1);
937 bdev->bd_contains->bd_part_count--;
938 mutex_unlock(&bdev->bd_contains->bd_mutex);
939 }
940 if (!bdev->bd_openers) {
941 struct module *owner = disk->fops->owner;
942
943 put_disk(disk);
944 module_put(owner);
945
946 if (bdev->bd_contains != bdev) {
947 kobject_put(&bdev->bd_part->kobj);
948 bdev->bd_part = NULL;
949 }
950 bdev->bd_disk = NULL;
951 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
952 if (bdev != bdev->bd_contains)
953 __blkdev_put(bdev->bd_contains, subclass + 1);
954 bdev->bd_contains = NULL;
955 }
956 unlock_kernel();
957 mutex_unlock(&bdev->bd_mutex);
958 bdput(bdev);
959 return ret;
960}
961
962int blkdev_put(struct block_device *bdev)
963{
964 return __blkdev_put(bdev, BD_MUTEX_NORMAL);
965}
966EXPORT_SYMBOL(blkdev_put);
967
968int blkdev_put_partition(struct block_device *bdev)
969{
970 return __blkdev_put(bdev, BD_MUTEX_PARTITION);
971}
972EXPORT_SYMBOL(blkdev_put_partition);
973 906
974static int 907static int do_open(struct block_device *bdev, struct file *file, int for_part)
975blkdev_get_whole(struct block_device *bdev, mode_t mode, unsigned flags);
976
977static int
978do_open(struct block_device *bdev, struct file *file, unsigned int subclass)
979{ 908{
980 struct module *owner = NULL; 909 struct module *owner = NULL;
981 struct gendisk *disk; 910 struct gendisk *disk;
@@ -992,8 +921,7 @@ do_open(struct block_device *bdev, struct file *file, unsigned int subclass)
992 } 921 }
993 owner = disk->fops->owner; 922 owner = disk->fops->owner;
994 923
995 mutex_lock_nested(&bdev->bd_mutex, subclass); 924 mutex_lock_nested(&bdev->bd_mutex, for_part);
996
997 if (!bdev->bd_openers) { 925 if (!bdev->bd_openers) {
998 bdev->bd_disk = disk; 926 bdev->bd_disk = disk;
999 bdev->bd_contains = bdev; 927 bdev->bd_contains = bdev;
@@ -1020,25 +948,21 @@ do_open(struct block_device *bdev, struct file *file, unsigned int subclass)
1020 ret = -ENOMEM; 948 ret = -ENOMEM;
1021 if (!whole) 949 if (!whole)
1022 goto out_first; 950 goto out_first;
1023 ret = blkdev_get_whole(whole, file->f_mode, file->f_flags); 951 BUG_ON(for_part);
952 ret = __blkdev_get(whole, file->f_mode, file->f_flags, 1);
1024 if (ret) 953 if (ret)
1025 goto out_first; 954 goto out_first;
1026 bdev->bd_contains = whole; 955 bdev->bd_contains = whole;
1027 mutex_lock_nested(&whole->bd_mutex, BD_MUTEX_WHOLE);
1028 whole->bd_part_count++;
1029 p = disk->part[part - 1]; 956 p = disk->part[part - 1];
1030 bdev->bd_inode->i_data.backing_dev_info = 957 bdev->bd_inode->i_data.backing_dev_info =
1031 whole->bd_inode->i_data.backing_dev_info; 958 whole->bd_inode->i_data.backing_dev_info;
1032 if (!(disk->flags & GENHD_FL_UP) || !p || !p->nr_sects) { 959 if (!(disk->flags & GENHD_FL_UP) || !p || !p->nr_sects) {
1033 whole->bd_part_count--;
1034 mutex_unlock(&whole->bd_mutex);
1035 ret = -ENXIO; 960 ret = -ENXIO;
1036 goto out_first; 961 goto out_first;
1037 } 962 }
1038 kobject_get(&p->kobj); 963 kobject_get(&p->kobj);
1039 bdev->bd_part = p; 964 bdev->bd_part = p;
1040 bd_set_size(bdev, (loff_t) p->nr_sects << 9); 965 bd_set_size(bdev, (loff_t) p->nr_sects << 9);
1041 mutex_unlock(&whole->bd_mutex);
1042 } 966 }
1043 } else { 967 } else {
1044 put_disk(disk); 968 put_disk(disk);
@@ -1051,14 +975,11 @@ do_open(struct block_device *bdev, struct file *file, unsigned int subclass)
1051 } 975 }
1052 if (bdev->bd_invalidated) 976 if (bdev->bd_invalidated)
1053 rescan_partitions(bdev->bd_disk, bdev); 977 rescan_partitions(bdev->bd_disk, bdev);
1054 } else {
1055 mutex_lock_nested(&bdev->bd_contains->bd_mutex,
1056 BD_MUTEX_WHOLE);
1057 bdev->bd_contains->bd_part_count++;
1058 mutex_unlock(&bdev->bd_contains->bd_mutex);
1059 } 978 }
1060 } 979 }
1061 bdev->bd_openers++; 980 bdev->bd_openers++;
981 if (for_part)
982 bdev->bd_part_count++;
1062 mutex_unlock(&bdev->bd_mutex); 983 mutex_unlock(&bdev->bd_mutex);
1063 unlock_kernel(); 984 unlock_kernel();
1064 return 0; 985 return 0;
@@ -1067,7 +988,7 @@ out_first:
1067 bdev->bd_disk = NULL; 988 bdev->bd_disk = NULL;
1068 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info; 989 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
1069 if (bdev != bdev->bd_contains) 990 if (bdev != bdev->bd_contains)
1070 __blkdev_put(bdev->bd_contains, BD_MUTEX_WHOLE); 991 __blkdev_put(bdev->bd_contains, 1);
1071 bdev->bd_contains = NULL; 992 bdev->bd_contains = NULL;
1072 put_disk(disk); 993 put_disk(disk);
1073 module_put(owner); 994 module_put(owner);
@@ -1079,7 +1000,8 @@ out:
1079 return ret; 1000 return ret;
1080} 1001}
1081 1002
1082int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags) 1003static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
1004 int for_part)
1083{ 1005{
1084 /* 1006 /*
1085 * This crockload is due to bad choice of ->open() type. 1007 * This crockload is due to bad choice of ->open() type.
@@ -1091,51 +1013,17 @@ int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags)
1091 struct dentry fake_dentry = {}; 1013 struct dentry fake_dentry = {};
1092 fake_file.f_mode = mode; 1014 fake_file.f_mode = mode;
1093 fake_file.f_flags = flags; 1015 fake_file.f_flags = flags;
1094 fake_file.f_dentry = &fake_dentry; 1016 fake_file.f_path.dentry = &fake_dentry;
1095 fake_dentry.d_inode = bdev->bd_inode; 1017 fake_dentry.d_inode = bdev->bd_inode;
1096 1018
1097 return do_open(bdev, &fake_file, BD_MUTEX_NORMAL); 1019 return do_open(bdev, &fake_file, for_part);
1098} 1020}
1099 1021
1100EXPORT_SYMBOL(blkdev_get); 1022int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags)
1101
1102static int
1103blkdev_get_whole(struct block_device *bdev, mode_t mode, unsigned flags)
1104{
1105 /*
1106 * This crockload is due to bad choice of ->open() type.
1107 * It will go away.
1108 * For now, block device ->open() routine must _not_
1109 * examine anything in 'inode' argument except ->i_rdev.
1110 */
1111 struct file fake_file = {};
1112 struct dentry fake_dentry = {};
1113 fake_file.f_mode = mode;
1114 fake_file.f_flags = flags;
1115 fake_file.f_dentry = &fake_dentry;
1116 fake_dentry.d_inode = bdev->bd_inode;
1117
1118 return do_open(bdev, &fake_file, BD_MUTEX_WHOLE);
1119}
1120
1121static int
1122blkdev_get_partition(struct block_device *bdev, mode_t mode, unsigned flags)
1123{ 1023{
1124 /* 1024 return __blkdev_get(bdev, mode, flags, 0);
1125 * This crockload is due to bad choice of ->open() type.
1126 * It will go away.
1127 * For now, block device ->open() routine must _not_
1128 * examine anything in 'inode' argument except ->i_rdev.
1129 */
1130 struct file fake_file = {};
1131 struct dentry fake_dentry = {};
1132 fake_file.f_mode = mode;
1133 fake_file.f_flags = flags;
1134 fake_file.f_dentry = &fake_dentry;
1135 fake_dentry.d_inode = bdev->bd_inode;
1136
1137 return do_open(bdev, &fake_file, BD_MUTEX_PARTITION);
1138} 1025}
1026EXPORT_SYMBOL(blkdev_get);
1139 1027
1140static int blkdev_open(struct inode * inode, struct file * filp) 1028static int blkdev_open(struct inode * inode, struct file * filp)
1141{ 1029{
@@ -1154,7 +1042,7 @@ static int blkdev_open(struct inode * inode, struct file * filp)
1154 if (bdev == NULL) 1042 if (bdev == NULL)
1155 return -ENOMEM; 1043 return -ENOMEM;
1156 1044
1157 res = do_open(bdev, filp, BD_MUTEX_NORMAL); 1045 res = do_open(bdev, filp, 0);
1158 if (res) 1046 if (res)
1159 return res; 1047 return res;
1160 1048
@@ -1168,6 +1056,56 @@ static int blkdev_open(struct inode * inode, struct file * filp)
1168 return res; 1056 return res;
1169} 1057}
1170 1058
1059static int __blkdev_put(struct block_device *bdev, int for_part)
1060{
1061 int ret = 0;
1062 struct inode *bd_inode = bdev->bd_inode;
1063 struct gendisk *disk = bdev->bd_disk;
1064 struct block_device *victim = NULL;
1065
1066 mutex_lock_nested(&bdev->bd_mutex, for_part);
1067 lock_kernel();
1068 if (for_part)
1069 bdev->bd_part_count--;
1070
1071 if (!--bdev->bd_openers) {
1072 sync_blockdev(bdev);
1073 kill_bdev(bdev);
1074 }
1075 if (bdev->bd_contains == bdev) {
1076 if (disk->fops->release)
1077 ret = disk->fops->release(bd_inode, NULL);
1078 }
1079 if (!bdev->bd_openers) {
1080 struct module *owner = disk->fops->owner;
1081
1082 put_disk(disk);
1083 module_put(owner);
1084
1085 if (bdev->bd_contains != bdev) {
1086 kobject_put(&bdev->bd_part->kobj);
1087 bdev->bd_part = NULL;
1088 }
1089 bdev->bd_disk = NULL;
1090 bdev->bd_inode->i_data.backing_dev_info = &default_backing_dev_info;
1091 if (bdev != bdev->bd_contains)
1092 victim = bdev->bd_contains;
1093 bdev->bd_contains = NULL;
1094 }
1095 unlock_kernel();
1096 mutex_unlock(&bdev->bd_mutex);
1097 bdput(bdev);
1098 if (victim)
1099 __blkdev_put(victim, 1);
1100 return ret;
1101}
1102
1103int blkdev_put(struct block_device *bdev)
1104{
1105 return __blkdev_put(bdev, 0);
1106}
1107EXPORT_SYMBOL(blkdev_put);
1108
1171static int blkdev_close(struct inode * inode, struct file * filp) 1109static int blkdev_close(struct inode * inode, struct file * filp)
1172{ 1110{
1173 struct block_device *bdev = I_BDEV(filp->f_mapping->host); 1111 struct block_device *bdev = I_BDEV(filp->f_mapping->host);
diff --git a/fs/buffer.c b/fs/buffer.c
index 517860f2d75b..d1f1b54d3108 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -35,6 +35,7 @@
35#include <linux/hash.h> 35#include <linux/hash.h>
36#include <linux/suspend.h> 36#include <linux/suspend.h>
37#include <linux/buffer_head.h> 37#include <linux/buffer_head.h>
38#include <linux/task_io_accounting_ops.h>
38#include <linux/bio.h> 39#include <linux/bio.h>
39#include <linux/notifier.h> 40#include <linux/notifier.h>
40#include <linux/cpu.h> 41#include <linux/cpu.h>
@@ -724,20 +725,21 @@ int __set_page_dirty_buffers(struct page *page)
724 } 725 }
725 spin_unlock(&mapping->private_lock); 726 spin_unlock(&mapping->private_lock);
726 727
727 if (!TestSetPageDirty(page)) { 728 if (TestSetPageDirty(page))
728 write_lock_irq(&mapping->tree_lock); 729 return 0;
729 if (page->mapping) { /* Race with truncate? */ 730
730 if (mapping_cap_account_dirty(mapping)) 731 write_lock_irq(&mapping->tree_lock);
731 __inc_zone_page_state(page, NR_FILE_DIRTY); 732 if (page->mapping) { /* Race with truncate? */
732 radix_tree_tag_set(&mapping->page_tree, 733 if (mapping_cap_account_dirty(mapping)) {
733 page_index(page), 734 __inc_zone_page_state(page, NR_FILE_DIRTY);
734 PAGECACHE_TAG_DIRTY); 735 task_io_account_write(PAGE_CACHE_SIZE);
735 } 736 }
736 write_unlock_irq(&mapping->tree_lock); 737 radix_tree_tag_set(&mapping->page_tree,
737 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); 738 page_index(page), PAGECACHE_TAG_DIRTY);
738 return 1;
739 } 739 }
740 return 0; 740 write_unlock_irq(&mapping->tree_lock);
741 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
742 return 1;
741} 743}
742EXPORT_SYMBOL(__set_page_dirty_buffers); 744EXPORT_SYMBOL(__set_page_dirty_buffers);
743 745
@@ -2851,8 +2853,13 @@ int try_to_free_buffers(struct page *page)
2851 * could encounter a non-uptodate page, which is unresolvable. 2853 * could encounter a non-uptodate page, which is unresolvable.
2852 * This only applies in the rare case where try_to_free_buffers 2854 * This only applies in the rare case where try_to_free_buffers
2853 * succeeds but the page is not freed. 2855 * succeeds but the page is not freed.
2856 *
2857 * Also, during truncate, discard_buffer will have marked all
2858 * the page's buffers clean. We discover that here and clean
2859 * the page also.
2854 */ 2860 */
2855 clear_page_dirty(page); 2861 if (test_clear_page_dirty(page))
2862 task_io_account_cancelled_write(PAGE_CACHE_SIZE);
2856 } 2863 }
2857out: 2864out:
2858 if (buffers_to_free) { 2865 if (buffers_to_free) {
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 0b3c37ef52e0..3539d6ef9611 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -5,7 +5,8 @@ Allow null user to be specified on mount ("username="). Do not return
5EINVAL on readdir when filldir fails due to overwritten blocksize 5EINVAL on readdir when filldir fails due to overwritten blocksize
6(fixes FC problem). Return error in rename 2nd attempt retry (ie report 6(fixes FC problem). Return error in rename 2nd attempt retry (ie report
7if rename by handle also fails, after rename by path fails, we were 7if rename by handle also fails, after rename by path fails, we were
8not reporting whether the retry worked or not). 8not reporting whether the retry worked or not). Fix NTLMv2 to
9work to Windows servers (mount with option "sec=ntlmv2").
9 10
10Version 1.45 11Version 1.45
11------------ 12------------
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 4bc250b2d9fc..fdeda519eace 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -372,8 +372,10 @@ void setup_ntlmv2_rsp(struct cifsSesInfo * ses, char * resp_buf,
372 buf->time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); 372 buf->time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME));
373 get_random_bytes(&buf->client_chal, sizeof(buf->client_chal)); 373 get_random_bytes(&buf->client_chal, sizeof(buf->client_chal));
374 buf->reserved2 = 0; 374 buf->reserved2 = 0;
375 buf->names[0].type = 0; 375 buf->names[0].type = cpu_to_le16(NTLMSSP_DOMAIN_TYPE);
376 buf->names[0].length = 0; 376 buf->names[0].length = 0;
377 buf->names[1].type = 0;
378 buf->names[1].length = 0;
377 379
378 /* calculate buf->ntlmv2_hash */ 380 /* calculate buf->ntlmv2_hash */
379 rc = calc_ntlmv2_hash(ses, nls_cp); 381 rc = calc_ntlmv2_hash(ses, nls_cp);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 71bc87a37fc1..10c90294cd18 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -498,7 +498,7 @@ cifs_get_sb(struct file_system_type *fs_type,
498static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, 498static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
499 unsigned long nr_segs, loff_t pos) 499 unsigned long nr_segs, loff_t pos)
500{ 500{
501 struct inode *inode = iocb->ki_filp->f_dentry->d_inode; 501 struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
502 ssize_t written; 502 ssize_t written;
503 503
504 written = generic_file_aio_write(iocb, iov, nr_segs, pos); 504 written = generic_file_aio_write(iocb, iov, nr_segs, pos);
@@ -511,7 +511,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
511{ 511{
512 /* origin == SEEK_END => we must revalidate the cached file length */ 512 /* origin == SEEK_END => we must revalidate the cached file length */
513 if (origin == SEEK_END) { 513 if (origin == SEEK_END) {
514 int retval = cifs_revalidate(file->f_dentry); 514 int retval = cifs_revalidate(file->f_path.dentry);
515 if (retval < 0) 515 if (retval < 0)
516 return (loff_t)retval; 516 return (loff_t)retval;
517 } 517 }
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 6df9dadba647..068ef51edbf7 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -580,6 +580,12 @@ typedef union smb_com_session_setup_andx {
580 580
581/* format of NLTMv2 Response ie "case sensitive password" hash when NTLMv2 */ 581/* format of NLTMv2 Response ie "case sensitive password" hash when NTLMv2 */
582 582
583#define NTLMSSP_SERVER_TYPE 1
584#define NTLMSSP_DOMAIN_TYPE 2
585#define NTLMSSP_FQ_DOMAIN_TYPE 3
586#define NTLMSSP_DNS_DOMAIN_TYPE 4
587#define NTLMSSP_DNS_PARENT_TYPE 5
588
583struct ntlmssp2_name { 589struct ntlmssp2_name {
584 __le16 type; 590 __le16 type;
585 __le16 length; 591 __le16 length;
@@ -593,7 +599,7 @@ struct ntlmv2_resp {
593 __le64 time; 599 __le64 time;
594 __u64 client_chal; /* random */ 600 __u64 client_chal; /* random */
595 __u32 reserved2; 601 __u32 reserved2;
596 struct ntlmssp2_name names[1]; 602 struct ntlmssp2_name names[2];
597 /* array of name entries could follow ending in minimum 4 byte struct */ 603 /* array of name entries could follow ending in minimum 4 byte struct */
598} __attribute__((packed)); 604} __attribute__((packed));
599 605
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c
index d91a3d44e9e3..da12b482ebe5 100644
--- a/fs/cifs/fcntl.c
+++ b/fs/cifs/fcntl.c
@@ -83,10 +83,10 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
83 return 0; 83 return 0;
84 84
85 xid = GetXid(); 85 xid = GetXid();
86 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 86 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
87 pTcon = cifs_sb->tcon; 87 pTcon = cifs_sb->tcon;
88 88
89 full_path = build_path_from_dentry(file->f_dentry); 89 full_path = build_path_from_dentry(file->f_path.dentry);
90 90
91 if(full_path == NULL) { 91 if(full_path == NULL) {
92 rc = -ENOMEM; 92 rc = -ENOMEM;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 2436ed8fc840..0f05cab5d24a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -29,6 +29,7 @@
29#include <linux/pagevec.h> 29#include <linux/pagevec.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
31#include <linux/writeback.h> 31#include <linux/writeback.h>
32#include <linux/task_io_accounting_ops.h>
32#include <linux/delay.h> 33#include <linux/delay.h>
33#include <asm/div64.h> 34#include <asm/div64.h>
34#include "cifsfs.h" 35#include "cifsfs.h"
@@ -122,34 +123,34 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
122 /* if not oplocked, invalidate inode pages if mtime or file 123 /* if not oplocked, invalidate inode pages if mtime or file
123 size changed */ 124 size changed */
124 temp = cifs_NTtimeToUnix(le64_to_cpu(buf->LastWriteTime)); 125 temp = cifs_NTtimeToUnix(le64_to_cpu(buf->LastWriteTime));
125 if (timespec_equal(&file->f_dentry->d_inode->i_mtime, &temp) && 126 if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) &&
126 (file->f_dentry->d_inode->i_size == 127 (file->f_path.dentry->d_inode->i_size ==
127 (loff_t)le64_to_cpu(buf->EndOfFile))) { 128 (loff_t)le64_to_cpu(buf->EndOfFile))) {
128 cFYI(1, ("inode unchanged on server")); 129 cFYI(1, ("inode unchanged on server"));
129 } else { 130 } else {
130 if (file->f_dentry->d_inode->i_mapping) { 131 if (file->f_path.dentry->d_inode->i_mapping) {
131 /* BB no need to lock inode until after invalidate 132 /* BB no need to lock inode until after invalidate
132 since namei code should already have it locked? */ 133 since namei code should already have it locked? */
133 filemap_write_and_wait(file->f_dentry->d_inode->i_mapping); 134 filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);
134 } 135 }
135 cFYI(1, ("invalidating remote inode since open detected it " 136 cFYI(1, ("invalidating remote inode since open detected it "
136 "changed")); 137 "changed"));
137 invalidate_remote_inode(file->f_dentry->d_inode); 138 invalidate_remote_inode(file->f_path.dentry->d_inode);
138 } 139 }
139 140
140client_can_cache: 141client_can_cache:
141 if (pTcon->ses->capabilities & CAP_UNIX) 142 if (pTcon->ses->capabilities & CAP_UNIX)
142 rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode, 143 rc = cifs_get_inode_info_unix(&file->f_path.dentry->d_inode,
143 full_path, inode->i_sb, xid); 144 full_path, inode->i_sb, xid);
144 else 145 else
145 rc = cifs_get_inode_info(&file->f_dentry->d_inode, 146 rc = cifs_get_inode_info(&file->f_path.dentry->d_inode,
146 full_path, buf, inode->i_sb, xid); 147 full_path, buf, inode->i_sb, xid);
147 148
148 if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { 149 if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
149 pCifsInode->clientCanCacheAll = TRUE; 150 pCifsInode->clientCanCacheAll = TRUE;
150 pCifsInode->clientCanCacheRead = TRUE; 151 pCifsInode->clientCanCacheRead = TRUE;
151 cFYI(1, ("Exclusive Oplock granted on inode %p", 152 cFYI(1, ("Exclusive Oplock granted on inode %p",
152 file->f_dentry->d_inode)); 153 file->f_path.dentry->d_inode));
153 } else if ((*oplock & 0xF) == OPLOCK_READ) 154 } else if ((*oplock & 0xF) == OPLOCK_READ)
154 pCifsInode->clientCanCacheRead = TRUE; 155 pCifsInode->clientCanCacheRead = TRUE;
155 156
@@ -178,7 +179,7 @@ int cifs_open(struct inode *inode, struct file *file)
178 179
179 if (file->f_flags & O_CREAT) { 180 if (file->f_flags & O_CREAT) {
180 /* search inode for this file and fill in file->private_data */ 181 /* search inode for this file and fill in file->private_data */
181 pCifsInode = CIFS_I(file->f_dentry->d_inode); 182 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
182 read_lock(&GlobalSMBSeslock); 183 read_lock(&GlobalSMBSeslock);
183 list_for_each(tmp, &pCifsInode->openFileList) { 184 list_for_each(tmp, &pCifsInode->openFileList) {
184 pCifsFile = list_entry(tmp, struct cifsFileInfo, 185 pCifsFile = list_entry(tmp, struct cifsFileInfo,
@@ -206,7 +207,7 @@ int cifs_open(struct inode *inode, struct file *file)
206 } 207 }
207 } 208 }
208 209
209 full_path = build_path_from_dentry(file->f_dentry); 210 full_path = build_path_from_dentry(file->f_path.dentry);
210 if (full_path == NULL) { 211 if (full_path == NULL) {
211 FreeXid(xid); 212 FreeXid(xid);
212 return -ENOMEM; 213 return -ENOMEM;
@@ -291,7 +292,7 @@ int cifs_open(struct inode *inode, struct file *file)
291 write_lock(&GlobalSMBSeslock); 292 write_lock(&GlobalSMBSeslock);
292 list_add(&pCifsFile->tlist, &pTcon->openFileList); 293 list_add(&pCifsFile->tlist, &pTcon->openFileList);
293 294
294 pCifsInode = CIFS_I(file->f_dentry->d_inode); 295 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
295 if (pCifsInode) { 296 if (pCifsInode) {
296 rc = cifs_open_inode_helper(inode, file, pCifsInode, 297 rc = cifs_open_inode_helper(inode, file, pCifsInode,
297 pCifsFile, pTcon, 298 pCifsFile, pTcon,
@@ -366,7 +367,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
366 return 0; 367 return 0;
367 } 368 }
368 369
369 if (file->f_dentry == NULL) { 370 if (file->f_path.dentry == NULL) {
370 up(&pCifsFile->fh_sem); 371 up(&pCifsFile->fh_sem);
371 cFYI(1, ("failed file reopen, no valid name if dentry freed")); 372 cFYI(1, ("failed file reopen, no valid name if dentry freed"));
372 FreeXid(xid); 373 FreeXid(xid);
@@ -378,7 +379,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
378 those that already have the rename sem can end up causing writepage 379 those that already have the rename sem can end up causing writepage
379 to get called and if the server was down that means we end up here, 380 to get called and if the server was down that means we end up here,
380 and we can never tell if the caller already has the rename_sem */ 381 and we can never tell if the caller already has the rename_sem */
381 full_path = build_path_from_dentry(file->f_dentry); 382 full_path = build_path_from_dentry(file->f_path.dentry);
382 if (full_path == NULL) { 383 if (full_path == NULL) {
383 up(&pCifsFile->fh_sem); 384 up(&pCifsFile->fh_sem);
384 FreeXid(xid); 385 FreeXid(xid);
@@ -444,7 +445,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
444 pCifsInode->clientCanCacheAll = TRUE; 445 pCifsInode->clientCanCacheAll = TRUE;
445 pCifsInode->clientCanCacheRead = TRUE; 446 pCifsInode->clientCanCacheRead = TRUE;
446 cFYI(1, ("Exclusive Oplock granted on inode %p", 447 cFYI(1, ("Exclusive Oplock granted on inode %p",
447 file->f_dentry->d_inode)); 448 file->f_path.dentry->d_inode));
448 } else if ((oplock & 0xF) == OPLOCK_READ) { 449 } else if ((oplock & 0xF) == OPLOCK_READ) {
449 pCifsInode->clientCanCacheRead = TRUE; 450 pCifsInode->clientCanCacheRead = TRUE;
450 pCifsInode->clientCanCacheAll = FALSE; 451 pCifsInode->clientCanCacheAll = FALSE;
@@ -551,7 +552,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
551 552
552 if (pCFileStruct) { 553 if (pCFileStruct) {
553 struct cifsTconInfo *pTcon; 554 struct cifsTconInfo *pTcon;
554 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_dentry->d_sb); 555 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
555 556
556 pTcon = cifs_sb->tcon; 557 pTcon = cifs_sb->tcon;
557 558
@@ -664,7 +665,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
664 } else 665 } else
665 cFYI(1, ("Unknown type of lock")); 666 cFYI(1, ("Unknown type of lock"));
666 667
667 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 668 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
668 pTcon = cifs_sb->tcon; 669 pTcon = cifs_sb->tcon;
669 670
670 if (file->private_data == NULL) { 671 if (file->private_data == NULL) {
@@ -791,10 +792,10 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
791 int xid, long_op; 792 int xid, long_op;
792 struct cifsFileInfo *open_file; 793 struct cifsFileInfo *open_file;
793 794
794 if (file->f_dentry == NULL) 795 if (file->f_path.dentry == NULL)
795 return -EBADF; 796 return -EBADF;
796 797
797 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 798 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
798 if (cifs_sb == NULL) 799 if (cifs_sb == NULL)
799 return -EBADF; 800 return -EBADF;
800 801
@@ -802,7 +803,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
802 803
803 /* cFYI(1, 804 /* cFYI(1,
804 (" write %d bytes to offset %lld of %s", write_size, 805 (" write %d bytes to offset %lld of %s", write_size,
805 *poffset, file->f_dentry->d_name.name)); */ 806 *poffset, file->f_path.dentry->d_name.name)); */
806 807
807 if (file->private_data == NULL) 808 if (file->private_data == NULL)
808 return -EBADF; 809 return -EBADF;
@@ -810,12 +811,12 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
810 open_file = (struct cifsFileInfo *) file->private_data; 811 open_file = (struct cifsFileInfo *) file->private_data;
811 812
812 xid = GetXid(); 813 xid = GetXid();
813 if (file->f_dentry->d_inode == NULL) { 814 if (file->f_path.dentry->d_inode == NULL) {
814 FreeXid(xid); 815 FreeXid(xid);
815 return -EBADF; 816 return -EBADF;
816 } 817 }
817 818
818 if (*poffset > file->f_dentry->d_inode->i_size) 819 if (*poffset > file->f_path.dentry->d_inode->i_size)
819 long_op = 2; /* writes past end of file can take a long time */ 820 long_op = 2; /* writes past end of file can take a long time */
820 else 821 else
821 long_op = 1; 822 long_op = 1;
@@ -840,8 +841,8 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
840 return -EBADF; 841 return -EBADF;
841 } 842 }
842 if (open_file->invalidHandle) { 843 if (open_file->invalidHandle) {
843 if ((file->f_dentry == NULL) || 844 if ((file->f_path.dentry == NULL) ||
844 (file->f_dentry->d_inode == NULL)) { 845 (file->f_path.dentry->d_inode == NULL)) {
845 FreeXid(xid); 846 FreeXid(xid);
846 return total_written; 847 return total_written;
847 } 848 }
@@ -849,7 +850,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
849 filemap_fdatawait from here so tell 850 filemap_fdatawait from here so tell
850 reopen_file not to flush data to server 851 reopen_file not to flush data to server
851 now */ 852 now */
852 rc = cifs_reopen_file(file->f_dentry->d_inode, 853 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
853 file, FALSE); 854 file, FALSE);
854 if (rc != 0) 855 if (rc != 0)
855 break; 856 break;
@@ -878,17 +879,17 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
878 cifs_stats_bytes_written(pTcon, total_written); 879 cifs_stats_bytes_written(pTcon, total_written);
879 880
880 /* since the write may have blocked check these pointers again */ 881 /* since the write may have blocked check these pointers again */
881 if (file->f_dentry) { 882 if (file->f_path.dentry) {
882 if (file->f_dentry->d_inode) { 883 if (file->f_path.dentry->d_inode) {
883 struct inode *inode = file->f_dentry->d_inode; 884 struct inode *inode = file->f_path.dentry->d_inode;
884 inode->i_ctime = inode->i_mtime = 885 inode->i_ctime = inode->i_mtime =
885 current_fs_time(inode->i_sb); 886 current_fs_time(inode->i_sb);
886 if (total_written > 0) { 887 if (total_written > 0) {
887 if (*poffset > file->f_dentry->d_inode->i_size) 888 if (*poffset > file->f_path.dentry->d_inode->i_size)
888 i_size_write(file->f_dentry->d_inode, 889 i_size_write(file->f_path.dentry->d_inode,
889 *poffset); 890 *poffset);
890 } 891 }
891 mark_inode_dirty_sync(file->f_dentry->d_inode); 892 mark_inode_dirty_sync(file->f_path.dentry->d_inode);
892 } 893 }
893 } 894 }
894 FreeXid(xid); 895 FreeXid(xid);
@@ -906,17 +907,17 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
906 int xid, long_op; 907 int xid, long_op;
907 struct cifsFileInfo *open_file; 908 struct cifsFileInfo *open_file;
908 909
909 if (file->f_dentry == NULL) 910 if (file->f_path.dentry == NULL)
910 return -EBADF; 911 return -EBADF;
911 912
912 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 913 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
913 if (cifs_sb == NULL) 914 if (cifs_sb == NULL)
914 return -EBADF; 915 return -EBADF;
915 916
916 pTcon = cifs_sb->tcon; 917 pTcon = cifs_sb->tcon;
917 918
918 cFYI(1,("write %zd bytes to offset %lld of %s", write_size, 919 cFYI(1,("write %zd bytes to offset %lld of %s", write_size,
919 *poffset, file->f_dentry->d_name.name)); 920 *poffset, file->f_path.dentry->d_name.name));
920 921
921 if (file->private_data == NULL) 922 if (file->private_data == NULL)
922 return -EBADF; 923 return -EBADF;
@@ -924,12 +925,12 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
924 open_file = (struct cifsFileInfo *)file->private_data; 925 open_file = (struct cifsFileInfo *)file->private_data;
925 926
926 xid = GetXid(); 927 xid = GetXid();
927 if (file->f_dentry->d_inode == NULL) { 928 if (file->f_path.dentry->d_inode == NULL) {
928 FreeXid(xid); 929 FreeXid(xid);
929 return -EBADF; 930 return -EBADF;
930 } 931 }
931 932
932 if (*poffset > file->f_dentry->d_inode->i_size) 933 if (*poffset > file->f_path.dentry->d_inode->i_size)
933 long_op = 2; /* writes past end of file can take a long time */ 934 long_op = 2; /* writes past end of file can take a long time */
934 else 935 else
935 long_op = 1; 936 long_op = 1;
@@ -955,8 +956,8 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
955 return -EBADF; 956 return -EBADF;
956 } 957 }
957 if (open_file->invalidHandle) { 958 if (open_file->invalidHandle) {
958 if ((file->f_dentry == NULL) || 959 if ((file->f_path.dentry == NULL) ||
959 (file->f_dentry->d_inode == NULL)) { 960 (file->f_path.dentry->d_inode == NULL)) {
960 FreeXid(xid); 961 FreeXid(xid);
961 return total_written; 962 return total_written;
962 } 963 }
@@ -964,7 +965,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
964 filemap_fdatawait from here so tell 965 filemap_fdatawait from here so tell
965 reopen_file not to flush data to 966 reopen_file not to flush data to
966 server now */ 967 server now */
967 rc = cifs_reopen_file(file->f_dentry->d_inode, 968 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
968 file, FALSE); 969 file, FALSE);
969 if (rc != 0) 970 if (rc != 0)
970 break; 971 break;
@@ -1011,16 +1012,16 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
1011 cifs_stats_bytes_written(pTcon, total_written); 1012 cifs_stats_bytes_written(pTcon, total_written);
1012 1013
1013 /* since the write may have blocked check these pointers again */ 1014 /* since the write may have blocked check these pointers again */
1014 if (file->f_dentry) { 1015 if (file->f_path.dentry) {
1015 if (file->f_dentry->d_inode) { 1016 if (file->f_path.dentry->d_inode) {
1016 file->f_dentry->d_inode->i_ctime = 1017 file->f_path.dentry->d_inode->i_ctime =
1017 file->f_dentry->d_inode->i_mtime = CURRENT_TIME; 1018 file->f_path.dentry->d_inode->i_mtime = CURRENT_TIME;
1018 if (total_written > 0) { 1019 if (total_written > 0) {
1019 if (*poffset > file->f_dentry->d_inode->i_size) 1020 if (*poffset > file->f_path.dentry->d_inode->i_size)
1020 i_size_write(file->f_dentry->d_inode, 1021 i_size_write(file->f_path.dentry->d_inode,
1021 *poffset); 1022 *poffset);
1022 } 1023 }
1023 mark_inode_dirty_sync(file->f_dentry->d_inode); 1024 mark_inode_dirty_sync(file->f_path.dentry->d_inode);
1024 } 1025 }
1025 } 1026 }
1026 FreeXid(xid); 1027 FreeXid(xid);
@@ -1384,7 +1385,7 @@ static int cifs_commit_write(struct file *file, struct page *page,
1384 if ((open_file->invalidHandle) && 1385 if ((open_file->invalidHandle) &&
1385 (!open_file->closePend)) { 1386 (!open_file->closePend)) {
1386 rc = cifs_reopen_file( 1387 rc = cifs_reopen_file(
1387 file->f_dentry->d_inode, file); 1388 file->f_path.dentry->d_inode, file);
1388 if (rc != 0) 1389 if (rc != 0)
1389 break; 1390 break;
1390 } 1391 }
@@ -1434,7 +1435,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1434{ 1435{
1435 int xid; 1436 int xid;
1436 int rc = 0; 1437 int rc = 0;
1437 struct inode *inode = file->f_dentry->d_inode; 1438 struct inode *inode = file->f_path.dentry->d_inode;
1438 1439
1439 xid = GetXid(); 1440 xid = GetXid();
1440 1441
@@ -1482,7 +1483,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1482 */ 1483 */
1483int cifs_flush(struct file *file, fl_owner_t id) 1484int cifs_flush(struct file *file, fl_owner_t id)
1484{ 1485{
1485 struct inode * inode = file->f_dentry->d_inode; 1486 struct inode * inode = file->f_path.dentry->d_inode;
1486 int rc = 0; 1487 int rc = 0;
1487 1488
1488 /* Rather than do the steps manually: 1489 /* Rather than do the steps manually:
@@ -1519,7 +1520,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1519 struct smb_com_read_rsp *pSMBr; 1520 struct smb_com_read_rsp *pSMBr;
1520 1521
1521 xid = GetXid(); 1522 xid = GetXid();
1522 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1523 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1523 pTcon = cifs_sb->tcon; 1524 pTcon = cifs_sb->tcon;
1524 1525
1525 if (file->private_data == NULL) { 1526 if (file->private_data == NULL) {
@@ -1542,7 +1543,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1542 int buf_type = CIFS_NO_BUFFER; 1543 int buf_type = CIFS_NO_BUFFER;
1543 if ((open_file->invalidHandle) && 1544 if ((open_file->invalidHandle) &&
1544 (!open_file->closePend)) { 1545 (!open_file->closePend)) {
1545 rc = cifs_reopen_file(file->f_dentry->d_inode, 1546 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
1546 file, TRUE); 1547 file, TRUE);
1547 if (rc != 0) 1548 if (rc != 0)
1548 break; 1549 break;
@@ -1601,7 +1602,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1601 int buf_type = CIFS_NO_BUFFER; 1602 int buf_type = CIFS_NO_BUFFER;
1602 1603
1603 xid = GetXid(); 1604 xid = GetXid();
1604 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1605 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1605 pTcon = cifs_sb->tcon; 1606 pTcon = cifs_sb->tcon;
1606 1607
1607 if (file->private_data == NULL) { 1608 if (file->private_data == NULL) {
@@ -1629,7 +1630,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1629 while (rc == -EAGAIN) { 1630 while (rc == -EAGAIN) {
1630 if ((open_file->invalidHandle) && 1631 if ((open_file->invalidHandle) &&
1631 (!open_file->closePend)) { 1632 (!open_file->closePend)) {
1632 rc = cifs_reopen_file(file->f_dentry->d_inode, 1633 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
1633 file, TRUE); 1634 file, TRUE);
1634 if (rc != 0) 1635 if (rc != 0)
1635 break; 1636 break;
@@ -1658,7 +1659,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1658 1659
1659int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) 1660int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
1660{ 1661{
1661 struct dentry *dentry = file->f_dentry; 1662 struct dentry *dentry = file->f_path.dentry;
1662 int rc, xid; 1663 int rc, xid;
1663 1664
1664 xid = GetXid(); 1665 xid = GetXid();
@@ -1744,7 +1745,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1744 return -EBADF; 1745 return -EBADF;
1745 } 1746 }
1746 open_file = (struct cifsFileInfo *)file->private_data; 1747 open_file = (struct cifsFileInfo *)file->private_data;
1747 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1748 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1748 pTcon = cifs_sb->tcon; 1749 pTcon = cifs_sb->tcon;
1749 1750
1750 pagevec_init(&lru_pvec, 0); 1751 pagevec_init(&lru_pvec, 0);
@@ -1786,7 +1787,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1786 while (rc == -EAGAIN) { 1787 while (rc == -EAGAIN) {
1787 if ((open_file->invalidHandle) && 1788 if ((open_file->invalidHandle) &&
1788 (!open_file->closePend)) { 1789 (!open_file->closePend)) {
1789 rc = cifs_reopen_file(file->f_dentry->d_inode, 1790 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
1790 file, TRUE); 1791 file, TRUE);
1791 if (rc != 0) 1792 if (rc != 0)
1792 break; 1793 break;
@@ -1812,6 +1813,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1812 cFYI(1, ("Read error in readpages: %d", rc)); 1813 cFYI(1, ("Read error in readpages: %d", rc));
1813 break; 1814 break;
1814 } else if (bytes_read > 0) { 1815 } else if (bytes_read > 0) {
1816 task_io_account_read(bytes_read);
1815 pSMBr = (struct smb_com_read_rsp *)smb_read_data; 1817 pSMBr = (struct smb_com_read_rsp *)smb_read_data;
1816 cifs_copy_cache_pages(mapping, page_list, bytes_read, 1818 cifs_copy_cache_pages(mapping, page_list, bytes_read,
1817 smb_read_data + 4 /* RFC1001 hdr */ + 1819 smb_read_data + 4 /* RFC1001 hdr */ +
@@ -1880,8 +1882,8 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
1880 else 1882 else
1881 cFYI(1, ("Bytes read %d",rc)); 1883 cFYI(1, ("Bytes read %d",rc));
1882 1884
1883 file->f_dentry->d_inode->i_atime = 1885 file->f_path.dentry->d_inode->i_atime =
1884 current_fs_time(file->f_dentry->d_inode->i_sb); 1886 current_fs_time(file->f_path.dentry->d_inode->i_sb);
1885 1887
1886 if (PAGE_CACHE_SIZE > rc) 1888 if (PAGE_CACHE_SIZE > rc)
1887 memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc); 1889 memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index ed18c3965f7b..99dfb5337e31 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -68,30 +68,30 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
68 int rc = 0; 68 int rc = 0;
69 69
70 cFYI(1, ("For %s", qstring->name)); 70 cFYI(1, ("For %s", qstring->name));
71 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 71 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
72 pTcon = cifs_sb->tcon; 72 pTcon = cifs_sb->tcon;
73 73
74 qstring->hash = full_name_hash(qstring->name, qstring->len); 74 qstring->hash = full_name_hash(qstring->name, qstring->len);
75 tmp_dentry = d_lookup(file->f_dentry, qstring); 75 tmp_dentry = d_lookup(file->f_path.dentry, qstring);
76 if (tmp_dentry) { 76 if (tmp_dentry) {
77 cFYI(0, ("existing dentry with inode 0x%p", tmp_dentry->d_inode)); 77 cFYI(0, ("existing dentry with inode 0x%p", tmp_dentry->d_inode));
78 *ptmp_inode = tmp_dentry->d_inode; 78 *ptmp_inode = tmp_dentry->d_inode;
79/* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/ 79/* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/
80 if(*ptmp_inode == NULL) { 80 if(*ptmp_inode == NULL) {
81 *ptmp_inode = new_inode(file->f_dentry->d_sb); 81 *ptmp_inode = new_inode(file->f_path.dentry->d_sb);
82 if(*ptmp_inode == NULL) 82 if(*ptmp_inode == NULL)
83 return rc; 83 return rc;
84 rc = 1; 84 rc = 1;
85 } 85 }
86 } else { 86 } else {
87 tmp_dentry = d_alloc(file->f_dentry, qstring); 87 tmp_dentry = d_alloc(file->f_path.dentry, qstring);
88 if(tmp_dentry == NULL) { 88 if(tmp_dentry == NULL) {
89 cERROR(1,("Failed allocating dentry")); 89 cERROR(1,("Failed allocating dentry"));
90 *ptmp_inode = NULL; 90 *ptmp_inode = NULL;
91 return rc; 91 return rc;
92 } 92 }
93 93
94 *ptmp_inode = new_inode(file->f_dentry->d_sb); 94 *ptmp_inode = new_inode(file->f_path.dentry->d_sb);
95 if (pTcon->nocase) 95 if (pTcon->nocase)
96 tmp_dentry->d_op = &cifs_ci_dentry_ops; 96 tmp_dentry->d_op = &cifs_ci_dentry_ops;
97 else 97 else
@@ -432,10 +432,10 @@ static int initiate_cifs_search(const int xid, struct file *file)
432 cifsFile->invalidHandle = TRUE; 432 cifsFile->invalidHandle = TRUE;
433 cifsFile->srch_inf.endOfSearch = FALSE; 433 cifsFile->srch_inf.endOfSearch = FALSE;
434 434
435 if(file->f_dentry == NULL) 435 if(file->f_path.dentry == NULL)
436 return -ENOENT; 436 return -ENOENT;
437 437
438 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 438 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
439 if(cifs_sb == NULL) 439 if(cifs_sb == NULL)
440 return -EINVAL; 440 return -EINVAL;
441 441
@@ -443,7 +443,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
443 if(pTcon == NULL) 443 if(pTcon == NULL)
444 return -EINVAL; 444 return -EINVAL;
445 445
446 full_path = build_path_from_dentry(file->f_dentry); 446 full_path = build_path_from_dentry(file->f_path.dentry);
447 447
448 if(full_path == NULL) { 448 if(full_path == NULL) {
449 return -ENOMEM; 449 return -ENOMEM;
@@ -609,10 +609,10 @@ static int is_dir_changed(struct file * file)
609 struct inode * inode; 609 struct inode * inode;
610 struct cifsInodeInfo *cifsInfo; 610 struct cifsInodeInfo *cifsInfo;
611 611
612 if(file->f_dentry == NULL) 612 if(file->f_path.dentry == NULL)
613 return 0; 613 return 0;
614 614
615 inode = file->f_dentry->d_inode; 615 inode = file->f_path.dentry->d_inode;
616 616
617 if(inode == NULL) 617 if(inode == NULL)
618 return 0; 618 return 0;
@@ -839,7 +839,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
839 if((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL)) 839 if((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL))
840 return -ENOENT; 840 return -ENOENT;
841 841
842 if(file->f_dentry == NULL) 842 if(file->f_path.dentry == NULL)
843 return -ENOENT; 843 return -ENOENT;
844 844
845 rc = cifs_entry_is_dot(pfindEntry,pCifsF); 845 rc = cifs_entry_is_dot(pfindEntry,pCifsF);
@@ -847,7 +847,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
847 if(rc != 0) 847 if(rc != 0)
848 return 0; 848 return 0;
849 849
850 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 850 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
851 851
852 qstring.name = scratch_buf; 852 qstring.name = scratch_buf;
853 rc = cifs_get_name_from_search_buf(&qstring,pfindEntry, 853 rc = cifs_get_name_from_search_buf(&qstring,pfindEntry,
@@ -985,12 +985,12 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
985 985
986 xid = GetXid(); 986 xid = GetXid();
987 987
988 if(file->f_dentry == NULL) { 988 if(file->f_path.dentry == NULL) {
989 FreeXid(xid); 989 FreeXid(xid);
990 return -EIO; 990 return -EIO;
991 } 991 }
992 992
993 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 993 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
994 pTcon = cifs_sb->tcon; 994 pTcon = cifs_sb->tcon;
995 if(pTcon == NULL) 995 if(pTcon == NULL)
996 return -EINVAL; 996 return -EINVAL;
@@ -998,7 +998,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
998 switch ((int) file->f_pos) { 998 switch ((int) file->f_pos) {
999 case 0: 999 case 0:
1000 if (filldir(direntry, ".", 1, file->f_pos, 1000 if (filldir(direntry, ".", 1, file->f_pos,
1001 file->f_dentry->d_inode->i_ino, DT_DIR) < 0) { 1001 file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) {
1002 cERROR(1, ("Filldir for current dir failed")); 1002 cERROR(1, ("Filldir for current dir failed"));
1003 rc = -ENOMEM; 1003 rc = -ENOMEM;
1004 break; 1004 break;
@@ -1006,7 +1006,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
1006 file->f_pos++; 1006 file->f_pos++;
1007 case 1: 1007 case 1:
1008 if (filldir(direntry, "..", 2, file->f_pos, 1008 if (filldir(direntry, "..", 2, file->f_pos,
1009 file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { 1009 file->f_path.dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) {
1010 cERROR(1, ("Filldir for parent dir failed")); 1010 cERROR(1, ("Filldir for parent dir failed"));
1011 rc = -ENOMEM; 1011 rc = -ENOMEM;
1012 break; 1012 break;
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 0102b28a15fb..0c6f7f3b3dd7 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -441,7 +441,7 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
441/* file operations for directories */ 441/* file operations for directories */
442int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir) 442int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir)
443{ 443{
444 struct dentry *coda_dentry = coda_file->f_dentry; 444 struct dentry *coda_dentry = coda_file->f_path.dentry;
445 struct coda_file_info *cfi; 445 struct coda_file_info *cfi;
446 struct file *host_file; 446 struct file *host_file;
447 struct inode *host_inode; 447 struct inode *host_inode;
@@ -453,7 +453,7 @@ int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir)
453 453
454 coda_vfs_stat.readdir++; 454 coda_vfs_stat.readdir++;
455 455
456 host_inode = host_file->f_dentry->d_inode; 456 host_inode = host_file->f_path.dentry->d_inode;
457 mutex_lock(&host_inode->i_mutex); 457 mutex_lock(&host_inode->i_mutex);
458 host_file->f_pos = coda_file->f_pos; 458 host_file->f_pos = coda_file->f_pos;
459 459
@@ -544,14 +544,14 @@ static int coda_venus_readdir(struct file *filp, filldir_t filldir,
544 /* catch truncated reads */ 544 /* catch truncated reads */
545 if (ret < vdir_size || ret < vdir_size + vdir->d_namlen) { 545 if (ret < vdir_size || ret < vdir_size + vdir->d_namlen) {
546 printk("coda_venus_readdir: short read: %ld\n", 546 printk("coda_venus_readdir: short read: %ld\n",
547 filp->f_dentry->d_inode->i_ino); 547 filp->f_path.dentry->d_inode->i_ino);
548 ret = -EBADF; 548 ret = -EBADF;
549 break; 549 break;
550 } 550 }
551 /* validate whether the directory file actually makes sense */ 551 /* validate whether the directory file actually makes sense */
552 if (vdir->d_reclen < vdir_size + vdir->d_namlen) { 552 if (vdir->d_reclen < vdir_size + vdir->d_namlen) {
553 printk("coda_venus_readdir: Invalid dir: %ld\n", 553 printk("coda_venus_readdir: Invalid dir: %ld\n",
554 filp->f_dentry->d_inode->i_ino); 554 filp->f_path.dentry->d_inode->i_ino);
555 ret = -EBADF; 555 ret = -EBADF;
556 break; 556 break;
557 } 557 }
diff --git a/fs/coda/file.c b/fs/coda/file.c
index dbfbcfa5b3c0..5ef2b609ec7d 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -66,7 +66,7 @@ coda_file_sendfile(struct file *coda_file, loff_t *ppos, size_t count,
66static ssize_t 66static ssize_t
67coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos) 67coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos)
68{ 68{
69 struct inode *host_inode, *coda_inode = coda_file->f_dentry->d_inode; 69 struct inode *host_inode, *coda_inode = coda_file->f_path.dentry->d_inode;
70 struct coda_file_info *cfi; 70 struct coda_file_info *cfi;
71 struct file *host_file; 71 struct file *host_file;
72 ssize_t ret; 72 ssize_t ret;
@@ -78,7 +78,7 @@ coda_file_write(struct file *coda_file, const char __user *buf, size_t count, lo
78 if (!host_file->f_op || !host_file->f_op->write) 78 if (!host_file->f_op || !host_file->f_op->write)
79 return -EINVAL; 79 return -EINVAL;
80 80
81 host_inode = host_file->f_dentry->d_inode; 81 host_inode = host_file->f_path.dentry->d_inode;
82 mutex_lock(&coda_inode->i_mutex); 82 mutex_lock(&coda_inode->i_mutex);
83 83
84 ret = host_file->f_op->write(host_file, buf, count, ppos); 84 ret = host_file->f_op->write(host_file, buf, count, ppos);
@@ -106,8 +106,8 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma)
106 if (!host_file->f_op || !host_file->f_op->mmap) 106 if (!host_file->f_op || !host_file->f_op->mmap)
107 return -ENODEV; 107 return -ENODEV;
108 108
109 coda_inode = coda_file->f_dentry->d_inode; 109 coda_inode = coda_file->f_path.dentry->d_inode;
110 host_inode = host_file->f_dentry->d_inode; 110 host_inode = host_file->f_path.dentry->d_inode;
111 coda_file->f_mapping = host_file->f_mapping; 111 coda_file->f_mapping = host_file->f_mapping;
112 if (coda_inode->i_mapping == &coda_inode->i_data) 112 if (coda_inode->i_mapping == &coda_inode->i_data)
113 coda_inode->i_mapping = host_inode->i_mapping; 113 coda_inode->i_mapping = host_inode->i_mapping;
@@ -190,7 +190,7 @@ int coda_flush(struct file *coda_file, fl_owner_t id)
190 cfi = CODA_FTOC(coda_file); 190 cfi = CODA_FTOC(coda_file);
191 BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); 191 BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
192 192
193 coda_inode = coda_file->f_dentry->d_inode; 193 coda_inode = coda_file->f_path.dentry->d_inode;
194 194
195 err = venus_store(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags, 195 err = venus_store(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags,
196 coda_file->f_uid); 196 coda_file->f_uid);
@@ -233,7 +233,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
233 err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), 233 err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
234 coda_flags, coda_file->f_uid); 234 coda_flags, coda_file->f_uid);
235 235
236 host_inode = cfi->cfi_container->f_dentry->d_inode; 236 host_inode = cfi->cfi_container->f_path.dentry->d_inode;
237 cii = ITOC(coda_inode); 237 cii = ITOC(coda_inode);
238 238
239 /* did we mmap this file? */ 239 /* did we mmap this file? */
@@ -270,7 +270,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
270 coda_vfs_stat.fsync++; 270 coda_vfs_stat.fsync++;
271 271
272 if (host_file->f_op && host_file->f_op->fsync) { 272 if (host_file->f_op && host_file->f_op->fsync) {
273 host_dentry = host_file->f_dentry; 273 host_dentry = host_file->f_path.dentry;
274 host_inode = host_dentry->d_inode; 274 host_inode = host_dentry->d_inode;
275 mutex_lock(&host_inode->i_mutex); 275 mutex_lock(&host_inode->i_mutex);
276 err = host_file->f_op->fsync(host_file, host_dentry, datasync); 276 err = host_file->f_op->fsync(host_file, host_dentry, datasync);
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index b64659fa82d0..01395defed85 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -119,7 +119,7 @@ static int get_device_index(struct coda_mount_data *data)
119 file = fget(data->fd); 119 file = fget(data->fd);
120 inode = NULL; 120 inode = NULL;
121 if(file) 121 if(file)
122 inode = file->f_dentry->d_inode; 122 inode = file->f_path.dentry->d_inode;
123 123
124 if(!inode || !S_ISCHR(inode->i_mode) || 124 if(!inode || !S_ISCHR(inode->i_mode) ||
125 imajor(inode) != CODA_PSDEV_MAJOR) { 125 imajor(inode) != CODA_PSDEV_MAJOR) {
diff --git a/fs/compat.c b/fs/compat.c
index a7e3f162fb15..0ec70e3cee0a 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -232,7 +232,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user
232 file = fget(fd); 232 file = fget(fd);
233 if (!file) 233 if (!file)
234 goto out; 234 goto out;
235 error = vfs_statfs(file->f_dentry, &tmp); 235 error = vfs_statfs(file->f_path.dentry, &tmp);
236 if (!error) 236 if (!error)
237 error = put_compat_statfs(buf, &tmp); 237 error = put_compat_statfs(buf, &tmp);
238 fput(file); 238 fput(file);
@@ -303,7 +303,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
303 file = fget(fd); 303 file = fget(fd);
304 if (!file) 304 if (!file)
305 goto out; 305 goto out;
306 error = vfs_statfs(file->f_dentry, &tmp); 306 error = vfs_statfs(file->f_path.dentry, &tmp);
307 if (!error) 307 if (!error)
308 error = put_compat_statfs64(buf, &tmp); 308 error = put_compat_statfs64(buf, &tmp);
309 fput(file); 309 fput(file);
@@ -365,7 +365,7 @@ static void compat_ioctl_error(struct file *filp, unsigned int fd,
365 /* find the name of the device. */ 365 /* find the name of the device. */
366 path = (char *)__get_free_page(GFP_KERNEL); 366 path = (char *)__get_free_page(GFP_KERNEL);
367 if (path) { 367 if (path) {
368 fn = d_path(filp->f_dentry, filp->f_vfsmnt, path, PAGE_SIZE); 368 fn = d_path(filp->f_path.dentry, filp->f_path.mnt, path, PAGE_SIZE);
369 if (IS_ERR(fn)) 369 if (IS_ERR(fn))
370 fn = "?"; 370 fn = "?";
371 } 371 }
@@ -416,7 +416,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
416 case FIBMAP: 416 case FIBMAP:
417 case FIGETBSZ: 417 case FIGETBSZ:
418 case FIONREAD: 418 case FIONREAD:
419 if (S_ISREG(filp->f_dentry->d_inode->i_mode)) 419 if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
420 break; 420 break;
421 /*FALL THROUGH*/ 421 /*FALL THROUGH*/
422 422
@@ -438,7 +438,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
438 goto found_handler; 438 goto found_handler;
439 } 439 }
440 440
441 if (S_ISSOCK(filp->f_dentry->d_inode->i_mode) && 441 if (S_ISSOCK(filp->f_path.dentry->d_inode->i_mode) &&
442 cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { 442 cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
443 error = siocdevprivate_ioctl(fd, cmd, arg); 443 error = siocdevprivate_ioctl(fd, cmd, arg);
444 } else { 444 } else {
@@ -1259,7 +1259,7 @@ out:
1259 if (iov != iovstack) 1259 if (iov != iovstack)
1260 kfree(iov); 1260 kfree(iov);
1261 if ((ret + (type == READ)) > 0) { 1261 if ((ret + (type == READ)) > 0) {
1262 struct dentry *dentry = file->f_dentry; 1262 struct dentry *dentry = file->f_path.dentry;
1263 if (type == READ) 1263 if (type == READ)
1264 fsnotify_access(dentry); 1264 fsnotify_access(dentry);
1265 else 1265 else
@@ -1679,19 +1679,19 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
1679{ 1679{
1680 fd_set_bits fds; 1680 fd_set_bits fds;
1681 char *bits; 1681 char *bits;
1682 int size, max_fdset, ret = -EINVAL; 1682 int size, max_fds, ret = -EINVAL;
1683 struct fdtable *fdt; 1683 struct fdtable *fdt;
1684 1684
1685 if (n < 0) 1685 if (n < 0)
1686 goto out_nofds; 1686 goto out_nofds;
1687 1687
1688 /* max_fdset can increase, so grab it once to avoid race */ 1688 /* max_fds can increase, so grab it once to avoid race */
1689 rcu_read_lock(); 1689 rcu_read_lock();
1690 fdt = files_fdtable(current->files); 1690 fdt = files_fdtable(current->files);
1691 max_fdset = fdt->max_fdset; 1691 max_fds = fdt->max_fds;
1692 rcu_read_unlock(); 1692 rcu_read_unlock();
1693 if (n > max_fdset) 1693 if (n > max_fds)
1694 n = max_fdset; 1694 n = max_fds;
1695 1695
1696 /* 1696 /*
1697 * We need 6 bitmaps (in/out/ex for both incoming and outgoing), 1697 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index bcc3caf5d820..c81c958b3e1d 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1177,7 +1177,7 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar
1177static int vt_check(struct file *file) 1177static int vt_check(struct file *file)
1178{ 1178{
1179 struct tty_struct *tty; 1179 struct tty_struct *tty;
1180 struct inode *inode = file->f_dentry->d_inode; 1180 struct inode *inode = file->f_path.dentry->d_inode;
1181 1181
1182 if (file->f_op->ioctl != tty_ioctl) 1182 if (file->f_op->ioctl != tty_ioctl)
1183 return -EINVAL; 1183 return -EINVAL;
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index c398861f78a5..1814ba446809 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -980,7 +980,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
980 980
981static int configfs_dir_open(struct inode *inode, struct file *file) 981static int configfs_dir_open(struct inode *inode, struct file *file)
982{ 982{
983 struct dentry * dentry = file->f_dentry; 983 struct dentry * dentry = file->f_path.dentry;
984 struct configfs_dirent * parent_sd = dentry->d_fsdata; 984 struct configfs_dirent * parent_sd = dentry->d_fsdata;
985 985
986 mutex_lock(&dentry->d_inode->i_mutex); 986 mutex_lock(&dentry->d_inode->i_mutex);
@@ -993,7 +993,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
993 993
994static int configfs_dir_close(struct inode *inode, struct file *file) 994static int configfs_dir_close(struct inode *inode, struct file *file)
995{ 995{
996 struct dentry * dentry = file->f_dentry; 996 struct dentry * dentry = file->f_path.dentry;
997 struct configfs_dirent * cursor = file->private_data; 997 struct configfs_dirent * cursor = file->private_data;
998 998
999 mutex_lock(&dentry->d_inode->i_mutex); 999 mutex_lock(&dentry->d_inode->i_mutex);
@@ -1013,7 +1013,7 @@ static inline unsigned char dt_type(struct configfs_dirent *sd)
1013 1013
1014static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir) 1014static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
1015{ 1015{
1016 struct dentry *dentry = filp->f_dentry; 1016 struct dentry *dentry = filp->f_path.dentry;
1017 struct configfs_dirent * parent_sd = dentry->d_fsdata; 1017 struct configfs_dirent * parent_sd = dentry->d_fsdata;
1018 struct configfs_dirent *cursor = filp->private_data; 1018 struct configfs_dirent *cursor = filp->private_data;
1019 struct list_head *p, *q = &cursor->s_sibling; 1019 struct list_head *p, *q = &cursor->s_sibling;
@@ -1070,7 +1070,7 @@ static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir
1070 1070
1071static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin) 1071static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin)
1072{ 1072{
1073 struct dentry * dentry = file->f_dentry; 1073 struct dentry * dentry = file->f_path.dentry;
1074 1074
1075 mutex_lock(&dentry->d_inode->i_mutex); 1075 mutex_lock(&dentry->d_inode->i_mutex);
1076 switch (origin) { 1076 switch (origin) {
@@ -1080,7 +1080,7 @@ static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin)
1080 if (offset >= 0) 1080 if (offset >= 0)
1081 break; 1081 break;
1082 default: 1082 default:
1083 mutex_unlock(&file->f_dentry->d_inode->i_mutex); 1083 mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
1084 return -EINVAL; 1084 return -EINVAL;
1085 } 1085 }
1086 if (offset != file->f_pos) { 1086 if (offset != file->f_pos) {
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index cf33fac68c84..2a7cb086e80c 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -134,7 +134,7 @@ configfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *pp
134 134
135 down(&buffer->sem); 135 down(&buffer->sem);
136 if (buffer->needs_read_fill) { 136 if (buffer->needs_read_fill) {
137 if ((retval = fill_read_buffer(file->f_dentry,buffer))) 137 if ((retval = fill_read_buffer(file->f_path.dentry,buffer)))
138 goto out; 138 goto out;
139 } 139 }
140 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n", 140 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
@@ -222,7 +222,7 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof
222 down(&buffer->sem); 222 down(&buffer->sem);
223 len = fill_write_buffer(buffer, buf, count); 223 len = fill_write_buffer(buffer, buf, count);
224 if (len > 0) 224 if (len > 0)
225 len = flush_write_buffer(file->f_dentry, buffer, count); 225 len = flush_write_buffer(file->f_path.dentry, buffer, count);
226 if (len > 0) 226 if (len > 0)
227 *ppos += len; 227 *ppos += len;
228 up(&buffer->sem); 228 up(&buffer->sem);
@@ -231,8 +231,8 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof
231 231
232static int check_perm(struct inode * inode, struct file * file) 232static int check_perm(struct inode * inode, struct file * file)
233{ 233{
234 struct config_item *item = configfs_get_config_item(file->f_dentry->d_parent); 234 struct config_item *item = configfs_get_config_item(file->f_path.dentry->d_parent);
235 struct configfs_attribute * attr = to_attr(file->f_dentry); 235 struct configfs_attribute * attr = to_attr(file->f_path.dentry);
236 struct configfs_buffer * buffer; 236 struct configfs_buffer * buffer;
237 struct configfs_item_operations * ops = NULL; 237 struct configfs_item_operations * ops = NULL;
238 int error = 0; 238 int error = 0;
@@ -305,8 +305,8 @@ static int configfs_open_file(struct inode * inode, struct file * filp)
305 305
306static int configfs_release(struct inode * inode, struct file * filp) 306static int configfs_release(struct inode * inode, struct file * filp)
307{ 307{
308 struct config_item * item = to_item(filp->f_dentry->d_parent); 308 struct config_item * item = to_item(filp->f_path.dentry->d_parent);
309 struct configfs_attribute * attr = to_attr(filp->f_dentry); 309 struct configfs_attribute * attr = to_attr(filp->f_path.dentry);
310 struct module * owner = attr->ca_owner; 310 struct module * owner = attr->ca_owner;
311 struct configfs_buffer * buffer = filp->private_data; 311 struct configfs_buffer * buffer = filp->private_data;
312 312
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 0509cedd415c..6db03fb089dc 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -338,7 +338,7 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
338 */ 338 */
339static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 339static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
340{ 340{
341 struct inode *inode = filp->f_dentry->d_inode; 341 struct inode *inode = filp->f_path.dentry->d_inode;
342 struct super_block *sb = inode->i_sb; 342 struct super_block *sb = inode->i_sb;
343 char *buf; 343 char *buf;
344 unsigned int offset; 344 unsigned int offset;
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 5981e17f46f0..d9d0833444f5 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -27,6 +27,7 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/pagemap.h> 29#include <linux/pagemap.h>
30#include <linux/task_io_accounting_ops.h>
30#include <linux/bio.h> 31#include <linux/bio.h>
31#include <linux/wait.h> 32#include <linux/wait.h>
32#include <linux/err.h> 33#include <linux/err.h>
@@ -121,8 +122,7 @@ struct dio {
121 122
122 /* BIO completion state */ 123 /* BIO completion state */
123 spinlock_t bio_lock; /* protects BIO fields below */ 124 spinlock_t bio_lock; /* protects BIO fields below */
124 int bio_count; /* nr bios to be completed */ 125 unsigned long refcount; /* direct_io_worker() and bios */
125 int bios_in_flight; /* nr bios in flight */
126 struct bio *bio_list; /* singly linked via bi_private */ 126 struct bio *bio_list; /* singly linked via bi_private */
127 struct task_struct *waiter; /* waiting task (NULL if none) */ 127 struct task_struct *waiter; /* waiting task (NULL if none) */
128 128
@@ -209,76 +209,55 @@ static struct page *dio_get_page(struct dio *dio)
209 return dio->pages[dio->head++]; 209 return dio->pages[dio->head++];
210} 210}
211 211
212/* 212/**
213 * Called when all DIO BIO I/O has been completed - let the filesystem 213 * dio_complete() - called when all DIO BIO I/O has been completed
214 * know, if it registered an interest earlier via get_block. Pass the 214 * @offset: the byte offset in the file of the completed operation
215 * private field of the map buffer_head so that filesystems can use it 215 *
216 * to hold additional state between get_block calls and dio_complete. 216 * This releases locks as dictated by the locking type, lets interested parties
217 */ 217 * know that a DIO operation has completed, and calculates the resulting return
218static void dio_complete(struct dio *dio, loff_t offset, ssize_t bytes) 218 * code for the operation.
219{ 219 *
220 if (dio->end_io && dio->result) 220 * It lets the filesystem know if it registered an interest earlier via
221 dio->end_io(dio->iocb, offset, bytes, dio->map_bh.b_private); 221 * get_block. Pass the private field of the map buffer_head so that
222 if (dio->lock_type == DIO_LOCKING) 222 * filesystems can use it to hold additional state between get_block calls and
223 /* lockdep: non-owner release */ 223 * dio_complete.
224 up_read_non_owner(&dio->inode->i_alloc_sem);
225}
226
227/*
228 * Called when a BIO has been processed. If the count goes to zero then IO is
229 * complete and we can signal this to the AIO layer.
230 */ 224 */
231static void finished_one_bio(struct dio *dio) 225static int dio_complete(struct dio *dio, loff_t offset, int ret)
232{ 226{
233 unsigned long flags; 227 ssize_t transferred = 0;
234 228
235 spin_lock_irqsave(&dio->bio_lock, flags); 229 /*
236 if (dio->bio_count == 1) { 230 * AIO submission can race with bio completion to get here while
237 if (dio->is_async) { 231 * expecting to have the last io completed by bio completion.
238 ssize_t transferred; 232 * In that case -EIOCBQUEUED is in fact not an error we want
239 loff_t offset; 233 * to preserve through this call.
240 234 */
241 /* 235 if (ret == -EIOCBQUEUED)
242 * Last reference to the dio is going away. 236 ret = 0;
243 * Drop spinlock and complete the DIO.
244 */
245 spin_unlock_irqrestore(&dio->bio_lock, flags);
246 237
247 /* Check for short read case */ 238 if (dio->result) {
248 transferred = dio->result; 239 transferred = dio->result;
249 offset = dio->iocb->ki_pos;
250 240
251 if ((dio->rw == READ) && 241 /* Check for short read case */
252 ((offset + transferred) > dio->i_size)) 242 if ((dio->rw == READ) && ((offset + transferred) > dio->i_size))
253 transferred = dio->i_size - offset; 243 transferred = dio->i_size - offset;
244 }
254 245
255 /* check for error in completion path */ 246 if (dio->end_io && dio->result)
256 if (dio->io_error) 247 dio->end_io(dio->iocb, offset, transferred,
257 transferred = dio->io_error; 248 dio->map_bh.b_private);
249 if (dio->lock_type == DIO_LOCKING)
250 /* lockdep: non-owner release */
251 up_read_non_owner(&dio->inode->i_alloc_sem);
258 252
259 dio_complete(dio, offset, transferred); 253 if (ret == 0)
254 ret = dio->page_errors;
255 if (ret == 0)
256 ret = dio->io_error;
257 if (ret == 0)
258 ret = transferred;
260 259
261 /* Complete AIO later if falling back to buffered i/o */ 260 return ret;
262 if (dio->result == dio->size ||
263 ((dio->rw == READ) && dio->result)) {
264 aio_complete(dio->iocb, transferred, 0);
265 kfree(dio);
266 return;
267 } else {
268 /*
269 * Falling back to buffered
270 */
271 spin_lock_irqsave(&dio->bio_lock, flags);
272 dio->bio_count--;
273 if (dio->waiter)
274 wake_up_process(dio->waiter);
275 spin_unlock_irqrestore(&dio->bio_lock, flags);
276 return;
277 }
278 }
279 }
280 dio->bio_count--;
281 spin_unlock_irqrestore(&dio->bio_lock, flags);
282} 261}
283 262
284static int dio_bio_complete(struct dio *dio, struct bio *bio); 263static int dio_bio_complete(struct dio *dio, struct bio *bio);
@@ -288,12 +267,27 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio);
288static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error) 267static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error)
289{ 268{
290 struct dio *dio = bio->bi_private; 269 struct dio *dio = bio->bi_private;
270 unsigned long remaining;
271 unsigned long flags;
291 272
292 if (bio->bi_size) 273 if (bio->bi_size)
293 return 1; 274 return 1;
294 275
295 /* cleanup the bio */ 276 /* cleanup the bio */
296 dio_bio_complete(dio, bio); 277 dio_bio_complete(dio, bio);
278
279 spin_lock_irqsave(&dio->bio_lock, flags);
280 remaining = --dio->refcount;
281 if (remaining == 1 && dio->waiter)
282 wake_up_process(dio->waiter);
283 spin_unlock_irqrestore(&dio->bio_lock, flags);
284
285 if (remaining == 0) {
286 int ret = dio_complete(dio, dio->iocb->ki_pos, 0);
287 aio_complete(dio->iocb, ret, 0);
288 kfree(dio);
289 }
290
297 return 0; 291 return 0;
298} 292}
299 293
@@ -315,8 +309,7 @@ static int dio_bio_end_io(struct bio *bio, unsigned int bytes_done, int error)
315 spin_lock_irqsave(&dio->bio_lock, flags); 309 spin_lock_irqsave(&dio->bio_lock, flags);
316 bio->bi_private = dio->bio_list; 310 bio->bi_private = dio->bio_list;
317 dio->bio_list = bio; 311 dio->bio_list = bio;
318 dio->bios_in_flight--; 312 if (--dio->refcount == 1 && dio->waiter)
319 if (dio->waiter && dio->bios_in_flight == 0)
320 wake_up_process(dio->waiter); 313 wake_up_process(dio->waiter);
321 spin_unlock_irqrestore(&dio->bio_lock, flags); 314 spin_unlock_irqrestore(&dio->bio_lock, flags);
322 return 0; 315 return 0;
@@ -347,6 +340,8 @@ dio_bio_alloc(struct dio *dio, struct block_device *bdev,
347 * In the AIO read case we speculatively dirty the pages before starting IO. 340 * In the AIO read case we speculatively dirty the pages before starting IO.
348 * During IO completion, any of these pages which happen to have been written 341 * During IO completion, any of these pages which happen to have been written
349 * back will be redirtied by bio_check_pages_dirty(). 342 * back will be redirtied by bio_check_pages_dirty().
343 *
344 * bios hold a dio reference between submit_bio and ->end_io.
350 */ 345 */
351static void dio_bio_submit(struct dio *dio) 346static void dio_bio_submit(struct dio *dio)
352{ 347{
@@ -354,12 +349,14 @@ static void dio_bio_submit(struct dio *dio)
354 unsigned long flags; 349 unsigned long flags;
355 350
356 bio->bi_private = dio; 351 bio->bi_private = dio;
352
357 spin_lock_irqsave(&dio->bio_lock, flags); 353 spin_lock_irqsave(&dio->bio_lock, flags);
358 dio->bio_count++; 354 dio->refcount++;
359 dio->bios_in_flight++;
360 spin_unlock_irqrestore(&dio->bio_lock, flags); 355 spin_unlock_irqrestore(&dio->bio_lock, flags);
356
361 if (dio->is_async && dio->rw == READ) 357 if (dio->is_async && dio->rw == READ)
362 bio_set_pages_dirty(bio); 358 bio_set_pages_dirty(bio);
359
363 submit_bio(dio->rw, bio); 360 submit_bio(dio->rw, bio);
364 361
365 dio->bio = NULL; 362 dio->bio = NULL;
@@ -376,28 +373,37 @@ static void dio_cleanup(struct dio *dio)
376} 373}
377 374
378/* 375/*
379 * Wait for the next BIO to complete. Remove it and return it. 376 * Wait for the next BIO to complete. Remove it and return it. NULL is
377 * returned once all BIOs have been completed. This must only be called once
378 * all bios have been issued so that dio->refcount can only decrease. This
379 * requires that that the caller hold a reference on the dio.
380 */ 380 */
381static struct bio *dio_await_one(struct dio *dio) 381static struct bio *dio_await_one(struct dio *dio)
382{ 382{
383 unsigned long flags; 383 unsigned long flags;
384 struct bio *bio; 384 struct bio *bio = NULL;
385 385
386 spin_lock_irqsave(&dio->bio_lock, flags); 386 spin_lock_irqsave(&dio->bio_lock, flags);
387 while (dio->bio_list == NULL) { 387
388 set_current_state(TASK_UNINTERRUPTIBLE); 388 /*
389 if (dio->bio_list == NULL) { 389 * Wait as long as the list is empty and there are bios in flight. bio
390 dio->waiter = current; 390 * completion drops the count, maybe adds to the list, and wakes while
391 spin_unlock_irqrestore(&dio->bio_lock, flags); 391 * holding the bio_lock so we don't need set_current_state()'s barrier
392 blk_run_address_space(dio->inode->i_mapping); 392 * and can call it after testing our condition.
393 io_schedule(); 393 */
394 spin_lock_irqsave(&dio->bio_lock, flags); 394 while (dio->refcount > 1 && dio->bio_list == NULL) {
395 dio->waiter = NULL; 395 __set_current_state(TASK_UNINTERRUPTIBLE);
396 } 396 dio->waiter = current;
397 set_current_state(TASK_RUNNING); 397 spin_unlock_irqrestore(&dio->bio_lock, flags);
398 io_schedule();
399 /* wake up sets us TASK_RUNNING */
400 spin_lock_irqsave(&dio->bio_lock, flags);
401 dio->waiter = NULL;
402 }
403 if (dio->bio_list) {
404 bio = dio->bio_list;
405 dio->bio_list = bio->bi_private;
398 } 406 }
399 bio = dio->bio_list;
400 dio->bio_list = bio->bi_private;
401 spin_unlock_irqrestore(&dio->bio_lock, flags); 407 spin_unlock_irqrestore(&dio->bio_lock, flags);
402 return bio; 408 return bio;
403} 409}
@@ -426,34 +432,24 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
426 } 432 }
427 bio_put(bio); 433 bio_put(bio);
428 } 434 }
429 finished_one_bio(dio);
430 return uptodate ? 0 : -EIO; 435 return uptodate ? 0 : -EIO;
431} 436}
432 437
433/* 438/*
434 * Wait on and process all in-flight BIOs. 439 * Wait on and process all in-flight BIOs. This must only be called once
440 * all bios have been issued so that the refcount can only decrease.
441 * This just waits for all bios to make it through dio_bio_complete. IO
442 * errors are propogated through dio->io_error and should be propogated via
443 * dio_complete().
435 */ 444 */
436static int dio_await_completion(struct dio *dio) 445static void dio_await_completion(struct dio *dio)
437{ 446{
438 int ret = 0; 447 struct bio *bio;
439 448 do {
440 if (dio->bio) 449 bio = dio_await_one(dio);
441 dio_bio_submit(dio); 450 if (bio)
442 451 dio_bio_complete(dio, bio);
443 /* 452 } while (bio);
444 * The bio_lock is not held for the read of bio_count.
445 * This is ok since it is the dio_bio_complete() that changes
446 * bio_count.
447 */
448 while (dio->bio_count) {
449 struct bio *bio = dio_await_one(dio);
450 int ret2;
451
452 ret2 = dio_bio_complete(dio, bio);
453 if (ret == 0)
454 ret = ret2;
455 }
456 return ret;
457} 453}
458 454
459/* 455/*
@@ -675,6 +671,13 @@ submit_page_section(struct dio *dio, struct page *page,
675{ 671{
676 int ret = 0; 672 int ret = 0;
677 673
674 if (dio->rw & WRITE) {
675 /*
676 * Read accounting is performed in submit_bio()
677 */
678 task_io_account_write(len);
679 }
680
678 /* 681 /*
679 * Can we just grow the current page's presence in the dio? 682 * Can we just grow the current page's presence in the dio?
680 */ 683 */
@@ -953,6 +956,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
953 struct dio *dio) 956 struct dio *dio)
954{ 957{
955 unsigned long user_addr; 958 unsigned long user_addr;
959 unsigned long flags;
956 int seg; 960 int seg;
957 ssize_t ret = 0; 961 ssize_t ret = 0;
958 ssize_t ret2; 962 ssize_t ret2;
@@ -983,17 +987,8 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
983 dio->iocb = iocb; 987 dio->iocb = iocb;
984 dio->i_size = i_size_read(inode); 988 dio->i_size = i_size_read(inode);
985 989
986 /*
987 * BIO completion state.
988 *
989 * ->bio_count starts out at one, and we decrement it to zero after all
990 * BIOs are submitted. This to avoid the situation where a really fast
991 * (or synchronous) device could take the count to zero while we're
992 * still submitting BIOs.
993 */
994 dio->bio_count = 1;
995 dio->bios_in_flight = 0;
996 spin_lock_init(&dio->bio_lock); 990 spin_lock_init(&dio->bio_lock);
991 dio->refcount = 1;
997 dio->bio_list = NULL; 992 dio->bio_list = NULL;
998 dio->waiter = NULL; 993 dio->waiter = NULL;
999 994
@@ -1069,6 +1064,9 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
1069 if (dio->bio) 1064 if (dio->bio)
1070 dio_bio_submit(dio); 1065 dio_bio_submit(dio);
1071 1066
1067 /* All IO is now issued, send it on its way */
1068 blk_run_address_space(inode->i_mapping);
1069
1072 /* 1070 /*
1073 * It is possible that, we return short IO due to end of file. 1071 * It is possible that, we return short IO due to end of file.
1074 * In that case, we need to release all the pages we got hold on. 1072 * In that case, we need to release all the pages we got hold on.
@@ -1084,74 +1082,41 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
1084 mutex_unlock(&dio->inode->i_mutex); 1082 mutex_unlock(&dio->inode->i_mutex);
1085 1083
1086 /* 1084 /*
1087 * OK, all BIOs are submitted, so we can decrement bio_count to truly 1085 * The only time we want to leave bios in flight is when a successful
1088 * reflect the number of to-be-processed BIOs. 1086 * partial aio read or full aio write have been setup. In that case
1087 * bio completion will call aio_complete. The only time it's safe to
1088 * call aio_complete is when we return -EIOCBQUEUED, so we key on that.
1089 * This had *better* be the only place that raises -EIOCBQUEUED.
1089 */ 1090 */
1090 if (dio->is_async) { 1091 BUG_ON(ret == -EIOCBQUEUED);
1091 int should_wait = 0; 1092 if (dio->is_async && ret == 0 && dio->result &&
1093 ((rw & READ) || (dio->result == dio->size)))
1094 ret = -EIOCBQUEUED;
1092 1095
1093 if (dio->result < dio->size && (rw & WRITE)) { 1096 if (ret != -EIOCBQUEUED)
1094 dio->waiter = current; 1097 dio_await_completion(dio);
1095 should_wait = 1;
1096 }
1097 if (ret == 0)
1098 ret = dio->result;
1099 finished_one_bio(dio); /* This can free the dio */
1100 blk_run_address_space(inode->i_mapping);
1101 if (should_wait) {
1102 unsigned long flags;
1103 /*
1104 * Wait for already issued I/O to drain out and
1105 * release its references to user-space pages
1106 * before returning to fallback on buffered I/O
1107 */
1108
1109 spin_lock_irqsave(&dio->bio_lock, flags);
1110 set_current_state(TASK_UNINTERRUPTIBLE);
1111 while (dio->bio_count) {
1112 spin_unlock_irqrestore(&dio->bio_lock, flags);
1113 io_schedule();
1114 spin_lock_irqsave(&dio->bio_lock, flags);
1115 set_current_state(TASK_UNINTERRUPTIBLE);
1116 }
1117 spin_unlock_irqrestore(&dio->bio_lock, flags);
1118 set_current_state(TASK_RUNNING);
1119 kfree(dio);
1120 }
1121 } else {
1122 ssize_t transferred = 0;
1123
1124 finished_one_bio(dio);
1125 ret2 = dio_await_completion(dio);
1126 if (ret == 0)
1127 ret = ret2;
1128 if (ret == 0)
1129 ret = dio->page_errors;
1130 if (dio->result) {
1131 loff_t i_size = i_size_read(inode);
1132
1133 transferred = dio->result;
1134 /*
1135 * Adjust the return value if the read crossed a
1136 * non-block-aligned EOF.
1137 */
1138 if (rw == READ && (offset + transferred > i_size))
1139 transferred = i_size - offset;
1140 }
1141 dio_complete(dio, offset, transferred);
1142 if (ret == 0)
1143 ret = transferred;
1144 1098
1145 /* We could have also come here on an AIO file extend */ 1099 /*
1146 if (!is_sync_kiocb(iocb) && (rw & WRITE) && 1100 * Sync will always be dropping the final ref and completing the
1147 ret >= 0 && dio->result == dio->size) 1101 * operation. AIO can if it was a broken operation described above or
1148 /* 1102 * in fact if all the bios race to complete before we get here. In
1149 * For AIO writes where we have completed the 1103 * that case dio_complete() translates the EIOCBQUEUED into the proper
1150 * i/o, we have to mark the the aio complete. 1104 * return code that the caller will hand to aio_complete().
1151 */ 1105 *
1152 aio_complete(iocb, ret, 0); 1106 * This is managed by the bio_lock instead of being an atomic_t so that
1107 * completion paths can drop their ref and use the remaining count to
1108 * decide to wake the submission path atomically.
1109 */
1110 spin_lock_irqsave(&dio->bio_lock, flags);
1111 ret2 = --dio->refcount;
1112 spin_unlock_irqrestore(&dio->bio_lock, flags);
1113 BUG_ON(!dio->is_async && ret2 != 0);
1114 if (ret2 == 0) {
1115 ret = dio_complete(dio, offset, ret);
1153 kfree(dio); 1116 kfree(dio);
1154 } 1117 } else
1118 BUG_ON(ret != -EIOCBQUEUED);
1119
1155 return ret; 1120 return ret;
1156} 1121}
1157 1122
diff --git a/fs/dnotify.c b/fs/dnotify.c
index 1f26a2b9eee1..936409fcd939 100644
--- a/fs/dnotify.c
+++ b/fs/dnotify.c
@@ -42,7 +42,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
42 struct dnotify_struct **prev; 42 struct dnotify_struct **prev;
43 struct inode *inode; 43 struct inode *inode;
44 44
45 inode = filp->f_dentry->d_inode; 45 inode = filp->f_path.dentry->d_inode;
46 if (!S_ISDIR(inode->i_mode)) 46 if (!S_ISDIR(inode->i_mode))
47 return; 47 return;
48 spin_lock(&inode->i_lock); 48 spin_lock(&inode->i_lock);
@@ -74,7 +74,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
74 } 74 }
75 if (!dir_notify_enable) 75 if (!dir_notify_enable)
76 return -EINVAL; 76 return -EINVAL;
77 inode = filp->f_dentry->d_inode; 77 inode = filp->f_path.dentry->d_inode;
78 if (!S_ISDIR(inode->i_mode)) 78 if (!S_ISDIR(inode->i_mode))
79 return -ENOTDIR; 79 return -ENOTDIR;
80 dn = kmem_cache_alloc(dn_cache, GFP_KERNEL); 80 dn = kmem_cache_alloc(dn_cache, GFP_KERNEL);
diff --git a/fs/dquot.c b/fs/dquot.c
index f9cd5e23ebdf..0952cc474d9a 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -694,9 +694,9 @@ restart:
694 file_list_lock(); 694 file_list_lock();
695 list_for_each(p, &sb->s_files) { 695 list_for_each(p, &sb->s_files) {
696 struct file *filp = list_entry(p, struct file, f_u.fu_list); 696 struct file *filp = list_entry(p, struct file, f_u.fu_list);
697 struct inode *inode = filp->f_dentry->d_inode; 697 struct inode *inode = filp->f_path.dentry->d_inode;
698 if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) { 698 if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) {
699 struct dentry *dentry = dget(filp->f_dentry); 699 struct dentry *dentry = dget(filp->f_path.dentry);
700 file_list_unlock(); 700 file_list_unlock();
701 sb->dq_op->initialize(inode, type); 701 sb->dq_op->initialize(inode, type);
702 dput(dentry); 702 dput(dentry);
@@ -828,6 +828,7 @@ static inline int need_print_warning(struct dquot *dquot)
828static void print_warning(struct dquot *dquot, const char warntype) 828static void print_warning(struct dquot *dquot, const char warntype)
829{ 829{
830 char *msg = NULL; 830 char *msg = NULL;
831 struct tty_struct *tty;
831 int flag = (warntype == BHARDWARN || warntype == BSOFTLONGWARN) ? DQ_BLKS_B : 832 int flag = (warntype == BHARDWARN || warntype == BSOFTLONGWARN) ? DQ_BLKS_B :
832 ((warntype == IHARDWARN || warntype == ISOFTLONGWARN) ? DQ_INODES_B : 0); 833 ((warntype == IHARDWARN || warntype == ISOFTLONGWARN) ? DQ_INODES_B : 0);
833 834
@@ -835,14 +836,15 @@ static void print_warning(struct dquot *dquot, const char warntype)
835 return; 836 return;
836 837
837 mutex_lock(&tty_mutex); 838 mutex_lock(&tty_mutex);
838 if (!current->signal->tty) 839 tty = get_current_tty();
840 if (!tty)
839 goto out_lock; 841 goto out_lock;
840 tty_write_message(current->signal->tty, dquot->dq_sb->s_id); 842 tty_write_message(tty, dquot->dq_sb->s_id);
841 if (warntype == ISOFTWARN || warntype == BSOFTWARN) 843 if (warntype == ISOFTWARN || warntype == BSOFTWARN)
842 tty_write_message(current->signal->tty, ": warning, "); 844 tty_write_message(tty, ": warning, ");
843 else 845 else
844 tty_write_message(current->signal->tty, ": write failed, "); 846 tty_write_message(tty, ": write failed, ");
845 tty_write_message(current->signal->tty, quotatypes[dquot->dq_type]); 847 tty_write_message(tty, quotatypes[dquot->dq_type]);
846 switch (warntype) { 848 switch (warntype) {
847 case IHARDWARN: 849 case IHARDWARN:
848 msg = " file limit reached.\r\n"; 850 msg = " file limit reached.\r\n";
@@ -863,7 +865,7 @@ static void print_warning(struct dquot *dquot, const char warntype)
863 msg = " block quota exceeded.\r\n"; 865 msg = " block quota exceeded.\r\n";
864 break; 866 break;
865 } 867 }
866 tty_write_message(current->signal->tty, msg); 868 tty_write_message(tty, msg);
867out_lock: 869out_lock:
868 mutex_unlock(&tty_mutex); 870 mutex_unlock(&tty_mutex);
869} 871}
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 52d1e36dc746..329efcd3d8c9 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -25,6 +25,7 @@
25#include <linux/dcache.h> 25#include <linux/dcache.h>
26#include <linux/namei.h> 26#include <linux/namei.h>
27#include <linux/mount.h> 27#include <linux/mount.h>
28#include <linux/fs_stack.h>
28#include "ecryptfs_kernel.h" 29#include "ecryptfs_kernel.h"
29 30
30/** 31/**
@@ -61,7 +62,7 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
61 struct inode *lower_inode = 62 struct inode *lower_inode =
62 ecryptfs_inode_to_lower(dentry->d_inode); 63 ecryptfs_inode_to_lower(dentry->d_inode);
63 64
64 ecryptfs_copy_attr_all(dentry->d_inode, lower_inode); 65 fsstack_copy_attr_all(dentry->d_inode, lower_inode, NULL);
65 } 66 }
66out: 67out:
67 return rc; 68 return rc;
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index f992533d1692..afb64bdbe6ad 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -28,6 +28,8 @@
28 28
29#include <keys/user-type.h> 29#include <keys/user-type.h>
30#include <linux/fs.h> 30#include <linux/fs.h>
31#include <linux/fs_stack.h>
32#include <linux/namei.h>
31#include <linux/scatterlist.h> 33#include <linux/scatterlist.h>
32 34
33/* Version verification for shared data structures w/ userspace */ 35/* Version verification for shared data structures w/ userspace */
@@ -227,8 +229,7 @@ struct ecryptfs_inode_info {
227/* dentry private data. Each dentry must keep track of a lower 229/* dentry private data. Each dentry must keep track of a lower
228 * vfsmount too. */ 230 * vfsmount too. */
229struct ecryptfs_dentry_info { 231struct ecryptfs_dentry_info {
230 struct dentry *wdi_dentry; 232 struct path lower_path;
231 struct vfsmount *lower_mnt;
232 struct ecryptfs_crypt_stat *crypt_stat; 233 struct ecryptfs_crypt_stat *crypt_stat;
233}; 234};
234 235
@@ -355,26 +356,26 @@ ecryptfs_set_dentry_private(struct dentry *dentry,
355static inline struct dentry * 356static inline struct dentry *
356ecryptfs_dentry_to_lower(struct dentry *dentry) 357ecryptfs_dentry_to_lower(struct dentry *dentry)
357{ 358{
358 return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->wdi_dentry; 359 return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.dentry;
359} 360}
360 361
361static inline void 362static inline void
362ecryptfs_set_dentry_lower(struct dentry *dentry, struct dentry *lower_dentry) 363ecryptfs_set_dentry_lower(struct dentry *dentry, struct dentry *lower_dentry)
363{ 364{
364 ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->wdi_dentry = 365 ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.dentry =
365 lower_dentry; 366 lower_dentry;
366} 367}
367 368
368static inline struct vfsmount * 369static inline struct vfsmount *
369ecryptfs_dentry_to_lower_mnt(struct dentry *dentry) 370ecryptfs_dentry_to_lower_mnt(struct dentry *dentry)
370{ 371{
371 return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_mnt; 372 return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt;
372} 373}
373 374
374static inline void 375static inline void
375ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt) 376ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt)
376{ 377{
377 ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_mnt = 378 ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt =
378 lower_mnt; 379 lower_mnt;
379} 380}
380 381
@@ -413,9 +414,6 @@ int ecryptfs_encode_filename(struct ecryptfs_crypt_stat *crypt_stat,
413 const char *name, int length, 414 const char *name, int length,
414 char **encoded_name); 415 char **encoded_name);
415struct dentry *ecryptfs_lower_dentry(struct dentry *this_dentry); 416struct dentry *ecryptfs_lower_dentry(struct dentry *this_dentry);
416void ecryptfs_copy_attr_atime(struct inode *dest, const struct inode *src);
417void ecryptfs_copy_attr_all(struct inode *dest, const struct inode *src);
418void ecryptfs_copy_inode_size(struct inode *dst, const struct inode *src);
419void ecryptfs_dump_hex(char *data, int bytes); 417void ecryptfs_dump_hex(char *data, int bytes);
420int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, 418int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,
421 int sg_size); 419 int sg_size);
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 42099e779a56..c5a2e5298f15 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -30,6 +30,7 @@
30#include <linux/security.h> 30#include <linux/security.h>
31#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
32#include <linux/compat.h> 32#include <linux/compat.h>
33#include <linux/fs_stack.h>
33#include "ecryptfs_kernel.h" 34#include "ecryptfs_kernel.h"
34 35
35/** 36/**
@@ -75,7 +76,7 @@ static loff_t ecryptfs_llseek(struct file *file, loff_t offset, int origin)
75 } 76 }
76 ecryptfs_printk(KERN_DEBUG, "new_end_pos = [0x%.16x]\n", new_end_pos); 77 ecryptfs_printk(KERN_DEBUG, "new_end_pos = [0x%.16x]\n", new_end_pos);
77 if (expanding_file) { 78 if (expanding_file) {
78 rc = ecryptfs_truncate(file->f_dentry, new_end_pos); 79 rc = ecryptfs_truncate(file->f_path.dentry, new_end_pos);
79 if (rc) { 80 if (rc) {
80 rv = rc; 81 rv = rc;
81 ecryptfs_printk(KERN_ERR, "Error on attempt to " 82 ecryptfs_printk(KERN_ERR, "Error on attempt to "
@@ -116,8 +117,8 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
116 if (-EIOCBQUEUED == rc) 117 if (-EIOCBQUEUED == rc)
117 rc = wait_on_sync_kiocb(iocb); 118 rc = wait_on_sync_kiocb(iocb);
118 if (rc >= 0) { 119 if (rc >= 0) {
119 lower_dentry = ecryptfs_dentry_to_lower(file->f_dentry); 120 lower_dentry = ecryptfs_dentry_to_lower(file->f_path.dentry);
120 lower_vfsmount = ecryptfs_dentry_to_lower_mnt(file->f_dentry); 121 lower_vfsmount = ecryptfs_dentry_to_lower_mnt(file->f_path.dentry);
121 touch_atime(lower_vfsmount, lower_dentry); 122 touch_atime(lower_vfsmount, lower_dentry);
122 } 123 }
123 return rc; 124 return rc;
@@ -176,10 +177,10 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir)
176 177
177 lower_file = ecryptfs_file_to_lower(file); 178 lower_file = ecryptfs_file_to_lower(file);
178 lower_file->f_pos = file->f_pos; 179 lower_file->f_pos = file->f_pos;
179 inode = file->f_dentry->d_inode; 180 inode = file->f_path.dentry->d_inode;
180 memset(&buf, 0, sizeof(buf)); 181 memset(&buf, 0, sizeof(buf));
181 buf.dirent = dirent; 182 buf.dirent = dirent;
182 buf.dentry = file->f_dentry; 183 buf.dentry = file->f_path.dentry;
183 buf.filldir = filldir; 184 buf.filldir = filldir;
184retry: 185retry:
185 buf.filldir_called = 0; 186 buf.filldir_called = 0;
@@ -192,7 +193,7 @@ retry:
192 goto retry; 193 goto retry;
193 file->f_pos = lower_file->f_pos; 194 file->f_pos = lower_file->f_pos;
194 if (rc >= 0) 195 if (rc >= 0)
195 ecryptfs_copy_attr_atime(inode, lower_file->f_dentry->d_inode); 196 fsstack_copy_attr_atime(inode, lower_file->f_path.dentry->d_inode);
196 return rc; 197 return rc;
197} 198}
198 199
@@ -239,7 +240,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
239 int rc = 0; 240 int rc = 0;
240 struct ecryptfs_crypt_stat *crypt_stat = NULL; 241 struct ecryptfs_crypt_stat *crypt_stat = NULL;
241 struct ecryptfs_mount_crypt_stat *mount_crypt_stat; 242 struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
242 struct dentry *ecryptfs_dentry = file->f_dentry; 243 struct dentry *ecryptfs_dentry = file->f_path.dentry;
243 /* Private value of ecryptfs_dentry allocated in 244 /* Private value of ecryptfs_dentry allocated in
244 * ecryptfs_lookup() */ 245 * ecryptfs_lookup() */
245 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); 246 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 8a1945a84c36..11f5e5076aef 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -30,6 +30,7 @@
30#include <linux/namei.h> 30#include <linux/namei.h>
31#include <linux/mount.h> 31#include <linux/mount.h>
32#include <linux/crypto.h> 32#include <linux/crypto.h>
33#include <linux/fs_stack.h>
33#include "ecryptfs_kernel.h" 34#include "ecryptfs_kernel.h"
34 35
35static struct dentry *lock_parent(struct dentry *dentry) 36static struct dentry *lock_parent(struct dentry *dentry)
@@ -53,48 +54,6 @@ static void unlock_dir(struct dentry *dir)
53 dput(dir); 54 dput(dir);
54} 55}
55 56
56void ecryptfs_copy_inode_size(struct inode *dst, const struct inode *src)
57{
58 i_size_write(dst, i_size_read((struct inode *)src));
59 dst->i_blocks = src->i_blocks;
60}
61
62void ecryptfs_copy_attr_atime(struct inode *dest, const struct inode *src)
63{
64 dest->i_atime = src->i_atime;
65}
66
67static void ecryptfs_copy_attr_times(struct inode *dest,
68 const struct inode *src)
69{
70 dest->i_atime = src->i_atime;
71 dest->i_mtime = src->i_mtime;
72 dest->i_ctime = src->i_ctime;
73}
74
75static void ecryptfs_copy_attr_timesizes(struct inode *dest,
76 const struct inode *src)
77{
78 dest->i_atime = src->i_atime;
79 dest->i_mtime = src->i_mtime;
80 dest->i_ctime = src->i_ctime;
81 ecryptfs_copy_inode_size(dest, src);
82}
83
84void ecryptfs_copy_attr_all(struct inode *dest, const struct inode *src)
85{
86 dest->i_mode = src->i_mode;
87 dest->i_nlink = src->i_nlink;
88 dest->i_uid = src->i_uid;
89 dest->i_gid = src->i_gid;
90 dest->i_rdev = src->i_rdev;
91 dest->i_atime = src->i_atime;
92 dest->i_mtime = src->i_mtime;
93 dest->i_ctime = src->i_ctime;
94 dest->i_blkbits = src->i_blkbits;
95 dest->i_flags = src->i_flags;
96}
97
98/** 57/**
99 * ecryptfs_create_underlying_file 58 * ecryptfs_create_underlying_file
100 * @lower_dir_inode: inode of the parent in the lower fs of the new file 59 * @lower_dir_inode: inode of the parent in the lower fs of the new file
@@ -171,8 +130,8 @@ ecryptfs_do_create(struct inode *directory_inode,
171 ecryptfs_printk(KERN_ERR, "Failure in ecryptfs_interpose\n"); 130 ecryptfs_printk(KERN_ERR, "Failure in ecryptfs_interpose\n");
172 goto out_lock; 131 goto out_lock;
173 } 132 }
174 ecryptfs_copy_attr_timesizes(directory_inode, 133 fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode);
175 lower_dir_dentry->d_inode); 134 fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode);
176out_lock: 135out_lock:
177 unlock_dir(lower_dir_dentry); 136 unlock_dir(lower_dir_dentry);
178out: 137out:
@@ -196,7 +155,7 @@ static int grow_file(struct dentry *ecryptfs_dentry, struct file *lower_file,
196 struct ecryptfs_file_info tmp_file_info; 155 struct ecryptfs_file_info tmp_file_info;
197 156
198 memset(&fake_file, 0, sizeof(fake_file)); 157 memset(&fake_file, 0, sizeof(fake_file));
199 fake_file.f_dentry = ecryptfs_dentry; 158 fake_file.f_path.dentry = ecryptfs_dentry;
200 memset(&tmp_file_info, 0, sizeof(tmp_file_info)); 159 memset(&tmp_file_info, 0, sizeof(tmp_file_info));
201 ecryptfs_set_file_private(&fake_file, &tmp_file_info); 160 ecryptfs_set_file_private(&fake_file, &tmp_file_info);
202 ecryptfs_set_file_lower(&fake_file, lower_file); 161 ecryptfs_set_file_lower(&fake_file, lower_file);
@@ -365,7 +324,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
365 "d_name.name = [%s]\n", lower_dentry, 324 "d_name.name = [%s]\n", lower_dentry,
366 lower_dentry->d_name.name); 325 lower_dentry->d_name.name);
367 lower_inode = lower_dentry->d_inode; 326 lower_inode = lower_dentry->d_inode;
368 ecryptfs_copy_attr_atime(dir, lower_dir_dentry->d_inode); 327 fsstack_copy_attr_atime(dir, lower_dir_dentry->d_inode);
369 BUG_ON(!atomic_read(&lower_dentry->d_count)); 328 BUG_ON(!atomic_read(&lower_dentry->d_count));
370 ecryptfs_set_dentry_private(dentry, 329 ecryptfs_set_dentry_private(dentry,
371 kmem_cache_alloc(ecryptfs_dentry_info_cache, 330 kmem_cache_alloc(ecryptfs_dentry_info_cache,
@@ -462,7 +421,8 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir,
462 rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0); 421 rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0);
463 if (rc) 422 if (rc)
464 goto out_lock; 423 goto out_lock;
465 ecryptfs_copy_attr_timesizes(dir, lower_new_dentry->d_inode); 424 fsstack_copy_attr_times(dir, lower_new_dentry->d_inode);
425 fsstack_copy_inode_size(dir, lower_new_dentry->d_inode);
466 old_dentry->d_inode->i_nlink = 426 old_dentry->d_inode->i_nlink =
467 ecryptfs_inode_to_lower(old_dentry->d_inode)->i_nlink; 427 ecryptfs_inode_to_lower(old_dentry->d_inode)->i_nlink;
468 i_size_write(new_dentry->d_inode, file_size_save); 428 i_size_write(new_dentry->d_inode, file_size_save);
@@ -488,7 +448,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
488 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc); 448 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
489 goto out_unlock; 449 goto out_unlock;
490 } 450 }
491 ecryptfs_copy_attr_times(dir, lower_dir_inode); 451 fsstack_copy_attr_times(dir, lower_dir_inode);
492 dentry->d_inode->i_nlink = 452 dentry->d_inode->i_nlink =
493 ecryptfs_inode_to_lower(dentry->d_inode)->i_nlink; 453 ecryptfs_inode_to_lower(dentry->d_inode)->i_nlink;
494 dentry->d_inode->i_ctime = dir->i_ctime; 454 dentry->d_inode->i_ctime = dir->i_ctime;
@@ -527,7 +487,8 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
527 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0); 487 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
528 if (rc) 488 if (rc)
529 goto out_lock; 489 goto out_lock;
530 ecryptfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode); 490 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
491 fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
531out_lock: 492out_lock:
532 unlock_dir(lower_dir_dentry); 493 unlock_dir(lower_dir_dentry);
533 dput(lower_dentry); 494 dput(lower_dentry);
@@ -550,7 +511,8 @@ static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
550 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0); 511 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
551 if (rc) 512 if (rc)
552 goto out; 513 goto out;
553 ecryptfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode); 514 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
515 fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
554 dir->i_nlink = lower_dir_dentry->d_inode->i_nlink; 516 dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
555out: 517out:
556 unlock_dir(lower_dir_dentry); 518 unlock_dir(lower_dir_dentry);
@@ -573,7 +535,7 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
573 dput(lower_dentry); 535 dput(lower_dentry);
574 if (!rc) 536 if (!rc)
575 d_delete(lower_dentry); 537 d_delete(lower_dentry);
576 ecryptfs_copy_attr_times(dir, lower_dir_dentry->d_inode); 538 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
577 dir->i_nlink = lower_dir_dentry->d_inode->i_nlink; 539 dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
578 unlock_dir(lower_dir_dentry); 540 unlock_dir(lower_dir_dentry);
579 if (!rc) 541 if (!rc)
@@ -597,7 +559,8 @@ ecryptfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
597 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0); 559 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
598 if (rc) 560 if (rc)
599 goto out; 561 goto out;
600 ecryptfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode); 562 fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
563 fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
601out: 564out:
602 unlock_dir(lower_dir_dentry); 565 unlock_dir(lower_dir_dentry);
603 if (!dentry->d_inode) 566 if (!dentry->d_inode)
@@ -626,9 +589,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
626 lower_new_dir_dentry->d_inode, lower_new_dentry); 589 lower_new_dir_dentry->d_inode, lower_new_dentry);
627 if (rc) 590 if (rc)
628 goto out_lock; 591 goto out_lock;
629 ecryptfs_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode); 592 fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode, NULL);
630 if (new_dir != old_dir) 593 if (new_dir != old_dir)
631 ecryptfs_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); 594 fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode, NULL);
632out_lock: 595out_lock:
633 unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); 596 unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
634 dput(lower_new_dentry->d_parent); 597 dput(lower_new_dentry->d_parent);
@@ -684,8 +647,8 @@ ecryptfs_readlink(struct dentry *dentry, char __user * buf, int bufsiz)
684 rc = -EFAULT; 647 rc = -EFAULT;
685 } 648 }
686 kfree(decoded_name); 649 kfree(decoded_name);
687 ecryptfs_copy_attr_atime(dentry->d_inode, 650 fsstack_copy_attr_atime(dentry->d_inode,
688 lower_dentry->d_inode); 651 lower_dentry->d_inode);
689 } 652 }
690out_free_lower_buf: 653out_free_lower_buf:
691 kfree(lower_buf); 654 kfree(lower_buf);
@@ -791,7 +754,7 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
791 * the file in the underlying filesystem so that the 754 * the file in the underlying filesystem so that the
792 * truncation has an effect there as well. */ 755 * truncation has an effect there as well. */
793 memset(&fake_ecryptfs_file, 0, sizeof(fake_ecryptfs_file)); 756 memset(&fake_ecryptfs_file, 0, sizeof(fake_ecryptfs_file));
794 fake_ecryptfs_file.f_dentry = dentry; 757 fake_ecryptfs_file.f_path.dentry = dentry;
795 /* Released at out_free: label */ 758 /* Released at out_free: label */
796 ecryptfs_set_file_private(&fake_ecryptfs_file, 759 ecryptfs_set_file_private(&fake_ecryptfs_file,
797 kmem_cache_alloc(ecryptfs_file_info_cache, 760 kmem_cache_alloc(ecryptfs_file_info_cache,
@@ -915,7 +878,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
915 } 878 }
916 rc = notify_change(lower_dentry, ia); 879 rc = notify_change(lower_dentry, ia);
917out: 880out:
918 ecryptfs_copy_attr_all(inode, lower_inode); 881 fsstack_copy_attr_all(inode, lower_inode, NULL);
919 return rc; 882 return rc;
920} 883}
921 884
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 3ede12b25933..d0541ae8faba 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -35,6 +35,7 @@
35#include <linux/pagemap.h> 35#include <linux/pagemap.h>
36#include <linux/key.h> 36#include <linux/key.h>
37#include <linux/parser.h> 37#include <linux/parser.h>
38#include <linux/fs_stack.h>
38#include "ecryptfs_kernel.h" 39#include "ecryptfs_kernel.h"
39 40
40/** 41/**
@@ -112,10 +113,10 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
112 d_add(dentry, inode); 113 d_add(dentry, inode);
113 else 114 else
114 d_instantiate(dentry, inode); 115 d_instantiate(dentry, inode);
115 ecryptfs_copy_attr_all(inode, lower_inode); 116 fsstack_copy_attr_all(inode, lower_inode, NULL);
116 /* This size will be overwritten for real files w/ headers and 117 /* This size will be overwritten for real files w/ headers and
117 * other metadata */ 118 * other metadata */
118 ecryptfs_copy_inode_size(inode, lower_inode); 119 fsstack_copy_inode_size(inode, lower_inode);
119out: 120out:
120 return rc; 121 return rc;
121} 122}
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 924dd90a4cf5..06843d24f239 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -51,7 +51,7 @@ static struct page *ecryptfs_get1page(struct file *file, int index)
51 struct inode *inode; 51 struct inode *inode;
52 struct address_space *mapping; 52 struct address_space *mapping;
53 53
54 dentry = file->f_dentry; 54 dentry = file->f_path.dentry;
55 inode = dentry->d_inode; 55 inode = dentry->d_inode;
56 mapping = inode->i_mapping; 56 mapping = inode->i_mapping;
57 page = read_cache_page(mapping, index, 57 page = read_cache_page(mapping, index,
@@ -84,7 +84,7 @@ int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros);
84int ecryptfs_fill_zeros(struct file *file, loff_t new_length) 84int ecryptfs_fill_zeros(struct file *file, loff_t new_length)
85{ 85{
86 int rc = 0; 86 int rc = 0;
87 struct dentry *dentry = file->f_dentry; 87 struct dentry *dentry = file->f_path.dentry;
88 struct inode *inode = dentry->d_inode; 88 struct inode *inode = dentry->d_inode;
89 pgoff_t old_end_page_index = 0; 89 pgoff_t old_end_page_index = 0;
90 pgoff_t index = old_end_page_index; 90 pgoff_t index = old_end_page_index;
@@ -218,7 +218,7 @@ int ecryptfs_do_readpage(struct file *file, struct page *page,
218 char *lower_page_data; 218 char *lower_page_data;
219 const struct address_space_operations *lower_a_ops; 219 const struct address_space_operations *lower_a_ops;
220 220
221 dentry = file->f_dentry; 221 dentry = file->f_path.dentry;
222 lower_file = ecryptfs_file_to_lower(file); 222 lower_file = ecryptfs_file_to_lower(file);
223 lower_dentry = ecryptfs_dentry_to_lower(dentry); 223 lower_dentry = ecryptfs_dentry_to_lower(dentry);
224 inode = dentry->d_inode; 224 inode = dentry->d_inode;
@@ -275,9 +275,9 @@ static int ecryptfs_readpage(struct file *file, struct page *page)
275 int rc = 0; 275 int rc = 0;
276 struct ecryptfs_crypt_stat *crypt_stat; 276 struct ecryptfs_crypt_stat *crypt_stat;
277 277
278 BUG_ON(!(file && file->f_dentry && file->f_dentry->d_inode)); 278 BUG_ON(!(file && file->f_path.dentry && file->f_path.dentry->d_inode));
279 crypt_stat = 279 crypt_stat = &ecryptfs_inode_to_private(file->f_path.dentry->d_inode)
280 &ecryptfs_inode_to_private(file->f_dentry->d_inode)->crypt_stat; 280 ->crypt_stat;
281 if (!crypt_stat 281 if (!crypt_stat
282 || !ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_ENCRYPTED) 282 || !ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_ENCRYPTED)
283 || ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE)) { 283 || ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE)) {
@@ -638,8 +638,8 @@ static int ecryptfs_commit_write(struct file *file, struct page *page,
638 lower_inode = ecryptfs_inode_to_lower(inode); 638 lower_inode = ecryptfs_inode_to_lower(inode);
639 lower_file = ecryptfs_file_to_lower(file); 639 lower_file = ecryptfs_file_to_lower(file);
640 mutex_lock(&lower_inode->i_mutex); 640 mutex_lock(&lower_inode->i_mutex);
641 crypt_stat = 641 crypt_stat = &ecryptfs_inode_to_private(file->f_path.dentry->d_inode)
642 &ecryptfs_inode_to_private(file->f_dentry->d_inode)->crypt_stat; 642 ->crypt_stat;
643 if (ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE)) { 643 if (ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE)) {
644 ecryptfs_printk(KERN_DEBUG, "ECRYPTFS_NEW_FILE flag set in " 644 ecryptfs_printk(KERN_DEBUG, "ECRYPTFS_NEW_FILE flag set in "
645 "crypt_stat at memory location [%p]\n", crypt_stat); 645 "crypt_stat at memory location [%p]\n", crypt_stat);
diff --git a/fs/efs/dir.c b/fs/efs/dir.c
index 17f5b2d3c16a..b46c488eefc8 100644
--- a/fs/efs/dir.c
+++ b/fs/efs/dir.c
@@ -20,7 +20,7 @@ struct inode_operations efs_dir_inode_operations = {
20}; 20};
21 21
22static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { 22static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
23 struct inode *inode = filp->f_dentry->d_inode; 23 struct inode *inode = filp->f_path.dentry->d_inode;
24 struct buffer_head *bh; 24 struct buffer_head *bh;
25 25
26 struct efs_dir *dirblock; 26 struct efs_dir *dirblock;
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 88a6f8d0b88e..3ae644e7e860 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -795,8 +795,8 @@ static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
795 goto eexit_4; 795 goto eexit_4;
796 dentry->d_op = &eventpollfs_dentry_operations; 796 dentry->d_op = &eventpollfs_dentry_operations;
797 d_add(dentry, inode); 797 d_add(dentry, inode);
798 file->f_vfsmnt = mntget(eventpoll_mnt); 798 file->f_path.mnt = mntget(eventpoll_mnt);
799 file->f_dentry = dentry; 799 file->f_path.dentry = dentry;
800 file->f_mapping = inode->i_mapping; 800 file->f_mapping = inode->i_mapping;
801 801
802 file->f_pos = 0; 802 file->f_pos = 0;
diff --git a/fs/exec.c b/fs/exec.c
index add0e03c3ea9..11fe93f7363c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -38,6 +38,7 @@
38#include <linux/binfmts.h> 38#include <linux/binfmts.h>
39#include <linux/swap.h> 39#include <linux/swap.h>
40#include <linux/utsname.h> 40#include <linux/utsname.h>
41#include <linux/pid_namespace.h>
41#include <linux/module.h> 42#include <linux/module.h>
42#include <linux/namei.h> 43#include <linux/namei.h>
43#include <linux/proc_fs.h> 44#include <linux/proc_fs.h>
@@ -620,8 +621,8 @@ static int de_thread(struct task_struct *tsk)
620 * Reparenting needs write_lock on tasklist_lock, 621 * Reparenting needs write_lock on tasklist_lock,
621 * so it is safe to do it under read_lock. 622 * so it is safe to do it under read_lock.
622 */ 623 */
623 if (unlikely(tsk->group_leader == child_reaper)) 624 if (unlikely(tsk->group_leader == child_reaper(tsk)))
624 child_reaper = tsk; 625 tsk->nsproxy->pid_ns->child_reaper = tsk;
625 626
626 zap_other_threads(tsk); 627 zap_other_threads(tsk);
627 read_unlock(&tasklist_lock); 628 read_unlock(&tasklist_lock);
@@ -782,7 +783,7 @@ static void flush_old_files(struct files_struct * files)
782 j++; 783 j++;
783 i = j * __NFDBITS; 784 i = j * __NFDBITS;
784 fdt = files_fdtable(files); 785 fdt = files_fdtable(files);
785 if (i >= fdt->max_fds || i >= fdt->max_fdset) 786 if (i >= fdt->max_fds)
786 break; 787 break;
787 set = fdt->close_on_exec->fds_bits[j]; 788 set = fdt->close_on_exec->fds_bits[j];
788 if (!set) 789 if (!set)
@@ -912,7 +913,7 @@ EXPORT_SYMBOL(flush_old_exec);
912int prepare_binprm(struct linux_binprm *bprm) 913int prepare_binprm(struct linux_binprm *bprm)
913{ 914{
914 int mode; 915 int mode;
915 struct inode * inode = bprm->file->f_dentry->d_inode; 916 struct inode * inode = bprm->file->f_path.dentry->d_inode;
916 int retval; 917 int retval;
917 918
918 mode = inode->i_mode; 919 mode = inode->i_mode;
@@ -922,7 +923,7 @@ int prepare_binprm(struct linux_binprm *bprm)
922 bprm->e_uid = current->euid; 923 bprm->e_uid = current->euid;
923 bprm->e_gid = current->egid; 924 bprm->e_gid = current->egid;
924 925
925 if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) { 926 if(!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)) {
926 /* Set-uid? */ 927 /* Set-uid? */
927 if (mode & S_ISUID) { 928 if (mode & S_ISUID) {
928 current->personality &= ~PER_CLEAR_ON_SETID; 929 current->personality &= ~PER_CLEAR_ON_SETID;
@@ -1519,10 +1520,10 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1519 0600); 1520 0600);
1520 if (IS_ERR(file)) 1521 if (IS_ERR(file))
1521 goto fail_unlock; 1522 goto fail_unlock;
1522 inode = file->f_dentry->d_inode; 1523 inode = file->f_path.dentry->d_inode;
1523 if (inode->i_nlink > 1) 1524 if (inode->i_nlink > 1)
1524 goto close_fail; /* multiple links - don't dump */ 1525 goto close_fail; /* multiple links - don't dump */
1525 if (!ispipe && d_unhashed(file->f_dentry)) 1526 if (!ispipe && d_unhashed(file->f_path.dentry))
1526 goto close_fail; 1527 goto close_fail;
1527 1528
1528 /* AK: actually i see no reason to not allow this for named pipes etc., 1529 /* AK: actually i see no reason to not allow this for named pipes etc.,
@@ -1533,7 +1534,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1533 goto close_fail; 1534 goto close_fail;
1534 if (!file->f_op->write) 1535 if (!file->f_op->write)
1535 goto close_fail; 1536 goto close_fail;
1536 if (!ispipe && do_truncate(file->f_dentry, 0, 0, file) != 0) 1537 if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
1537 goto close_fail; 1538 goto close_fail;
1538 1539
1539 retval = binfmt->core_dump(signr, regs, file); 1540 retval = binfmt->core_dump(signr, regs, file);
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 3e7a84a1e509..0b02ba9642d2 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -248,7 +248,7 @@ static int
248ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) 248ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
249{ 249{
250 loff_t pos = filp->f_pos; 250 loff_t pos = filp->f_pos;
251 struct inode *inode = filp->f_dentry->d_inode; 251 struct inode *inode = filp->f_path.dentry->d_inode;
252 struct super_block *sb = inode->i_sb; 252 struct super_block *sb = inode->i_sb;
253 unsigned int offset = pos & ~PAGE_CACHE_MASK; 253 unsigned int offset = pos & ~PAGE_CACHE_MASK;
254 unsigned long n = pos >> PAGE_CACHE_SHIFT; 254 unsigned long n = pos >> PAGE_CACHE_SHIFT;
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index e3cf8c81507f..4b099d310712 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -90,7 +90,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
90#ifdef CONFIG_COMPAT 90#ifdef CONFIG_COMPAT
91long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 91long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
92{ 92{
93 struct inode *inode = file->f_dentry->d_inode; 93 struct inode *inode = file->f_path.dentry->d_inode;
94 int ret; 94 int ret;
95 95
96 /* These are just misnamed, they actually get/put from/to user an int */ 96 /* These are just misnamed, they actually get/put from/to user an int */
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 255cef5f7420..6347c2dbdd81 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -597,8 +597,6 @@ static int ext2_check_descriptors (struct super_block * sb)
597 return 1; 597 return 1;
598} 598}
599 599
600#define log2(n) ffz(~(n))
601
602/* 600/*
603 * Maximal file size. There is a direct, and {,double-,triple-}indirect 601 * Maximal file size. There is a direct, and {,double-,triple-}indirect
604 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks. 602 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks.
@@ -834,9 +832,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
834 sbi->s_sbh = bh; 832 sbi->s_sbh = bh;
835 sbi->s_mount_state = le16_to_cpu(es->s_state); 833 sbi->s_mount_state = le16_to_cpu(es->s_state);
836 sbi->s_addr_per_block_bits = 834 sbi->s_addr_per_block_bits =
837 log2 (EXT2_ADDR_PER_BLOCK(sb)); 835 ilog2 (EXT2_ADDR_PER_BLOCK(sb));
838 sbi->s_desc_per_block_bits = 836 sbi->s_desc_per_block_bits =
839 log2 (EXT2_DESC_PER_BLOCK(sb)); 837 ilog2 (EXT2_DESC_PER_BLOCK(sb));
840 838
841 if (sb->s_magic != EXT2_SUPER_MAGIC) 839 if (sb->s_magic != EXT2_SUPER_MAGIC)
842 goto cantfind_ext2; 840 goto cantfind_ext2;
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index 5a9313ecd4ef..665adee99b31 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -103,7 +103,7 @@ static int ext3_readdir(struct file * filp,
103 struct ext3_dir_entry_2 *de; 103 struct ext3_dir_entry_2 *de;
104 struct super_block *sb; 104 struct super_block *sb;
105 int err; 105 int err;
106 struct inode *inode = filp->f_dentry->d_inode; 106 struct inode *inode = filp->f_path.dentry->d_inode;
107 int ret = 0; 107 int ret = 0;
108 108
109 sb = inode->i_sb; 109 sb = inode->i_sb;
@@ -122,7 +122,7 @@ static int ext3_readdir(struct file * filp,
122 * We don't set the inode dirty flag since it's not 122 * We don't set the inode dirty flag since it's not
123 * critical that it get flushed back to the disk. 123 * critical that it get flushed back to the disk.
124 */ 124 */
125 EXT3_I(filp->f_dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL; 125 EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
126 } 126 }
127#endif 127#endif
128 stored = 0; 128 stored = 0;
@@ -402,7 +402,7 @@ static int call_filldir(struct file * filp, void * dirent,
402{ 402{
403 struct dir_private_info *info = filp->private_data; 403 struct dir_private_info *info = filp->private_data;
404 loff_t curr_pos; 404 loff_t curr_pos;
405 struct inode *inode = filp->f_dentry->d_inode; 405 struct inode *inode = filp->f_path.dentry->d_inode;
406 struct super_block * sb; 406 struct super_block * sb;
407 int error; 407 int error;
408 408
@@ -432,7 +432,7 @@ static int ext3_dx_readdir(struct file * filp,
432 void * dirent, filldir_t filldir) 432 void * dirent, filldir_t filldir)
433{ 433{
434 struct dir_private_info *info = filp->private_data; 434 struct dir_private_info *info = filp->private_data;
435 struct inode *inode = filp->f_dentry->d_inode; 435 struct inode *inode = filp->f_path.dentry->d_inode;
436 struct fname *fname; 436 struct fname *fname;
437 int ret; 437 int ret;
438 438
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index e96c388047e0..881f6365c41a 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -52,7 +52,7 @@ ext3_file_write(struct kiocb *iocb, const struct iovec *iov,
52 unsigned long nr_segs, loff_t pos) 52 unsigned long nr_segs, loff_t pos)
53{ 53{
54 struct file *file = iocb->ki_filp; 54 struct file *file = iocb->ki_filp;
55 struct inode *inode = file->f_dentry->d_inode; 55 struct inode *inode = file->f_path.dentry->d_inode;
56 ssize_t ret; 56 ssize_t ret;
57 int err; 57 int err;
58 58
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
index 12daa6869572..9b8090d94e6c 100644
--- a/fs/ext3/ioctl.c
+++ b/fs/ext3/ioctl.c
@@ -257,7 +257,7 @@ flags_err:
257#ifdef CONFIG_COMPAT 257#ifdef CONFIG_COMPAT
258long ext3_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 258long ext3_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
259{ 259{
260 struct inode *inode = file->f_dentry->d_inode; 260 struct inode *inode = file->f_path.dentry->d_inode;
261 int ret; 261 int ret;
262 262
263 /* These are just misnamed, they actually get/put from/to user an int */ 263 /* These are just misnamed, they actually get/put from/to user an int */
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 60d2f9dbdb00..4df39c4315e1 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -602,7 +602,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
602 602
603 dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash, 603 dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
604 start_minor_hash)); 604 start_minor_hash));
605 dir = dir_file->f_dentry->d_inode; 605 dir = dir_file->f_path.dentry->d_inode;
606 if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { 606 if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) {
607 hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; 607 hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
608 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed; 608 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed;
@@ -613,7 +613,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
613 } 613 }
614 hinfo.hash = start_hash; 614 hinfo.hash = start_hash;
615 hinfo.minor_hash = 0; 615 hinfo.minor_hash = 0;
616 frame = dx_probe(NULL, dir_file->f_dentry->d_inode, &hinfo, frames, &err); 616 frame = dx_probe(NULL, dir_file->f_path.dentry->d_inode, &hinfo, frames, &err);
617 if (!frame) 617 if (!frame)
618 return err; 618 return err;
619 619
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 580b8a6ca979..b34886734a44 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1347,8 +1347,6 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1347 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ 1347 sb->s_flags = s_flags; /* Restore MS_RDONLY status */
1348} 1348}
1349 1349
1350#define log2(n) ffz(~(n))
1351
1352/* 1350/*
1353 * Maximal file size. There is a direct, and {,double-,triple-}indirect 1351 * Maximal file size. There is a direct, and {,double-,triple-}indirect
1354 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks. 1352 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks.
@@ -1597,8 +1595,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1597 sbi->s_desc_per_block = blocksize / sizeof(struct ext3_group_desc); 1595 sbi->s_desc_per_block = blocksize / sizeof(struct ext3_group_desc);
1598 sbi->s_sbh = bh; 1596 sbi->s_sbh = bh;
1599 sbi->s_mount_state = le16_to_cpu(es->s_state); 1597 sbi->s_mount_state = le16_to_cpu(es->s_state);
1600 sbi->s_addr_per_block_bits = log2(EXT3_ADDR_PER_BLOCK(sb)); 1598 sbi->s_addr_per_block_bits = ilog2(EXT3_ADDR_PER_BLOCK(sb));
1601 sbi->s_desc_per_block_bits = log2(EXT3_DESC_PER_BLOCK(sb)); 1599 sbi->s_desc_per_block_bits = ilog2(EXT3_DESC_PER_BLOCK(sb));
1602 for (i=0; i < 4; i++) 1600 for (i=0; i < 4; i++)
1603 sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); 1601 sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);
1604 sbi->s_def_hash_version = es->s_def_hash_version; 1602 sbi->s_def_hash_version = es->s_def_hash_version;
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index f2ed3e7fb9f5..da80368b66f0 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -103,7 +103,7 @@ static int ext4_readdir(struct file * filp,
103 struct ext4_dir_entry_2 *de; 103 struct ext4_dir_entry_2 *de;
104 struct super_block *sb; 104 struct super_block *sb;
105 int err; 105 int err;
106 struct inode *inode = filp->f_dentry->d_inode; 106 struct inode *inode = filp->f_path.dentry->d_inode;
107 int ret = 0; 107 int ret = 0;
108 108
109 sb = inode->i_sb; 109 sb = inode->i_sb;
@@ -122,7 +122,7 @@ static int ext4_readdir(struct file * filp,
122 * We don't set the inode dirty flag since it's not 122 * We don't set the inode dirty flag since it's not
123 * critical that it get flushed back to the disk. 123 * critical that it get flushed back to the disk.
124 */ 124 */
125 EXT4_I(filp->f_dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL; 125 EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
126 } 126 }
127#endif 127#endif
128 stored = 0; 128 stored = 0;
@@ -402,7 +402,7 @@ static int call_filldir(struct file * filp, void * dirent,
402{ 402{
403 struct dir_private_info *info = filp->private_data; 403 struct dir_private_info *info = filp->private_data;
404 loff_t curr_pos; 404 loff_t curr_pos;
405 struct inode *inode = filp->f_dentry->d_inode; 405 struct inode *inode = filp->f_path.dentry->d_inode;
406 struct super_block * sb; 406 struct super_block * sb;
407 int error; 407 int error;
408 408
@@ -432,7 +432,7 @@ static int ext4_dx_readdir(struct file * filp,
432 void * dirent, filldir_t filldir) 432 void * dirent, filldir_t filldir)
433{ 433{
434 struct dir_private_info *info = filp->private_data; 434 struct dir_private_info *info = filp->private_data;
435 struct inode *inode = filp->f_dentry->d_inode; 435 struct inode *inode = filp->f_path.dentry->d_inode;
436 struct fname *fname; 436 struct fname *fname;
437 int ret; 437 int ret;
438 438
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 0b622c0624b7..3bbc24b58785 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -52,7 +52,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
52 unsigned long nr_segs, loff_t pos) 52 unsigned long nr_segs, loff_t pos)
53{ 53{
54 struct file *file = iocb->ki_filp; 54 struct file *file = iocb->ki_filp;
55 struct inode *inode = file->f_dentry->d_inode; 55 struct inode *inode = file->f_path.dentry->d_inode;
56 ssize_t ret; 56 ssize_t ret;
57 int err; 57 int err;
58 58
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 1d85d4ec9598..a127cc03c9fa 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1232,7 +1232,7 @@ retry:
1232 from, to, NULL, do_journal_get_write_access); 1232 from, to, NULL, do_journal_get_write_access);
1233 if (ret) 1233 if (ret)
1234 /* fatal error, just put the handle and return */ 1234 /* fatal error, just put the handle and return */
1235 journal_stop(handle); 1235 ext4_journal_stop(handle);
1236 } 1236 }
1237 return ret; 1237 return ret;
1238 1238
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 22a737c306c7..500567dd53b6 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -256,7 +256,7 @@ flags_err:
256#ifdef CONFIG_COMPAT 256#ifdef CONFIG_COMPAT
257long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 257long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
258{ 258{
259 struct inode *inode = file->f_dentry->d_inode; 259 struct inode *inode = file->f_path.dentry->d_inode;
260 int ret; 260 int ret;
261 261
262 /* These are just misnamed, they actually get/put from/to user an int */ 262 /* These are just misnamed, they actually get/put from/to user an int */
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 859990eac504..e5a74a5ac261 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -602,7 +602,7 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
602 602
603 dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash, 603 dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
604 start_minor_hash)); 604 start_minor_hash));
605 dir = dir_file->f_dentry->d_inode; 605 dir = dir_file->f_path.dentry->d_inode;
606 if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) { 606 if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) {
607 hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version; 607 hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
608 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; 608 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
@@ -613,7 +613,7 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
613 } 613 }
614 hinfo.hash = start_hash; 614 hinfo.hash = start_hash;
615 hinfo.minor_hash = 0; 615 hinfo.minor_hash = 0;
616 frame = dx_probe(NULL, dir_file->f_dentry->d_inode, &hinfo, frames, &err); 616 frame = dx_probe(NULL, dir_file->f_path.dentry->d_inode, &hinfo, frames, &err);
617 if (!frame) 617 if (!frame)
618 return err; 618 return err;
619 619
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 69c439f44387..c16af246d245 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -579,7 +579,7 @@ parse_record:
579 if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME)) 579 if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME))
580 inum = inode->i_ino; 580 inum = inode->i_ino;
581 else if (!memcmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) { 581 else if (!memcmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) {
582 inum = parent_ino(filp->f_dentry); 582 inum = parent_ino(filp->f_path.dentry);
583 } else { 583 } else {
584 loff_t i_pos = fat_make_i_pos(sb, bh, de); 584 loff_t i_pos = fat_make_i_pos(sb, bh, de);
585 struct inode *tmp = fat_iget(sb, i_pos); 585 struct inode *tmp = fat_iget(sb, i_pos);
@@ -643,7 +643,7 @@ out:
643 643
644static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir) 644static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir)
645{ 645{
646 struct inode *inode = filp->f_dentry->d_inode; 646 struct inode *inode = filp->f_path.dentry->d_inode;
647 return __fat_readdir(inode, filp, dirent, filldir, 0, 0); 647 return __fat_readdir(inode, filp, dirent, filldir, 0, 0);
648} 648}
649 649
@@ -782,7 +782,7 @@ static long fat_compat_dir_ioctl(struct file *file, unsigned cmd,
782 782
783 set_fs(KERNEL_DS); 783 set_fs(KERNEL_DS);
784 lock_kernel(); 784 lock_kernel();
785 ret = fat_dir_ioctl(file->f_dentry->d_inode, file, 785 ret = fat_dir_ioctl(file->f_path.dentry->d_inode, file,
786 cmd, (unsigned long) &d); 786 cmd, (unsigned long) &d);
787 unlock_kernel(); 787 unlock_kernel();
788 set_fs(oldfs); 788 set_fs(oldfs);
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 0aa813d944a6..c1237b70c1fe 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -92,7 +92,7 @@ int fat_generic_ioctl(struct inode *inode, struct file *filp,
92 } 92 }
93 93
94 /* This MUST be done before doing anything irreversible... */ 94 /* This MUST be done before doing anything irreversible... */
95 err = notify_change(filp->f_dentry, &ia); 95 err = notify_change(filp->f_path.dentry, &ia);
96 if (err) 96 if (err)
97 goto up; 97 goto up;
98 98
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 4740d35e52cd..8e382a5d51bd 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -77,10 +77,9 @@ repeat:
77 start = files->next_fd; 77 start = files->next_fd;
78 78
79 newfd = start; 79 newfd = start;
80 if (start < fdt->max_fdset) { 80 if (start < fdt->max_fds)
81 newfd = find_next_zero_bit(fdt->open_fds->fds_bits, 81 newfd = find_next_zero_bit(fdt->open_fds->fds_bits,
82 fdt->max_fdset, start); 82 fdt->max_fds, start);
83 }
84 83
85 error = -EMFILE; 84 error = -EMFILE;
86 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) 85 if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
@@ -204,7 +203,7 @@ asmlinkage long sys_dup(unsigned int fildes)
204 203
205static int setfl(int fd, struct file * filp, unsigned long arg) 204static int setfl(int fd, struct file * filp, unsigned long arg)
206{ 205{
207 struct inode * inode = filp->f_dentry->d_inode; 206 struct inode * inode = filp->f_path.dentry->d_inode;
208 int error = 0; 207 int error = 0;
209 208
210 /* 209 /*
diff --git a/fs/file.c b/fs/file.c
index 51aef675470f..857fa49e984c 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -32,46 +32,28 @@ struct fdtable_defer {
32 */ 32 */
33static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list); 33static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list);
34 34
35 35static inline void * alloc_fdmem(unsigned int size)
36/*
37 * Allocate an fd array, using kmalloc or vmalloc.
38 * Note: the array isn't cleared at allocation time.
39 */
40struct file ** alloc_fd_array(int num)
41{ 36{
42 struct file **new_fds;
43 int size = num * sizeof(struct file *);
44
45 if (size <= PAGE_SIZE) 37 if (size <= PAGE_SIZE)
46 new_fds = (struct file **) kmalloc(size, GFP_KERNEL); 38 return kmalloc(size, GFP_KERNEL);
47 else 39 else
48 new_fds = (struct file **) vmalloc(size); 40 return vmalloc(size);
49 return new_fds;
50} 41}
51 42
52void free_fd_array(struct file **array, int num) 43static inline void free_fdarr(struct fdtable *fdt)
53{ 44{
54 int size = num * sizeof(struct file *); 45 if (fdt->max_fds <= (PAGE_SIZE / sizeof(struct file *)))
55 46 kfree(fdt->fd);
56 if (!array) {
57 printk (KERN_ERR "free_fd_array: array = 0 (num = %d)\n", num);
58 return;
59 }
60
61 if (num <= NR_OPEN_DEFAULT) /* Don't free the embedded fd array! */
62 return;
63 else if (size <= PAGE_SIZE)
64 kfree(array);
65 else 47 else
66 vfree(array); 48 vfree(fdt->fd);
67} 49}
68 50
69static void __free_fdtable(struct fdtable *fdt) 51static inline void free_fdset(struct fdtable *fdt)
70{ 52{
71 free_fdset(fdt->open_fds, fdt->max_fdset); 53 if (fdt->max_fds <= (PAGE_SIZE * BITS_PER_BYTE / 2))
72 free_fdset(fdt->close_on_exec, fdt->max_fdset); 54 kfree(fdt->open_fds);
73 free_fd_array(fdt->fd, fdt->max_fds); 55 else
74 kfree(fdt); 56 vfree(fdt->open_fds);
75} 57}
76 58
77static void free_fdtable_work(struct work_struct *work) 59static void free_fdtable_work(struct work_struct *work)
@@ -86,41 +68,32 @@ static void free_fdtable_work(struct work_struct *work)
86 spin_unlock_bh(&f->lock); 68 spin_unlock_bh(&f->lock);
87 while(fdt) { 69 while(fdt) {
88 struct fdtable *next = fdt->next; 70 struct fdtable *next = fdt->next;
89 __free_fdtable(fdt); 71 vfree(fdt->fd);
72 free_fdset(fdt);
73 kfree(fdt);
90 fdt = next; 74 fdt = next;
91 } 75 }
92} 76}
93 77
94static void free_fdtable_rcu(struct rcu_head *rcu) 78void free_fdtable_rcu(struct rcu_head *rcu)
95{ 79{
96 struct fdtable *fdt = container_of(rcu, struct fdtable, rcu); 80 struct fdtable *fdt = container_of(rcu, struct fdtable, rcu);
97 int fdset_size, fdarray_size;
98 struct fdtable_defer *fddef; 81 struct fdtable_defer *fddef;
99 82
100 BUG_ON(!fdt); 83 BUG_ON(!fdt);
101 fdset_size = fdt->max_fdset / 8;
102 fdarray_size = fdt->max_fds * sizeof(struct file *);
103 84
104 if (fdt->free_files) { 85 if (fdt->max_fds <= NR_OPEN_DEFAULT) {
105 /* 86 /*
106 * The this fdtable was embedded in the files structure 87 * This fdtable is embedded in the files structure and that
107 * and the files structure itself was getting destroyed. 88 * structure itself is getting destroyed.
108 * It is now safe to free the files structure.
109 */ 89 */
110 kmem_cache_free(files_cachep, fdt->free_files); 90 kmem_cache_free(files_cachep,
91 container_of(fdt, struct files_struct, fdtab));
111 return; 92 return;
112 } 93 }
113 if (fdt->max_fdset <= EMBEDDED_FD_SET_SIZE && 94 if (fdt->max_fds <= (PAGE_SIZE / sizeof(struct file *))) {
114 fdt->max_fds <= NR_OPEN_DEFAULT) {
115 /*
116 * The fdtable was embedded
117 */
118 return;
119 }
120 if (fdset_size <= PAGE_SIZE && fdarray_size <= PAGE_SIZE) {
121 kfree(fdt->open_fds);
122 kfree(fdt->close_on_exec);
123 kfree(fdt->fd); 95 kfree(fdt->fd);
96 kfree(fdt->open_fds);
124 kfree(fdt); 97 kfree(fdt);
125 } else { 98 } else {
126 fddef = &get_cpu_var(fdtable_defer_list); 99 fddef = &get_cpu_var(fdtable_defer_list);
@@ -134,136 +107,74 @@ static void free_fdtable_rcu(struct rcu_head *rcu)
134 } 107 }
135} 108}
136 109
137void free_fdtable(struct fdtable *fdt)
138{
139 if (fdt->free_files ||
140 fdt->max_fdset > EMBEDDED_FD_SET_SIZE ||
141 fdt->max_fds > NR_OPEN_DEFAULT)
142 call_rcu(&fdt->rcu, free_fdtable_rcu);
143}
144
145/* 110/*
146 * Expand the fdset in the files_struct. Called with the files spinlock 111 * Expand the fdset in the files_struct. Called with the files spinlock
147 * held for write. 112 * held for write.
148 */ 113 */
149static void copy_fdtable(struct fdtable *nfdt, struct fdtable *fdt) 114static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
150{ 115{
151 int i; 116 unsigned int cpy, set;
152 int count;
153
154 BUG_ON(nfdt->max_fdset < fdt->max_fdset);
155 BUG_ON(nfdt->max_fds < fdt->max_fds);
156 /* Copy the existing tables and install the new pointers */
157
158 i = fdt->max_fdset / (sizeof(unsigned long) * 8);
159 count = (nfdt->max_fdset - fdt->max_fdset) / 8;
160 117
161 /* 118 BUG_ON(nfdt->max_fds < ofdt->max_fds);
162 * Don't copy the entire array if the current fdset is 119 if (ofdt->max_fds == 0)
163 * not yet initialised. 120 return;
164 */
165 if (i) {
166 memcpy (nfdt->open_fds, fdt->open_fds,
167 fdt->max_fdset/8);
168 memcpy (nfdt->close_on_exec, fdt->close_on_exec,
169 fdt->max_fdset/8);
170 memset (&nfdt->open_fds->fds_bits[i], 0, count);
171 memset (&nfdt->close_on_exec->fds_bits[i], 0, count);
172 }
173
174 /* Don't copy/clear the array if we are creating a new
175 fd array for fork() */
176 if (fdt->max_fds) {
177 memcpy(nfdt->fd, fdt->fd,
178 fdt->max_fds * sizeof(struct file *));
179 /* clear the remainder of the array */
180 memset(&nfdt->fd[fdt->max_fds], 0,
181 (nfdt->max_fds - fdt->max_fds) *
182 sizeof(struct file *));
183 }
184}
185
186/*
187 * Allocate an fdset array, using kmalloc or vmalloc.
188 * Note: the array isn't cleared at allocation time.
189 */
190fd_set * alloc_fdset(int num)
191{
192 fd_set *new_fdset;
193 int size = num / 8;
194 121
195 if (size <= PAGE_SIZE) 122 cpy = ofdt->max_fds * sizeof(struct file *);
196 new_fdset = (fd_set *) kmalloc(size, GFP_KERNEL); 123 set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *);
197 else 124 memcpy(nfdt->fd, ofdt->fd, cpy);
198 new_fdset = (fd_set *) vmalloc(size); 125 memset((char *)(nfdt->fd) + cpy, 0, set);
199 return new_fdset; 126
127 cpy = ofdt->max_fds / BITS_PER_BYTE;
128 set = (nfdt->max_fds - ofdt->max_fds) / BITS_PER_BYTE;
129 memcpy(nfdt->open_fds, ofdt->open_fds, cpy);
130 memset((char *)(nfdt->open_fds) + cpy, 0, set);
131 memcpy(nfdt->close_on_exec, ofdt->close_on_exec, cpy);
132 memset((char *)(nfdt->close_on_exec) + cpy, 0, set);
200} 133}
201 134
202void free_fdset(fd_set *array, int num) 135static struct fdtable * alloc_fdtable(unsigned int nr)
203{ 136{
204 if (num <= EMBEDDED_FD_SET_SIZE) /* Don't free an embedded fdset */ 137 struct fdtable *fdt;
205 return; 138 char *data;
206 else if (num <= 8 * PAGE_SIZE)
207 kfree(array);
208 else
209 vfree(array);
210}
211 139
212static struct fdtable *alloc_fdtable(int nr) 140 /*
213{ 141 * Figure out how many fds we actually want to support in this fdtable.
214 struct fdtable *fdt = NULL; 142 * Allocation steps are keyed to the size of the fdarray, since it
215 int nfds = 0; 143 * grows far faster than any of the other dynamic data. We try to fit
216 fd_set *new_openset = NULL, *new_execset = NULL; 144 * the fdarray into comfortable page-tuned chunks: starting at 1024B
217 struct file **new_fds; 145 * and growing in powers of two from there on.
146 */
147 nr /= (1024 / sizeof(struct file *));
148 nr = roundup_pow_of_two(nr + 1);
149 nr *= (1024 / sizeof(struct file *));
150 if (nr > NR_OPEN)
151 nr = NR_OPEN;
218 152
219 fdt = kzalloc(sizeof(*fdt), GFP_KERNEL); 153 fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL);
220 if (!fdt) 154 if (!fdt)
221 goto out; 155 goto out;
222 156 fdt->max_fds = nr;
223 nfds = max_t(int, 8 * L1_CACHE_BYTES, roundup_pow_of_two(nr + 1)); 157 data = alloc_fdmem(nr * sizeof(struct file *));
224 if (nfds > NR_OPEN) 158 if (!data)
225 nfds = NR_OPEN; 159 goto out_fdt;
160 fdt->fd = (struct file **)data;
161 data = alloc_fdmem(max_t(unsigned int,
162 2 * nr / BITS_PER_BYTE, L1_CACHE_BYTES));
163 if (!data)
164 goto out_arr;
165 fdt->open_fds = (fd_set *)data;
166 data += nr / BITS_PER_BYTE;
167 fdt->close_on_exec = (fd_set *)data;
168 INIT_RCU_HEAD(&fdt->rcu);
169 fdt->next = NULL;
226 170
227 new_openset = alloc_fdset(nfds);
228 new_execset = alloc_fdset(nfds);
229 if (!new_openset || !new_execset)
230 goto out;
231 fdt->open_fds = new_openset;
232 fdt->close_on_exec = new_execset;
233 fdt->max_fdset = nfds;
234
235 nfds = NR_OPEN_DEFAULT;
236 /*
237 * Expand to the max in easy steps, and keep expanding it until
238 * we have enough for the requested fd array size.
239 */
240 do {
241#if NR_OPEN_DEFAULT < 256
242 if (nfds < 256)
243 nfds = 256;
244 else
245#endif
246 if (nfds < (PAGE_SIZE / sizeof(struct file *)))
247 nfds = PAGE_SIZE / sizeof(struct file *);
248 else {
249 nfds = nfds * 2;
250 if (nfds > NR_OPEN)
251 nfds = NR_OPEN;
252 }
253 } while (nfds <= nr);
254 new_fds = alloc_fd_array(nfds);
255 if (!new_fds)
256 goto out2;
257 fdt->fd = new_fds;
258 fdt->max_fds = nfds;
259 fdt->free_files = NULL;
260 return fdt; 171 return fdt;
261out2: 172
262 nfds = fdt->max_fdset; 173out_arr:
263out: 174 free_fdarr(fdt);
264 free_fdset(new_openset, nfds); 175out_fdt:
265 free_fdset(new_execset, nfds);
266 kfree(fdt); 176 kfree(fdt);
177out:
267 return NULL; 178 return NULL;
268} 179}
269 180
@@ -290,14 +201,17 @@ static int expand_fdtable(struct files_struct *files, int nr)
290 * we dropped the lock 201 * we dropped the lock
291 */ 202 */
292 cur_fdt = files_fdtable(files); 203 cur_fdt = files_fdtable(files);
293 if (nr >= cur_fdt->max_fds || nr >= cur_fdt->max_fdset) { 204 if (nr >= cur_fdt->max_fds) {
294 /* Continue as planned */ 205 /* Continue as planned */
295 copy_fdtable(new_fdt, cur_fdt); 206 copy_fdtable(new_fdt, cur_fdt);
296 rcu_assign_pointer(files->fdt, new_fdt); 207 rcu_assign_pointer(files->fdt, new_fdt);
297 free_fdtable(cur_fdt); 208 if (cur_fdt->max_fds > NR_OPEN_DEFAULT)
209 call_rcu(&cur_fdt->rcu, free_fdtable_rcu);
298 } else { 210 } else {
299 /* Somebody else expanded, so undo our attempt */ 211 /* Somebody else expanded, so undo our attempt */
300 __free_fdtable(new_fdt); 212 free_fdarr(new_fdt);
213 free_fdset(new_fdt);
214 kfree(new_fdt);
301 } 215 }
302 return 1; 216 return 1;
303} 217}
@@ -316,11 +230,10 @@ int expand_files(struct files_struct *files, int nr)
316 230
317 fdt = files_fdtable(files); 231 fdt = files_fdtable(files);
318 /* Do we need to expand? */ 232 /* Do we need to expand? */
319 if (nr < fdt->max_fdset && nr < fdt->max_fds) 233 if (nr < fdt->max_fds)
320 return 0; 234 return 0;
321 /* Can we expand? */ 235 /* Can we expand? */
322 if (fdt->max_fdset >= NR_OPEN || fdt->max_fds >= NR_OPEN || 236 if (nr >= NR_OPEN)
323 nr >= NR_OPEN)
324 return -EMFILE; 237 return -EMFILE;
325 238
326 /* All good, so we try */ 239 /* All good, so we try */
diff --git a/fs/file_table.c b/fs/file_table.c
index 24f25a057d9c..4c17a18d8c10 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -152,8 +152,8 @@ EXPORT_SYMBOL(fput);
152 */ 152 */
153void fastcall __fput(struct file *file) 153void fastcall __fput(struct file *file)
154{ 154{
155 struct dentry *dentry = file->f_dentry; 155 struct dentry *dentry = file->f_path.dentry;
156 struct vfsmount *mnt = file->f_vfsmnt; 156 struct vfsmount *mnt = file->f_path.mnt;
157 struct inode *inode = dentry->d_inode; 157 struct inode *inode = dentry->d_inode;
158 158
159 might_sleep(); 159 might_sleep();
@@ -176,8 +176,8 @@ void fastcall __fput(struct file *file)
176 put_write_access(inode); 176 put_write_access(inode);
177 put_pid(file->f_owner.pid); 177 put_pid(file->f_owner.pid);
178 file_kill(file); 178 file_kill(file);
179 file->f_dentry = NULL; 179 file->f_path.dentry = NULL;
180 file->f_vfsmnt = NULL; 180 file->f_path.mnt = NULL;
181 file_free(file); 181 file_free(file);
182 dput(dentry); 182 dput(dentry);
183 mntput(mnt); 183 mntput(mnt);
@@ -271,7 +271,7 @@ int fs_may_remount_ro(struct super_block *sb)
271 file_list_lock(); 271 file_list_lock();
272 list_for_each(p, &sb->s_files) { 272 list_for_each(p, &sb->s_files) {
273 struct file *file = list_entry(p, struct file, f_u.fu_list); 273 struct file *file = list_entry(p, struct file, f_u.fu_list);
274 struct inode *inode = file->f_dentry->d_inode; 274 struct inode *inode = file->f_path.dentry->d_inode;
275 275
276 /* File with pending delete? */ 276 /* File with pending delete? */
277 if (inode->i_nlink == 0) 277 if (inode->i_nlink == 0)
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c
index 43886fa00a2a..3995d7fbedab 100644
--- a/fs/freevxfs/vxfs_lookup.c
+++ b/fs/freevxfs/vxfs_lookup.c
@@ -240,7 +240,7 @@ vxfs_lookup(struct inode *dip, struct dentry *dp, struct nameidata *nd)
240static int 240static int
241vxfs_readdir(struct file *fp, void *retp, filldir_t filler) 241vxfs_readdir(struct file *fp, void *retp, filldir_t filler)
242{ 242{
243 struct inode *ip = fp->f_dentry->d_inode; 243 struct inode *ip = fp->f_path.dentry->d_inode;
244 struct super_block *sbp = ip->i_sb; 244 struct super_block *sbp = ip->i_sb;
245 u_long bsize = sbp->s_blocksize; 245 u_long bsize = sbp->s_blocksize;
246 u_long page, npages, block, pblocks, nblocks, offset; 246 u_long page, npages, block, pblocks, nblocks, offset;
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 16b39c053d47..8c58bd453993 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -23,7 +23,7 @@ static struct fuse_conn *fuse_ctl_file_conn_get(struct file *file)
23{ 23{
24 struct fuse_conn *fc; 24 struct fuse_conn *fc;
25 mutex_lock(&fuse_mutex); 25 mutex_lock(&fuse_mutex);
26 fc = file->f_dentry->d_inode->i_private; 26 fc = file->f_path.dentry->d_inode->i_private;
27 if (fc) 27 if (fc)
28 fc = fuse_conn_get(fc); 28 fc = fuse_conn_get(fc);
29 mutex_unlock(&fuse_mutex); 29 mutex_unlock(&fuse_mutex);
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 1cabdb229adb..40080477ceb4 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -856,7 +856,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
856 int err; 856 int err;
857 size_t nbytes; 857 size_t nbytes;
858 struct page *page; 858 struct page *page;
859 struct inode *inode = file->f_dentry->d_inode; 859 struct inode *inode = file->f_path.dentry->d_inode;
860 struct fuse_conn *fc = get_fuse_conn(inode); 860 struct fuse_conn *fc = get_fuse_conn(inode);
861 struct fuse_req *req; 861 struct fuse_req *req;
862 862
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 128f79c40803..1387749201b3 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -141,8 +141,8 @@ int fuse_release_common(struct inode *inode, struct file *file, int isdir)
141 isdir ? FUSE_RELEASEDIR : FUSE_RELEASE); 141 isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
142 142
143 /* Hold vfsmount and dentry until release is finished */ 143 /* Hold vfsmount and dentry until release is finished */
144 req->vfsmount = mntget(file->f_vfsmnt); 144 req->vfsmount = mntget(file->f_path.mnt);
145 req->dentry = dget(file->f_dentry); 145 req->dentry = dget(file->f_path.dentry);
146 request_send_background(fc, req); 146 request_send_background(fc, req);
147 } 147 }
148 148
@@ -184,7 +184,7 @@ static u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id)
184 184
185static int fuse_flush(struct file *file, fl_owner_t id) 185static int fuse_flush(struct file *file, fl_owner_t id)
186{ 186{
187 struct inode *inode = file->f_dentry->d_inode; 187 struct inode *inode = file->f_path.dentry->d_inode;
188 struct fuse_conn *fc = get_fuse_conn(inode); 188 struct fuse_conn *fc = get_fuse_conn(inode);
189 struct fuse_file *ff = file->private_data; 189 struct fuse_file *ff = file->private_data;
190 struct fuse_req *req; 190 struct fuse_req *req;
@@ -533,7 +533,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,
533static ssize_t fuse_direct_io(struct file *file, const char __user *buf, 533static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
534 size_t count, loff_t *ppos, int write) 534 size_t count, loff_t *ppos, int write)
535{ 535{
536 struct inode *inode = file->f_dentry->d_inode; 536 struct inode *inode = file->f_path.dentry->d_inode;
537 struct fuse_conn *fc = get_fuse_conn(inode); 537 struct fuse_conn *fc = get_fuse_conn(inode);
538 size_t nmax = write ? fc->max_write : fc->max_read; 538 size_t nmax = write ? fc->max_write : fc->max_read;
539 loff_t pos = *ppos; 539 loff_t pos = *ppos;
@@ -607,7 +607,7 @@ static ssize_t fuse_direct_read(struct file *file, char __user *buf,
607static ssize_t fuse_direct_write(struct file *file, const char __user *buf, 607static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
608 size_t count, loff_t *ppos) 608 size_t count, loff_t *ppos)
609{ 609{
610 struct inode *inode = file->f_dentry->d_inode; 610 struct inode *inode = file->f_path.dentry->d_inode;
611 ssize_t res; 611 ssize_t res;
612 /* Don't allow parallel writes to the same file */ 612 /* Don't allow parallel writes to the same file */
613 mutex_lock(&inode->i_mutex); 613 mutex_lock(&inode->i_mutex);
@@ -662,7 +662,7 @@ static int convert_fuse_file_lock(const struct fuse_file_lock *ffl,
662static void fuse_lk_fill(struct fuse_req *req, struct file *file, 662static void fuse_lk_fill(struct fuse_req *req, struct file *file,
663 const struct file_lock *fl, int opcode, pid_t pid) 663 const struct file_lock *fl, int opcode, pid_t pid)
664{ 664{
665 struct inode *inode = file->f_dentry->d_inode; 665 struct inode *inode = file->f_path.dentry->d_inode;
666 struct fuse_conn *fc = get_fuse_conn(inode); 666 struct fuse_conn *fc = get_fuse_conn(inode);
667 struct fuse_file *ff = file->private_data; 667 struct fuse_file *ff = file->private_data;
668 struct fuse_lk_in *arg = &req->misc.lk_in; 668 struct fuse_lk_in *arg = &req->misc.lk_in;
@@ -682,7 +682,7 @@ static void fuse_lk_fill(struct fuse_req *req, struct file *file,
682 682
683static int fuse_getlk(struct file *file, struct file_lock *fl) 683static int fuse_getlk(struct file *file, struct file_lock *fl)
684{ 684{
685 struct inode *inode = file->f_dentry->d_inode; 685 struct inode *inode = file->f_path.dentry->d_inode;
686 struct fuse_conn *fc = get_fuse_conn(inode); 686 struct fuse_conn *fc = get_fuse_conn(inode);
687 struct fuse_req *req; 687 struct fuse_req *req;
688 struct fuse_lk_out outarg; 688 struct fuse_lk_out outarg;
@@ -707,7 +707,7 @@ static int fuse_getlk(struct file *file, struct file_lock *fl)
707 707
708static int fuse_setlk(struct file *file, struct file_lock *fl) 708static int fuse_setlk(struct file *file, struct file_lock *fl)
709{ 709{
710 struct inode *inode = file->f_dentry->d_inode; 710 struct inode *inode = file->f_path.dentry->d_inode;
711 struct fuse_conn *fc = get_fuse_conn(inode); 711 struct fuse_conn *fc = get_fuse_conn(inode);
712 struct fuse_req *req; 712 struct fuse_req *req;
713 int opcode = (fl->fl_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK; 713 int opcode = (fl->fl_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK;
@@ -734,7 +734,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl)
734 734
735static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl) 735static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
736{ 736{
737 struct inode *inode = file->f_dentry->d_inode; 737 struct inode *inode = file->f_path.dentry->d_inode;
738 struct fuse_conn *fc = get_fuse_conn(inode); 738 struct fuse_conn *fc = get_fuse_conn(inode);
739 int err; 739 int err;
740 740
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index b3f1e0349ae0..faa07e4b97d0 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -247,7 +247,7 @@ static const u32 gfs2_to_fsflags[32] = {
247 247
248static int gfs2_get_flags(struct file *filp, u32 __user *ptr) 248static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
249{ 249{
250 struct inode *inode = filp->f_dentry->d_inode; 250 struct inode *inode = filp->f_path.dentry->d_inode;
251 struct gfs2_inode *ip = GFS2_I(inode); 251 struct gfs2_inode *ip = GFS2_I(inode);
252 struct gfs2_holder gh; 252 struct gfs2_holder gh;
253 int error; 253 int error;
@@ -305,7 +305,7 @@ void gfs2_set_inode_flags(struct inode *inode)
305 */ 305 */
306static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) 306static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
307{ 307{
308 struct inode *inode = filp->f_dentry->d_inode; 308 struct inode *inode = filp->f_path.dentry->d_inode;
309 struct gfs2_inode *ip = GFS2_I(inode); 309 struct gfs2_inode *ip = GFS2_I(inode);
310 struct gfs2_sbd *sdp = GFS2_SB(inode); 310 struct gfs2_sbd *sdp = GFS2_SB(inode);
311 struct buffer_head *bh; 311 struct buffer_head *bh;
@@ -588,7 +588,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
588{ 588{
589 struct gfs2_file *fp = file->private_data; 589 struct gfs2_file *fp = file->private_data;
590 struct gfs2_holder *fl_gh = &fp->f_fl_gh; 590 struct gfs2_holder *fl_gh = &fp->f_fl_gh;
591 struct gfs2_inode *ip = GFS2_I(file->f_dentry->d_inode); 591 struct gfs2_inode *ip = GFS2_I(file->f_path.dentry->d_inode);
592 struct gfs2_glock *gl; 592 struct gfs2_glock *gl;
593 unsigned int state; 593 unsigned int state;
594 int flags; 594 int flags;
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 37d681b4f216..e2e0358da335 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -53,7 +53,7 @@ done:
53 */ 53 */
54static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 54static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
55{ 55{
56 struct inode *inode = filp->f_dentry->d_inode; 56 struct inode *inode = filp->f_path.dentry->d_inode;
57 struct super_block *sb = inode->i_sb; 57 struct super_block *sb = inode->i_sb;
58 int len, err; 58 int len, err;
59 char strbuf[HFS_MAX_NAMELEN]; 59 char strbuf[HFS_MAX_NAMELEN];
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 02f5573e0349..5cb7f8fee8d6 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -102,7 +102,7 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
102 const struct iovec *iov, loff_t offset, unsigned long nr_segs) 102 const struct iovec *iov, loff_t offset, unsigned long nr_segs)
103{ 103{
104 struct file *file = iocb->ki_filp; 104 struct file *file = iocb->ki_filp;
105 struct inode *inode = file->f_dentry->d_inode->i_mapping->host; 105 struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
106 106
107 return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 107 return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
108 offset, nr_segs, hfs_get_block, NULL); 108 offset, nr_segs, hfs_get_block, NULL);
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 7e309751645f..e886ac8460d3 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -111,7 +111,7 @@ fail:
111 111
112static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) 112static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
113{ 113{
114 struct inode *inode = filp->f_dentry->d_inode; 114 struct inode *inode = filp->f_path.dentry->d_inode;
115 struct super_block *sb = inode->i_sb; 115 struct super_block *sb = inode->i_sb;
116 int len, err; 116 int len, err;
117 char strbuf[HFSPLUS_MAX_STRLEN + 1]; 117 char strbuf[HFSPLUS_MAX_STRLEN + 1];
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 9e3675249633..75e8c4d8aac3 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -97,7 +97,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
97 const struct iovec *iov, loff_t offset, unsigned long nr_segs) 97 const struct iovec *iov, loff_t offset, unsigned long nr_segs)
98{ 98{
99 struct file *file = iocb->ki_filp; 99 struct file *file = iocb->ki_filp;
100 struct inode *inode = file->f_dentry->d_inode->i_mapping->host; 100 struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
101 101
102 return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 102 return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
103 offset, nr_segs, hfsplus_get_block, NULL); 103 offset, nr_segs, hfsplus_get_block, NULL);
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index b6bd33ca3731..1e6fc3799876 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -35,7 +35,7 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode)
35 return(list_entry(inode, struct hostfs_inode_info, vfs_inode)); 35 return(list_entry(inode, struct hostfs_inode_info, vfs_inode));
36} 36}
37 37
38#define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_dentry->d_inode) 38#define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_path.dentry->d_inode)
39 39
40int hostfs_d_delete(struct dentry *dentry) 40int hostfs_d_delete(struct dentry *dentry)
41{ 41{
@@ -325,7 +325,7 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir)
325 unsigned long long next, ino; 325 unsigned long long next, ino;
326 int error, len; 326 int error, len;
327 327
328 name = dentry_name(file->f_dentry, 0); 328 name = dentry_name(file->f_path.dentry, 0);
329 if(name == NULL) return(-ENOMEM); 329 if(name == NULL) return(-ENOMEM);
330 dir = open_dir(name, &error); 330 dir = open_dir(name, &error);
331 kfree(name); 331 kfree(name);
@@ -366,7 +366,7 @@ int hostfs_file_open(struct inode *ino, struct file *file)
366 if(w) 366 if(w)
367 r = 1; 367 r = 1;
368 368
369 name = dentry_name(file->f_dentry, 0); 369 name = dentry_name(file->f_path.dentry, 0);
370 if(name == NULL) 370 if(name == NULL)
371 return(-ENOMEM); 371 return(-ENOMEM);
372 372
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index 594f9c428fc2..6916c41d7017 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -24,7 +24,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
24 loff_t new_off = off + (whence == 1 ? filp->f_pos : 0); 24 loff_t new_off = off + (whence == 1 ? filp->f_pos : 0);
25 loff_t pos; 25 loff_t pos;
26 struct quad_buffer_head qbh; 26 struct quad_buffer_head qbh;
27 struct inode *i = filp->f_dentry->d_inode; 27 struct inode *i = filp->f_path.dentry->d_inode;
28 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); 28 struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
29 struct super_block *s = i->i_sb; 29 struct super_block *s = i->i_sb;
30 30
@@ -52,7 +52,7 @@ fail:
52 52
53static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 53static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
54{ 54{
55 struct inode *inode = filp->f_dentry->d_inode; 55 struct inode *inode = filp->f_path.dentry->d_inode;
56 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); 56 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
57 struct quad_buffer_head qbh; 57 struct quad_buffer_head qbh;
58 struct hpfs_dirent *de; 58 struct hpfs_dirent *de;
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 8b94d24855f0..fb4c8915010a 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -115,7 +115,7 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
115 115
116 retval = do_sync_write(file, buf, count, ppos); 116 retval = do_sync_write(file, buf, count, ppos);
117 if (retval > 0) 117 if (retval > 0)
118 hpfs_i(file->f_dentry->d_inode)->i_dirty = 1; 118 hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1;
119 return retval; 119 return retval;
120} 120}
121 121
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
index 642675fc394a..afd340a45da4 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -221,7 +221,7 @@ static ssize_t read_proc(struct file *file, char __user *buf, ssize_t count,
221 ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); 221 ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
222 ssize_t n; 222 ssize_t n;
223 223
224 read = file->f_dentry->d_inode->i_fop->read; 224 read = file->f_path.dentry->d_inode->i_fop->read;
225 225
226 if(!is_user) 226 if(!is_user)
227 set_fs(KERNEL_DS); 227 set_fs(KERNEL_DS);
@@ -320,7 +320,7 @@ static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len
320 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); 320 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
321 int err; 321 int err;
322 322
323 write = proc_file->f_dentry->d_inode->i_fop->write; 323 write = proc_file->f_path.dentry->d_inode->i_fop->write;
324 324
325 proc_file->f_pos = file->f_pos; 325 proc_file->f_pos = file->f_pos;
326 err = (*write)(proc_file, buf, len, &proc_file->f_pos); 326 err = (*write)(proc_file, buf, len, &proc_file->f_pos);
@@ -464,7 +464,7 @@ static int hppfs_open(struct inode *inode, struct file *file)
464 if(data == NULL) 464 if(data == NULL)
465 goto out; 465 goto out;
466 466
467 host_file = dentry_name(file->f_dentry, strlen("/rw")); 467 host_file = dentry_name(file->f_path.dentry, strlen("/rw"));
468 if(host_file == NULL) 468 if(host_file == NULL)
469 goto out_free2; 469 goto out_free2;
470 470
@@ -547,7 +547,7 @@ static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
547 loff_t (*llseek)(struct file *, loff_t, int); 547 loff_t (*llseek)(struct file *, loff_t, int);
548 loff_t ret; 548 loff_t ret;
549 549
550 llseek = proc_file->f_dentry->d_inode->i_fop->llseek; 550 llseek = proc_file->f_path.dentry->d_inode->i_fop->llseek;
551 if(llseek != NULL){ 551 if(llseek != NULL){
552 ret = (*llseek)(proc_file, off, where); 552 ret = (*llseek)(proc_file, off, where);
553 if(ret < 0) 553 if(ret < 0)
@@ -591,10 +591,10 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
591 struct hppfs_dirent dirent = ((struct hppfs_dirent) 591 struct hppfs_dirent dirent = ((struct hppfs_dirent)
592 { .vfs_dirent = ent, 592 { .vfs_dirent = ent,
593 .filldir = filldir, 593 .filldir = filldir,
594 .dentry = file->f_dentry } ); 594 .dentry = file->f_path.dentry } );
595 int err; 595 int err;
596 596
597 readdir = proc_file->f_dentry->d_inode->i_fop->readdir; 597 readdir = proc_file->f_path.dentry->d_inode->i_fop->readdir;
598 598
599 proc_file->f_pos = file->f_pos; 599 proc_file->f_pos = file->f_pos;
600 err = (*readdir)(proc_file, &dirent, hppfs_filldir); 600 err = (*readdir)(proc_file, &dirent, hppfs_filldir);
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 0706f5aac6a2..ed2c22340ad7 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -58,7 +58,7 @@ static void huge_pagevec_release(struct pagevec *pvec)
58 58
59static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) 59static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
60{ 60{
61 struct inode *inode = file->f_dentry->d_inode; 61 struct inode *inode = file->f_path.dentry->d_inode;
62 loff_t len, vma_len; 62 loff_t len, vma_len;
63 int ret; 63 int ret;
64 64
@@ -774,8 +774,8 @@ struct file *hugetlb_zero_setup(size_t size)
774 d_instantiate(dentry, inode); 774 d_instantiate(dentry, inode);
775 inode->i_size = size; 775 inode->i_size = size;
776 inode->i_nlink = 0; 776 inode->i_nlink = 0;
777 file->f_vfsmnt = mntget(hugetlbfs_vfsmount); 777 file->f_path.mnt = mntget(hugetlbfs_vfsmount);
778 file->f_dentry = dentry; 778 file->f_path.dentry = dentry;
779 file->f_mapping = inode->i_mapping; 779 file->f_mapping = inode->i_mapping;
780 file->f_op = &hugetlbfs_file_operations; 780 file->f_op = &hugetlbfs_file_operations;
781 file->f_mode = FMODE_WRITE | FMODE_READ; 781 file->f_mode = FMODE_WRITE | FMODE_READ;
diff --git a/fs/inode.c b/fs/inode.c
index 9ecccab7326d..d00de182ecb9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1200,7 +1200,7 @@ EXPORT_SYMBOL(touch_atime);
1200 1200
1201void file_update_time(struct file *file) 1201void file_update_time(struct file *file)
1202{ 1202{
1203 struct inode *inode = file->f_dentry->d_inode; 1203 struct inode *inode = file->f_path.dentry->d_inode;
1204 struct timespec now; 1204 struct timespec now;
1205 int sync_it = 0; 1205 int sync_it = 0;
1206 1206
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index e1956e6f116c..55f6da55b7c0 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -570,9 +570,9 @@ asmlinkage long sys_inotify_init(void)
570 dev->ih = ih; 570 dev->ih = ih;
571 571
572 filp->f_op = &inotify_fops; 572 filp->f_op = &inotify_fops;
573 filp->f_vfsmnt = mntget(inotify_mnt); 573 filp->f_path.mnt = mntget(inotify_mnt);
574 filp->f_dentry = dget(inotify_mnt->mnt_root); 574 filp->f_path.dentry = dget(inotify_mnt->mnt_root);
575 filp->f_mapping = filp->f_dentry->d_inode->i_mapping; 575 filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;
576 filp->f_mode = FMODE_READ; 576 filp->f_mode = FMODE_READ;
577 filp->f_flags = O_RDONLY; 577 filp->f_flags = O_RDONLY;
578 filp->private_data = dev; 578 filp->private_data = dev;
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 4b7660b09ac0..ff61772ceedd 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -31,7 +31,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
31 goto out; 31 goto out;
32 } else if (filp->f_op->ioctl) { 32 } else if (filp->f_op->ioctl) {
33 lock_kernel(); 33 lock_kernel();
34 error = filp->f_op->ioctl(filp->f_dentry->d_inode, 34 error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
35 filp, cmd, arg); 35 filp, cmd, arg);
36 unlock_kernel(); 36 unlock_kernel();
37 } 37 }
@@ -45,7 +45,7 @@ static int file_ioctl(struct file *filp, unsigned int cmd,
45{ 45{
46 int error; 46 int error;
47 int block; 47 int block;
48 struct inode * inode = filp->f_dentry->d_inode; 48 struct inode * inode = filp->f_path.dentry->d_inode;
49 int __user *p = (int __user *)arg; 49 int __user *p = (int __user *)arg;
50 50
51 switch (cmd) { 51 switch (cmd) {
@@ -137,17 +137,17 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon
137 break; 137 break;
138 138
139 case FIOQSIZE: 139 case FIOQSIZE:
140 if (S_ISDIR(filp->f_dentry->d_inode->i_mode) || 140 if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) ||
141 S_ISREG(filp->f_dentry->d_inode->i_mode) || 141 S_ISREG(filp->f_path.dentry->d_inode->i_mode) ||
142 S_ISLNK(filp->f_dentry->d_inode->i_mode)) { 142 S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) {
143 loff_t res = inode_get_bytes(filp->f_dentry->d_inode); 143 loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode);
144 error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0; 144 error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0;
145 } 145 }
146 else 146 else
147 error = -ENOTTY; 147 error = -ENOTTY;
148 break; 148 break;
149 default: 149 default:
150 if (S_ISREG(filp->f_dentry->d_inode->i_mode)) 150 if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
151 error = file_ioctl(filp, cmd, arg); 151 error = file_ioctl(filp, cmd, arg);
152 else 152 else
153 error = do_ioctl(filp, cmd, arg); 153 error = do_ioctl(filp, cmd, arg);
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 731816332b12..6bbbdb53581d 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -42,7 +42,7 @@ static struct semaphore zisofs_zlib_semaphore;
42 */ 42 */
43static int zisofs_readpage(struct file *file, struct page *page) 43static int zisofs_readpage(struct file *file, struct page *page)
44{ 44{
45 struct inode *inode = file->f_dentry->d_inode; 45 struct inode *inode = file->f_path.dentry->d_inode;
46 struct address_space *mapping = inode->i_mapping; 46 struct address_space *mapping = inode->i_mapping;
47 unsigned int maxpage, xpage, fpage, blockindex; 47 unsigned int maxpage, xpage, fpage, blockindex;
48 unsigned long offset; 48 unsigned long offset;
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 27e276987fd2..4af2548f97a9 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -183,7 +183,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
183 183
184 /* Handle the case of the '..' directory */ 184 /* Handle the case of the '..' directory */
185 if (de->name_len[0] == 1 && de->name[0] == 1) { 185 if (de->name_len[0] == 1 && de->name[0] == 1) {
186 inode_number = parent_ino(filp->f_dentry); 186 inode_number = parent_ino(filp->f_path.dentry);
187 if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0) 187 if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0)
188 break; 188 break;
189 filp->f_pos += de_len; 189 filp->f_pos += de_len;
@@ -255,8 +255,7 @@ static int isofs_readdir(struct file *filp,
255 int result; 255 int result;
256 char * tmpname; 256 char * tmpname;
257 struct iso_directory_record * tmpde; 257 struct iso_directory_record * tmpde;
258 struct inode *inode = filp->f_dentry->d_inode; 258 struct inode *inode = filp->f_path.dentry->d_inode;
259
260 259
261 tmpname = (char *)__get_free_page(GFP_KERNEL); 260 tmpname = (char *)__get_free_page(GFP_KERNEL);
262 if (tmpname == NULL) 261 if (tmpname == NULL)
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index d38e0d575e48..cceaf57e3778 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -55,7 +55,7 @@ get_transaction(journal_t *journal, transaction_t *transaction)
55 spin_lock_init(&transaction->t_handle_lock); 55 spin_lock_init(&transaction->t_handle_lock);
56 56
57 /* Set up the commit timer for the new transaction. */ 57 /* Set up the commit timer for the new transaction. */
58 journal->j_commit_timer.expires = transaction->t_expires; 58 journal->j_commit_timer.expires = round_jiffies(transaction->t_expires);
59 add_timer(&journal->j_commit_timer); 59 add_timer(&journal->j_commit_timer);
60 60
61 J_ASSERT(journal->j_running_transaction == NULL); 61 J_ASSERT(journal->j_running_transaction == NULL);
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index 9f15bce92022..7b40c69f44eb 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -566,7 +566,7 @@ static int
566jffs_readdir(struct file *filp, void *dirent, filldir_t filldir) 566jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
567{ 567{
568 struct jffs_file *f; 568 struct jffs_file *f;
569 struct dentry *dentry = filp->f_dentry; 569 struct dentry *dentry = filp->f_path.dentry;
570 struct inode *inode = dentry->d_inode; 570 struct inode *inode = dentry->d_inode;
571 struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info; 571 struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info;
572 int j; 572 int j;
@@ -1372,7 +1372,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
1372 struct jffs_control *c; 1372 struct jffs_control *c;
1373 struct jffs_file *f; 1373 struct jffs_file *f;
1374 struct jffs_node *node; 1374 struct jffs_node *node;
1375 struct dentry *dentry = filp->f_dentry; 1375 struct dentry *dentry = filp->f_path.dentry;
1376 struct inode *inode = dentry->d_inode; 1376 struct inode *inode = dentry->d_inode;
1377 int recoverable = 0; 1377 int recoverable = 0;
1378 size_t written = 0; 1378 size_t written = 0;
@@ -1380,7 +1380,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
1380 loff_t pos = *ppos; 1380 loff_t pos = *ppos;
1381 int err; 1381 int err;
1382 1382
1383 inode = filp->f_dentry->d_inode; 1383 inode = filp->f_path.dentry->d_inode;
1384 1384
1385 D2(printk("***jffs_file_write(): inode: 0x%p (ino: %lu), " 1385 D2(printk("***jffs_file_write(): inode: 0x%p (ino: %lu), "
1386 "filp: 0x%p, buf: 0x%p, count: %d\n", 1386 "filp: 0x%p, buf: 0x%p, count: %d\n",
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 9def6adf4a5d..da6034d50718 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -123,11 +123,11 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
123{ 123{
124 struct jffs2_inode_info *f; 124 struct jffs2_inode_info *f;
125 struct jffs2_sb_info *c; 125 struct jffs2_sb_info *c;
126 struct inode *inode = filp->f_dentry->d_inode; 126 struct inode *inode = filp->f_path.dentry->d_inode;
127 struct jffs2_full_dirent *fd; 127 struct jffs2_full_dirent *fd;
128 unsigned long offset, curofs; 128 unsigned long offset, curofs;
129 129
130 D1(printk(KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", filp->f_dentry->d_inode->i_ino)); 130 D1(printk(KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", filp->f_path.dentry->d_inode->i_ino));
131 131
132 f = JFFS2_INODE_INFO(inode); 132 f = JFFS2_INODE_INFO(inode);
133 c = JFFS2_SB_INFO(inode->i_sb); 133 c = JFFS2_SB_INFO(inode->i_sb);
@@ -141,7 +141,7 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
141 offset++; 141 offset++;
142 } 142 }
143 if (offset == 1) { 143 if (offset == 1) {
144 unsigned long pino = parent_ino(filp->f_dentry); 144 unsigned long pino = parent_ino(filp->f_path.dentry);
145 D1(printk(KERN_DEBUG "Dirent 1: \"..\", ino #%lu\n", pino)); 145 D1(printk(KERN_DEBUG "Dirent 1: \"..\", ino #%lu\n", pino));
146 if (filldir(dirent, "..", 2, 1, pino, DT_DIR) < 0) 146 if (filldir(dirent, "..", 2, 1, pino, DT_DIR) < 0)
147 goto out; 147 goto out;
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index ecb2216d881c..47bc0b5d1324 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -3009,7 +3009,7 @@ static inline struct jfs_dirent *next_jfs_dirent(struct jfs_dirent *dirent)
3009 */ 3009 */
3010int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 3010int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
3011{ 3011{
3012 struct inode *ip = filp->f_dentry->d_inode; 3012 struct inode *ip = filp->f_path.dentry->d_inode;
3013 struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab; 3013 struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab;
3014 int rc = 0; 3014 int rc = 0;
3015 loff_t dtpos; /* legacy OS/2 style position */ 3015 loff_t dtpos; /* legacy OS/2 style position */
diff --git a/fs/jfs/jfs_filsys.h b/fs/jfs/jfs_filsys.h
index eb550b339bb8..38f70ac03bec 100644
--- a/fs/jfs/jfs_filsys.h
+++ b/fs/jfs/jfs_filsys.h
@@ -29,31 +29,21 @@
29/* 29/*
30 * file system option (superblock flag) 30 * file system option (superblock flag)
31 */ 31 */
32/* mount time flag to disable journaling to disk */ 32
33#define JFS_NOINTEGRITY 0x00000010 33/* directory option */
34#define JFS_UNICODE 0x00000001 /* unicode name */
34 35
35/* mount time flags for error handling */ 36/* mount time flags for error handling */
36#define JFS_ERR_REMOUNT_RO 0x00000002 /* remount read-only */ 37#define JFS_ERR_REMOUNT_RO 0x00000002 /* remount read-only */
37#define JFS_ERR_CONTINUE 0x00000004 /* continue */ 38#define JFS_ERR_CONTINUE 0x00000004 /* continue */
38#define JFS_ERR_PANIC 0x00000008 /* panic */ 39#define JFS_ERR_PANIC 0x00000008 /* panic */
39 40
41/* Quota support */
40#define JFS_USRQUOTA 0x00000010 42#define JFS_USRQUOTA 0x00000010
41#define JFS_GRPQUOTA 0x00000020 43#define JFS_GRPQUOTA 0x00000020
42 44
43/* platform option (conditional compilation) */ 45/* mount time flag to disable journaling to disk */
44#define JFS_AIX 0x80000000 /* AIX support */ 46#define JFS_NOINTEGRITY 0x00000040
45/* POSIX name/directory support */
46
47#define JFS_OS2 0x40000000 /* OS/2 support */
48/* case-insensitive name/directory support */
49
50#define JFS_DFS 0x20000000 /* DCE DFS LFS support */
51
52#define JFS_LINUX 0x10000000 /* Linux support */
53/* case-sensitive name/directory support */
54
55/* directory option */
56#define JFS_UNICODE 0x00000001 /* unicode name */
57 47
58/* commit option */ 48/* commit option */
59#define JFS_COMMIT 0x00000f00 /* commit option mask */ 49#define JFS_COMMIT 0x00000f00 /* commit option mask */
@@ -61,6 +51,7 @@
61#define JFS_LAZYCOMMIT 0x00000200 /* lazy commit */ 51#define JFS_LAZYCOMMIT 0x00000200 /* lazy commit */
62#define JFS_TMPFS 0x00000400 /* temporary file system - 52#define JFS_TMPFS 0x00000400 /* temporary file system -
63 * do not log/commit: 53 * do not log/commit:
54 * Never implemented
64 */ 55 */
65 56
66/* log logical volume option */ 57/* log logical volume option */
@@ -74,16 +65,25 @@
74#define JFS_SPARSE 0x00020000 /* sparse regular file */ 65#define JFS_SPARSE 0x00020000 /* sparse regular file */
75 66
76/* DASD Limits F226941 */ 67/* DASD Limits F226941 */
77#define JFS_DASD_ENABLED 0x00040000 /* DASD limits enabled */ 68#define JFS_DASD_ENABLED 0x00040000 /* DASD limits enabled */
78#define JFS_DASD_PRIME 0x00080000 /* Prime DASD usage on boot */ 69#define JFS_DASD_PRIME 0x00080000 /* Prime DASD usage on boot */
79 70
80/* big endian flag */ 71/* big endian flag */
81#define JFS_SWAP_BYTES 0x00100000 /* running on big endian computer */ 72#define JFS_SWAP_BYTES 0x00100000 /* running on big endian computer */
82 73
83/* Directory index */ 74/* Directory index */
84#define JFS_DIR_INDEX 0x00200000 /* Persistent index for */ 75#define JFS_DIR_INDEX 0x00200000 /* Persistent index for */
85 /* directory entries */
86 76
77/* platform options */
78#define JFS_LINUX 0x10000000 /* Linux support */
79#define JFS_DFS 0x20000000 /* DCE DFS LFS support */
80/* Never implemented */
81
82#define JFS_OS2 0x40000000 /* OS/2 support */
83/* case-insensitive name/directory support */
84
85#define JFS_AIX 0x80000000 /* AIX support */
86/* POSIX name/directory support - Never implemented*/
87 87
88/* 88/*
89 * buffer cache configuration 89 * buffer cache configuration
diff --git a/fs/libfs.c b/fs/libfs.c
index bd08e0e64a8c..503898d5c4a7 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -63,7 +63,7 @@ int dcache_dir_open(struct inode *inode, struct file *file)
63{ 63{
64 static struct qstr cursor_name = {.len = 1, .name = "."}; 64 static struct qstr cursor_name = {.len = 1, .name = "."};
65 65
66 file->private_data = d_alloc(file->f_dentry, &cursor_name); 66 file->private_data = d_alloc(file->f_path.dentry, &cursor_name);
67 67
68 return file->private_data ? 0 : -ENOMEM; 68 return file->private_data ? 0 : -ENOMEM;
69} 69}
@@ -76,7 +76,7 @@ int dcache_dir_close(struct inode *inode, struct file *file)
76 76
77loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin) 77loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
78{ 78{
79 mutex_lock(&file->f_dentry->d_inode->i_mutex); 79 mutex_lock(&file->f_path.dentry->d_inode->i_mutex);
80 switch (origin) { 80 switch (origin) {
81 case 1: 81 case 1:
82 offset += file->f_pos; 82 offset += file->f_pos;
@@ -84,7 +84,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
84 if (offset >= 0) 84 if (offset >= 0)
85 break; 85 break;
86 default: 86 default:
87 mutex_unlock(&file->f_dentry->d_inode->i_mutex); 87 mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
88 return -EINVAL; 88 return -EINVAL;
89 } 89 }
90 if (offset != file->f_pos) { 90 if (offset != file->f_pos) {
@@ -96,8 +96,8 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
96 96
97 spin_lock(&dcache_lock); 97 spin_lock(&dcache_lock);
98 list_del(&cursor->d_u.d_child); 98 list_del(&cursor->d_u.d_child);
99 p = file->f_dentry->d_subdirs.next; 99 p = file->f_path.dentry->d_subdirs.next;
100 while (n && p != &file->f_dentry->d_subdirs) { 100 while (n && p != &file->f_path.dentry->d_subdirs) {
101 struct dentry *next; 101 struct dentry *next;
102 next = list_entry(p, struct dentry, d_u.d_child); 102 next = list_entry(p, struct dentry, d_u.d_child);
103 if (!d_unhashed(next) && next->d_inode) 103 if (!d_unhashed(next) && next->d_inode)
@@ -108,7 +108,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
108 spin_unlock(&dcache_lock); 108 spin_unlock(&dcache_lock);
109 } 109 }
110 } 110 }
111 mutex_unlock(&file->f_dentry->d_inode->i_mutex); 111 mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
112 return offset; 112 return offset;
113} 113}
114 114
@@ -126,7 +126,7 @@ static inline unsigned char dt_type(struct inode *inode)
126 126
127int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) 127int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
128{ 128{
129 struct dentry *dentry = filp->f_dentry; 129 struct dentry *dentry = filp->f_path.dentry;
130 struct dentry *cursor = filp->private_data; 130 struct dentry *cursor = filp->private_data;
131 struct list_head *p, *q = &cursor->d_u.d_child; 131 struct list_head *p, *q = &cursor->d_u.d_child;
132 ino_t ino; 132 ino_t ino;
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index b85a0ad2cfb6..92681c9e9b20 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -126,7 +126,7 @@ __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock
126 continue; 126 continue;
127 if (!nlm_cmp_addr(&block->b_host->h_addr, addr)) 127 if (!nlm_cmp_addr(&block->b_host->h_addr, addr))
128 continue; 128 continue;
129 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_dentry->d_inode) ,fh) != 0) 129 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
130 continue; 130 continue;
131 /* Alright, we found a lock. Set the return status 131 /* Alright, we found a lock. Set the return status
132 * and wake up the caller 132 * and wake up the caller
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 497c3cd59d52..80a1a6dccc8f 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -129,7 +129,7 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
129 129
130 nlmclnt_next_cookie(&argp->cookie); 130 nlmclnt_next_cookie(&argp->cookie);
131 argp->state = nsm_local_state; 131 argp->state = nsm_local_state;
132 memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry->d_inode), sizeof(struct nfs_fh)); 132 memcpy(&lock->fh, NFS_FH(fl->fl_file->f_path.dentry->d_inode), sizeof(struct nfs_fh));
133 lock->caller = utsname()->nodename; 133 lock->caller = utsname()->nodename;
134 lock->oh.data = req->a_owner; 134 lock->oh.data = req->a_owner;
135 lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", 135 lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s",
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 7e219b938552..5c054b20fd5e 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -343,8 +343,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
343 __be32 ret; 343 __be32 ret;
344 344
345 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", 345 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
346 file->f_file->f_dentry->d_inode->i_sb->s_id, 346 file->f_file->f_path.dentry->d_inode->i_sb->s_id,
347 file->f_file->f_dentry->d_inode->i_ino, 347 file->f_file->f_path.dentry->d_inode->i_ino,
348 lock->fl.fl_type, lock->fl.fl_pid, 348 lock->fl.fl_type, lock->fl.fl_pid,
349 (long long)lock->fl.fl_start, 349 (long long)lock->fl.fl_start,
350 (long long)lock->fl.fl_end, 350 (long long)lock->fl.fl_end,
@@ -420,8 +420,8 @@ nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
420 struct nlm_lock *conflock) 420 struct nlm_lock *conflock)
421{ 421{
422 dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n", 422 dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
423 file->f_file->f_dentry->d_inode->i_sb->s_id, 423 file->f_file->f_path.dentry->d_inode->i_sb->s_id,
424 file->f_file->f_dentry->d_inode->i_ino, 424 file->f_file->f_path.dentry->d_inode->i_ino,
425 lock->fl.fl_type, 425 lock->fl.fl_type,
426 (long long)lock->fl.fl_start, 426 (long long)lock->fl.fl_start,
427 (long long)lock->fl.fl_end); 427 (long long)lock->fl.fl_end);
@@ -454,8 +454,8 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
454 int error; 454 int error;
455 455
456 dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n", 456 dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",
457 file->f_file->f_dentry->d_inode->i_sb->s_id, 457 file->f_file->f_path.dentry->d_inode->i_sb->s_id,
458 file->f_file->f_dentry->d_inode->i_ino, 458 file->f_file->f_path.dentry->d_inode->i_ino,
459 lock->fl.fl_pid, 459 lock->fl.fl_pid,
460 (long long)lock->fl.fl_start, 460 (long long)lock->fl.fl_start,
461 (long long)lock->fl.fl_end); 461 (long long)lock->fl.fl_end);
@@ -483,8 +483,8 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
483 int status = 0; 483 int status = 0;
484 484
485 dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", 485 dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
486 file->f_file->f_dentry->d_inode->i_sb->s_id, 486 file->f_file->f_path.dentry->d_inode->i_sb->s_id,
487 file->f_file->f_dentry->d_inode->i_ino, 487 file->f_file->f_path.dentry->d_inode->i_ino,
488 lock->fl.fl_pid, 488 lock->fl.fl_pid,
489 (long long)lock->fl.fl_start, 489 (long long)lock->fl.fl_start,
490 (long long)lock->fl.fl_end); 490 (long long)lock->fl.fl_end);
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index e83024e16042..c0df00c74ce3 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -43,7 +43,7 @@ static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
43 43
44static inline void nlm_debug_print_file(char *msg, struct nlm_file *file) 44static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
45{ 45{
46 struct inode *inode = file->f_file->f_dentry->d_inode; 46 struct inode *inode = file->f_file->f_path.dentry->d_inode;
47 47
48 dprintk("lockd: %s %s/%ld\n", 48 dprintk("lockd: %s %s/%ld\n",
49 msg, inode->i_sb->s_id, inode->i_ino); 49 msg, inode->i_sb->s_id, inode->i_ino);
diff --git a/fs/locks.c b/fs/locks.c
index 1cb0c57fedbd..52a81005dab4 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -321,7 +321,7 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
321 start = filp->f_pos; 321 start = filp->f_pos;
322 break; 322 break;
323 case SEEK_END: 323 case SEEK_END:
324 start = i_size_read(filp->f_dentry->d_inode); 324 start = i_size_read(filp->f_path.dentry->d_inode);
325 break; 325 break;
326 default: 326 default:
327 return -EINVAL; 327 return -EINVAL;
@@ -371,7 +371,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
371 start = filp->f_pos; 371 start = filp->f_pos;
372 break; 372 break;
373 case SEEK_END: 373 case SEEK_END:
374 start = i_size_read(filp->f_dentry->d_inode); 374 start = i_size_read(filp->f_path.dentry->d_inode);
375 break; 375 break;
376 default: 376 default:
377 return -EINVAL; 377 return -EINVAL;
@@ -672,7 +672,7 @@ posix_test_lock(struct file *filp, struct file_lock *fl,
672 struct file_lock *cfl; 672 struct file_lock *cfl;
673 673
674 lock_kernel(); 674 lock_kernel();
675 for (cfl = filp->f_dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) { 675 for (cfl = filp->f_path.dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) {
676 if (!IS_POSIX(cfl)) 676 if (!IS_POSIX(cfl))
677 continue; 677 continue;
678 if (posix_locks_conflict(cfl, fl)) 678 if (posix_locks_conflict(cfl, fl))
@@ -734,7 +734,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
734{ 734{
735 struct file_lock *new_fl = NULL; 735 struct file_lock *new_fl = NULL;
736 struct file_lock **before; 736 struct file_lock **before;
737 struct inode * inode = filp->f_dentry->d_inode; 737 struct inode * inode = filp->f_path.dentry->d_inode;
738 int error = 0; 738 int error = 0;
739 int found = 0; 739 int found = 0;
740 740
@@ -1018,7 +1018,7 @@ static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request
1018 */ 1018 */
1019int posix_lock_file(struct file *filp, struct file_lock *fl) 1019int posix_lock_file(struct file *filp, struct file_lock *fl)
1020{ 1020{
1021 return __posix_lock_file_conf(filp->f_dentry->d_inode, fl, NULL); 1021 return __posix_lock_file_conf(filp->f_path.dentry->d_inode, fl, NULL);
1022} 1022}
1023EXPORT_SYMBOL(posix_lock_file); 1023EXPORT_SYMBOL(posix_lock_file);
1024 1024
@@ -1033,7 +1033,7 @@ EXPORT_SYMBOL(posix_lock_file);
1033int posix_lock_file_conf(struct file *filp, struct file_lock *fl, 1033int posix_lock_file_conf(struct file *filp, struct file_lock *fl,
1034 struct file_lock *conflock) 1034 struct file_lock *conflock)
1035{ 1035{
1036 return __posix_lock_file_conf(filp->f_dentry->d_inode, fl, conflock); 1036 return __posix_lock_file_conf(filp->f_path.dentry->d_inode, fl, conflock);
1037} 1037}
1038EXPORT_SYMBOL(posix_lock_file_conf); 1038EXPORT_SYMBOL(posix_lock_file_conf);
1039 1039
@@ -1333,8 +1333,8 @@ int fcntl_getlease(struct file *filp)
1333 int type = F_UNLCK; 1333 int type = F_UNLCK;
1334 1334
1335 lock_kernel(); 1335 lock_kernel();
1336 time_out_leases(filp->f_dentry->d_inode); 1336 time_out_leases(filp->f_path.dentry->d_inode);
1337 for (fl = filp->f_dentry->d_inode->i_flock; fl && IS_LEASE(fl); 1337 for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl);
1338 fl = fl->fl_next) { 1338 fl = fl->fl_next) {
1339 if (fl->fl_file == filp) { 1339 if (fl->fl_file == filp) {
1340 type = fl->fl_type & ~F_INPROGRESS; 1340 type = fl->fl_type & ~F_INPROGRESS;
@@ -1359,7 +1359,7 @@ int fcntl_getlease(struct file *filp)
1359static int __setlease(struct file *filp, long arg, struct file_lock **flp) 1359static int __setlease(struct file *filp, long arg, struct file_lock **flp)
1360{ 1360{
1361 struct file_lock *fl, **before, **my_before = NULL, *lease; 1361 struct file_lock *fl, **before, **my_before = NULL, *lease;
1362 struct dentry *dentry = filp->f_dentry; 1362 struct dentry *dentry = filp->f_path.dentry;
1363 struct inode *inode = dentry->d_inode; 1363 struct inode *inode = dentry->d_inode;
1364 int error, rdlease_count = 0, wrlease_count = 0; 1364 int error, rdlease_count = 0, wrlease_count = 0;
1365 1365
@@ -1448,7 +1448,7 @@ out:
1448 1448
1449int setlease(struct file *filp, long arg, struct file_lock **lease) 1449int setlease(struct file *filp, long arg, struct file_lock **lease)
1450{ 1450{
1451 struct dentry *dentry = filp->f_dentry; 1451 struct dentry *dentry = filp->f_path.dentry;
1452 struct inode *inode = dentry->d_inode; 1452 struct inode *inode = dentry->d_inode;
1453 int error; 1453 int error;
1454 1454
@@ -1482,7 +1482,7 @@ EXPORT_SYMBOL(setlease);
1482int fcntl_setlease(unsigned int fd, struct file *filp, long arg) 1482int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1483{ 1483{
1484 struct file_lock fl, *flp = &fl; 1484 struct file_lock fl, *flp = &fl;
1485 struct dentry *dentry = filp->f_dentry; 1485 struct dentry *dentry = filp->f_path.dentry;
1486 struct inode *inode = dentry->d_inode; 1486 struct inode *inode = dentry->d_inode;
1487 int error; 1487 int error;
1488 1488
@@ -1692,7 +1692,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
1692 if (copy_from_user(&flock, l, sizeof(flock))) 1692 if (copy_from_user(&flock, l, sizeof(flock)))
1693 goto out; 1693 goto out;
1694 1694
1695 inode = filp->f_dentry->d_inode; 1695 inode = filp->f_path.dentry->d_inode;
1696 1696
1697 /* Don't allow mandatory locks on files that may be memory mapped 1697 /* Don't allow mandatory locks on files that may be memory mapped
1698 * and shared. 1698 * and shared.
@@ -1835,7 +1835,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
1835 if (copy_from_user(&flock, l, sizeof(flock))) 1835 if (copy_from_user(&flock, l, sizeof(flock)))
1836 goto out; 1836 goto out;
1837 1837
1838 inode = filp->f_dentry->d_inode; 1838 inode = filp->f_path.dentry->d_inode;
1839 1839
1840 /* Don't allow mandatory locks on files that may be memory mapped 1840 /* Don't allow mandatory locks on files that may be memory mapped
1841 * and shared. 1841 * and shared.
@@ -1922,7 +1922,7 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
1922 * posix_lock_file(). Another process could be setting a lock on this 1922 * posix_lock_file(). Another process could be setting a lock on this
1923 * file at the same time, but we wouldn't remove that lock anyway. 1923 * file at the same time, but we wouldn't remove that lock anyway.
1924 */ 1924 */
1925 if (!filp->f_dentry->d_inode->i_flock) 1925 if (!filp->f_path.dentry->d_inode->i_flock)
1926 return; 1926 return;
1927 1927
1928 lock.fl_type = F_UNLCK; 1928 lock.fl_type = F_UNLCK;
@@ -1951,7 +1951,7 @@ EXPORT_SYMBOL(locks_remove_posix);
1951 */ 1951 */
1952void locks_remove_flock(struct file *filp) 1952void locks_remove_flock(struct file *filp)
1953{ 1953{
1954 struct inode * inode = filp->f_dentry->d_inode; 1954 struct inode * inode = filp->f_path.dentry->d_inode;
1955 struct file_lock *fl; 1955 struct file_lock *fl;
1956 struct file_lock **before; 1956 struct file_lock **before;
1957 1957
@@ -2020,7 +2020,7 @@ static void lock_get_status(char* out, struct file_lock *fl, int id, char *pfx)
2020 struct inode *inode = NULL; 2020 struct inode *inode = NULL;
2021 2021
2022 if (fl->fl_file != NULL) 2022 if (fl->fl_file != NULL)
2023 inode = fl->fl_file->f_dentry->d_inode; 2023 inode = fl->fl_file->f_path.dentry->d_inode;
2024 2024
2025 out += sprintf(out, "%d:%s ", id, pfx); 2025 out += sprintf(out, "%d:%s ", id, pfx);
2026 if (IS_POSIX(fl)) { 2026 if (IS_POSIX(fl)) {
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 2b0a389d1987..ab782c4086f5 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -82,7 +82,7 @@ static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi)
82static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir) 82static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
83{ 83{
84 unsigned long pos = filp->f_pos; 84 unsigned long pos = filp->f_pos;
85 struct inode *inode = filp->f_dentry->d_inode; 85 struct inode *inode = filp->f_path.dentry->d_inode;
86 struct super_block *sb = inode->i_sb; 86 struct super_block *sb = inode->i_sb;
87 unsigned offset = pos & ~PAGE_CACHE_MASK; 87 unsigned offset = pos & ~PAGE_CACHE_MASK;
88 unsigned long n = pos >> PAGE_CACHE_SHIFT; 88 unsigned long n = pos >> PAGE_CACHE_SHIFT;
diff --git a/fs/namei.c b/fs/namei.c
index db1bca26d88c..e4f108f08230 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -297,7 +297,7 @@ int vfs_permission(struct nameidata *nd, int mask)
297 */ 297 */
298int file_permission(struct file *file, int mask) 298int file_permission(struct file *file, int mask)
299{ 299{
300 return permission(file->f_dentry->d_inode, mask, NULL); 300 return permission(file->f_path.dentry->d_inode, mask, NULL);
301} 301}
302 302
303/* 303/*
@@ -333,7 +333,7 @@ int get_write_access(struct inode * inode)
333 333
334int deny_write_access(struct file * file) 334int deny_write_access(struct file * file)
335{ 335{
336 struct inode *inode = file->f_dentry->d_inode; 336 struct inode *inode = file->f_path.dentry->d_inode;
337 337
338 spin_lock(&inode->i_lock); 338 spin_lock(&inode->i_lock);
339 if (atomic_read(&inode->i_writecount) > 0) { 339 if (atomic_read(&inode->i_writecount) > 0) {
@@ -368,7 +368,7 @@ void path_release_on_umount(struct nameidata *nd)
368 */ 368 */
369void release_open_intent(struct nameidata *nd) 369void release_open_intent(struct nameidata *nd)
370{ 370{
371 if (nd->intent.open.file->f_dentry == NULL) 371 if (nd->intent.open.file->f_path.dentry == NULL)
372 put_filp(nd->intent.open.file); 372 put_filp(nd->intent.open.file);
373 else 373 else
374 fput(nd->intent.open.file); 374 fput(nd->intent.open.file);
@@ -572,11 +572,6 @@ fail:
572 return PTR_ERR(link); 572 return PTR_ERR(link);
573} 573}
574 574
575struct path {
576 struct vfsmount *mnt;
577 struct dentry *dentry;
578};
579
580static inline void dput_path(struct path *path, struct nameidata *nd) 575static inline void dput_path(struct path *path, struct nameidata *nd)
581{ 576{
582 dput(path->dentry); 577 dput(path->dentry);
@@ -1143,7 +1138,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,
1143 if (!file) 1138 if (!file)
1144 goto out_fail; 1139 goto out_fail;
1145 1140
1146 dentry = file->f_dentry; 1141 dentry = file->f_path.dentry;
1147 1142
1148 retval = -ENOTDIR; 1143 retval = -ENOTDIR;
1149 if (!S_ISDIR(dentry->d_inode->i_mode)) 1144 if (!S_ISDIR(dentry->d_inode->i_mode))
@@ -1153,7 +1148,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,
1153 if (retval) 1148 if (retval)
1154 goto fput_fail; 1149 goto fput_fail;
1155 1150
1156 nd->mnt = mntget(file->f_vfsmnt); 1151 nd->mnt = mntget(file->f_path.mnt);
1157 nd->dentry = dget(dentry); 1152 nd->dentry = dget(dentry);
1158 1153
1159 fput_light(file, fput_needed); 1154 fput_light(file, fput_needed);
diff --git a/fs/namespace.c b/fs/namespace.c
index b00ac84ebbdd..fde8553faa76 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -20,7 +20,7 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/sysfs.h> 21#include <linux/sysfs.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/namespace.h> 23#include <linux/mnt_namespace.h>
24#include <linux/namei.h> 24#include <linux/namei.h>
25#include <linux/security.h> 25#include <linux/security.h>
26#include <linux/mount.h> 26#include <linux/mount.h>
@@ -133,10 +133,10 @@ struct vfsmount *lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
133 133
134static inline int check_mnt(struct vfsmount *mnt) 134static inline int check_mnt(struct vfsmount *mnt)
135{ 135{
136 return mnt->mnt_namespace == current->nsproxy->namespace; 136 return mnt->mnt_ns == current->nsproxy->mnt_ns;
137} 137}
138 138
139static void touch_namespace(struct namespace *ns) 139static void touch_mnt_namespace(struct mnt_namespace *ns)
140{ 140{
141 if (ns) { 141 if (ns) {
142 ns->event = ++event; 142 ns->event = ++event;
@@ -144,7 +144,7 @@ static void touch_namespace(struct namespace *ns)
144 } 144 }
145} 145}
146 146
147static void __touch_namespace(struct namespace *ns) 147static void __touch_mnt_namespace(struct mnt_namespace *ns)
148{ 148{
149 if (ns && ns->event != event) { 149 if (ns && ns->event != event) {
150 ns->event = event; 150 ns->event = event;
@@ -187,19 +187,19 @@ static void commit_tree(struct vfsmount *mnt)
187 struct vfsmount *parent = mnt->mnt_parent; 187 struct vfsmount *parent = mnt->mnt_parent;
188 struct vfsmount *m; 188 struct vfsmount *m;
189 LIST_HEAD(head); 189 LIST_HEAD(head);
190 struct namespace *n = parent->mnt_namespace; 190 struct mnt_namespace *n = parent->mnt_ns;
191 191
192 BUG_ON(parent == mnt); 192 BUG_ON(parent == mnt);
193 193
194 list_add_tail(&head, &mnt->mnt_list); 194 list_add_tail(&head, &mnt->mnt_list);
195 list_for_each_entry(m, &head, mnt_list) 195 list_for_each_entry(m, &head, mnt_list)
196 m->mnt_namespace = n; 196 m->mnt_ns = n;
197 list_splice(&head, n->list.prev); 197 list_splice(&head, n->list.prev);
198 198
199 list_add_tail(&mnt->mnt_hash, mount_hashtable + 199 list_add_tail(&mnt->mnt_hash, mount_hashtable +
200 hash(parent, mnt->mnt_mountpoint)); 200 hash(parent, mnt->mnt_mountpoint));
201 list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); 201 list_add_tail(&mnt->mnt_child, &parent->mnt_mounts);
202 touch_namespace(n); 202 touch_mnt_namespace(n);
203} 203}
204 204
205static struct vfsmount *next_mnt(struct vfsmount *p, struct vfsmount *root) 205static struct vfsmount *next_mnt(struct vfsmount *p, struct vfsmount *root)
@@ -320,7 +320,7 @@ EXPORT_SYMBOL(mnt_unpin);
320/* iterator */ 320/* iterator */
321static void *m_start(struct seq_file *m, loff_t *pos) 321static void *m_start(struct seq_file *m, loff_t *pos)
322{ 322{
323 struct namespace *n = m->private; 323 struct mnt_namespace *n = m->private;
324 struct list_head *p; 324 struct list_head *p;
325 loff_t l = *pos; 325 loff_t l = *pos;
326 326
@@ -333,7 +333,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
333 333
334static void *m_next(struct seq_file *m, void *v, loff_t *pos) 334static void *m_next(struct seq_file *m, void *v, loff_t *pos)
335{ 335{
336 struct namespace *n = m->private; 336 struct mnt_namespace *n = m->private;
337 struct list_head *p = ((struct vfsmount *)v)->mnt_list.next; 337 struct list_head *p = ((struct vfsmount *)v)->mnt_list.next;
338 (*pos)++; 338 (*pos)++;
339 return p == &n->list ? NULL : list_entry(p, struct vfsmount, mnt_list); 339 return p == &n->list ? NULL : list_entry(p, struct vfsmount, mnt_list);
@@ -526,8 +526,8 @@ void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
526 list_for_each_entry(p, kill, mnt_hash) { 526 list_for_each_entry(p, kill, mnt_hash) {
527 list_del_init(&p->mnt_expire); 527 list_del_init(&p->mnt_expire);
528 list_del_init(&p->mnt_list); 528 list_del_init(&p->mnt_list);
529 __touch_namespace(p->mnt_namespace); 529 __touch_mnt_namespace(p->mnt_ns);
530 p->mnt_namespace = NULL; 530 p->mnt_ns = NULL;
531 list_del_init(&p->mnt_child); 531 list_del_init(&p->mnt_child);
532 if (p->mnt_parent != p) 532 if (p->mnt_parent != p)
533 p->mnt_mountpoint->d_mounted--; 533 p->mnt_mountpoint->d_mounted--;
@@ -830,7 +830,7 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
830 if (parent_nd) { 830 if (parent_nd) {
831 detach_mnt(source_mnt, parent_nd); 831 detach_mnt(source_mnt, parent_nd);
832 attach_mnt(source_mnt, nd); 832 attach_mnt(source_mnt, nd);
833 touch_namespace(current->nsproxy->namespace); 833 touch_mnt_namespace(current->nsproxy->mnt_ns);
834 } else { 834 } else {
835 mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt); 835 mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt);
836 commit_tree(source_mnt); 836 commit_tree(source_mnt);
@@ -1145,9 +1145,9 @@ static void expire_mount(struct vfsmount *mnt, struct list_head *mounts,
1145 */ 1145 */
1146 if (!propagate_mount_busy(mnt, 2)) { 1146 if (!propagate_mount_busy(mnt, 2)) {
1147 /* delete from the namespace */ 1147 /* delete from the namespace */
1148 touch_namespace(mnt->mnt_namespace); 1148 touch_mnt_namespace(mnt->mnt_ns);
1149 list_del_init(&mnt->mnt_list); 1149 list_del_init(&mnt->mnt_list);
1150 mnt->mnt_namespace = NULL; 1150 mnt->mnt_ns = NULL;
1151 umount_tree(mnt, 1, umounts); 1151 umount_tree(mnt, 1, umounts);
1152 spin_unlock(&vfsmount_lock); 1152 spin_unlock(&vfsmount_lock);
1153 } else { 1153 } else {
@@ -1168,7 +1168,7 @@ static void expire_mount(struct vfsmount *mnt, struct list_head *mounts,
1168 */ 1168 */
1169static void expire_mount_list(struct list_head *graveyard, struct list_head *mounts) 1169static void expire_mount_list(struct list_head *graveyard, struct list_head *mounts)
1170{ 1170{
1171 struct namespace *namespace; 1171 struct mnt_namespace *ns;
1172 struct vfsmount *mnt; 1172 struct vfsmount *mnt;
1173 1173
1174 while (!list_empty(graveyard)) { 1174 while (!list_empty(graveyard)) {
@@ -1178,10 +1178,10 @@ static void expire_mount_list(struct list_head *graveyard, struct list_head *mou
1178 1178
1179 /* don't do anything if the namespace is dead - all the 1179 /* don't do anything if the namespace is dead - all the
1180 * vfsmounts from it are going away anyway */ 1180 * vfsmounts from it are going away anyway */
1181 namespace = mnt->mnt_namespace; 1181 ns = mnt->mnt_ns;
1182 if (!namespace || !namespace->root) 1182 if (!ns || !ns->root)
1183 continue; 1183 continue;
1184 get_namespace(namespace); 1184 get_mnt_ns(ns);
1185 1185
1186 spin_unlock(&vfsmount_lock); 1186 spin_unlock(&vfsmount_lock);
1187 down_write(&namespace_sem); 1187 down_write(&namespace_sem);
@@ -1189,7 +1189,7 @@ static void expire_mount_list(struct list_head *graveyard, struct list_head *mou
1189 up_write(&namespace_sem); 1189 up_write(&namespace_sem);
1190 release_mounts(&umounts); 1190 release_mounts(&umounts);
1191 mntput(mnt); 1191 mntput(mnt);
1192 put_namespace(namespace); 1192 put_mnt_ns(ns);
1193 spin_lock(&vfsmount_lock); 1193 spin_lock(&vfsmount_lock);
1194 } 1194 }
1195} 1195}
@@ -1439,14 +1439,15 @@ dput_out:
1439 * Allocate a new namespace structure and populate it with contents 1439 * Allocate a new namespace structure and populate it with contents
1440 * copied from the namespace of the passed in task structure. 1440 * copied from the namespace of the passed in task structure.
1441 */ 1441 */
1442struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs) 1442struct mnt_namespace *dup_mnt_ns(struct task_struct *tsk,
1443 struct fs_struct *fs)
1443{ 1444{
1444 struct namespace *namespace = tsk->nsproxy->namespace; 1445 struct mnt_namespace *mnt_ns = tsk->nsproxy->mnt_ns;
1445 struct namespace *new_ns; 1446 struct mnt_namespace *new_ns;
1446 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; 1447 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL;
1447 struct vfsmount *p, *q; 1448 struct vfsmount *p, *q;
1448 1449
1449 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL); 1450 new_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL);
1450 if (!new_ns) 1451 if (!new_ns)
1451 return NULL; 1452 return NULL;
1452 1453
@@ -1457,7 +1458,7 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1457 1458
1458 down_write(&namespace_sem); 1459 down_write(&namespace_sem);
1459 /* First pass: copy the tree topology */ 1460 /* First pass: copy the tree topology */
1460 new_ns->root = copy_tree(namespace->root, namespace->root->mnt_root, 1461 new_ns->root = copy_tree(mnt_ns->root, mnt_ns->root->mnt_root,
1461 CL_COPY_ALL | CL_EXPIRE); 1462 CL_COPY_ALL | CL_EXPIRE);
1462 if (!new_ns->root) { 1463 if (!new_ns->root) {
1463 up_write(&namespace_sem); 1464 up_write(&namespace_sem);
@@ -1473,10 +1474,10 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1473 * as belonging to new namespace. We have already acquired a private 1474 * as belonging to new namespace. We have already acquired a private
1474 * fs_struct, so tsk->fs->lock is not needed. 1475 * fs_struct, so tsk->fs->lock is not needed.
1475 */ 1476 */
1476 p = namespace->root; 1477 p = mnt_ns->root;
1477 q = new_ns->root; 1478 q = new_ns->root;
1478 while (p) { 1479 while (p) {
1479 q->mnt_namespace = new_ns; 1480 q->mnt_ns = new_ns;
1480 if (fs) { 1481 if (fs) {
1481 if (p == fs->rootmnt) { 1482 if (p == fs->rootmnt) {
1482 rootmnt = p; 1483 rootmnt = p;
@@ -1491,7 +1492,7 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1491 fs->altrootmnt = mntget(q); 1492 fs->altrootmnt = mntget(q);
1492 } 1493 }
1493 } 1494 }
1494 p = next_mnt(p, namespace->root); 1495 p = next_mnt(p, mnt_ns->root);
1495 q = next_mnt(q, new_ns->root); 1496 q = next_mnt(q, new_ns->root);
1496 } 1497 }
1497 up_write(&namespace_sem); 1498 up_write(&namespace_sem);
@@ -1506,16 +1507,16 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
1506 return new_ns; 1507 return new_ns;
1507} 1508}
1508 1509
1509int copy_namespace(int flags, struct task_struct *tsk) 1510int copy_mnt_ns(int flags, struct task_struct *tsk)
1510{ 1511{
1511 struct namespace *namespace = tsk->nsproxy->namespace; 1512 struct mnt_namespace *ns = tsk->nsproxy->mnt_ns;
1512 struct namespace *new_ns; 1513 struct mnt_namespace *new_ns;
1513 int err = 0; 1514 int err = 0;
1514 1515
1515 if (!namespace) 1516 if (!ns)
1516 return 0; 1517 return 0;
1517 1518
1518 get_namespace(namespace); 1519 get_mnt_ns(ns);
1519 1520
1520 if (!(flags & CLONE_NEWNS)) 1521 if (!(flags & CLONE_NEWNS))
1521 return 0; 1522 return 0;
@@ -1525,16 +1526,16 @@ int copy_namespace(int flags, struct task_struct *tsk)
1525 goto out; 1526 goto out;
1526 } 1527 }
1527 1528
1528 new_ns = dup_namespace(tsk, tsk->fs); 1529 new_ns = dup_mnt_ns(tsk, tsk->fs);
1529 if (!new_ns) { 1530 if (!new_ns) {
1530 err = -ENOMEM; 1531 err = -ENOMEM;
1531 goto out; 1532 goto out;
1532 } 1533 }
1533 1534
1534 tsk->nsproxy->namespace = new_ns; 1535 tsk->nsproxy->mnt_ns = new_ns;
1535 1536
1536out: 1537out:
1537 put_namespace(namespace); 1538 put_mnt_ns(ns);
1538 return err; 1539 return err;
1539} 1540}
1540 1541
@@ -1754,7 +1755,7 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1754 detach_mnt(user_nd.mnt, &root_parent); 1755 detach_mnt(user_nd.mnt, &root_parent);
1755 attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ 1756 attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */
1756 attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ 1757 attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */
1757 touch_namespace(current->nsproxy->namespace); 1758 touch_mnt_namespace(current->nsproxy->mnt_ns);
1758 spin_unlock(&vfsmount_lock); 1759 spin_unlock(&vfsmount_lock);
1759 chroot_fs_refs(&user_nd, &new_nd); 1760 chroot_fs_refs(&user_nd, &new_nd);
1760 security_sb_post_pivotroot(&user_nd, &new_nd); 1761 security_sb_post_pivotroot(&user_nd, &new_nd);
@@ -1779,27 +1780,27 @@ out3:
1779static void __init init_mount_tree(void) 1780static void __init init_mount_tree(void)
1780{ 1781{
1781 struct vfsmount *mnt; 1782 struct vfsmount *mnt;
1782 struct namespace *namespace; 1783 struct mnt_namespace *ns;
1783 1784
1784 mnt = do_kern_mount("rootfs", 0, "rootfs", NULL); 1785 mnt = do_kern_mount("rootfs", 0, "rootfs", NULL);
1785 if (IS_ERR(mnt)) 1786 if (IS_ERR(mnt))
1786 panic("Can't create rootfs"); 1787 panic("Can't create rootfs");
1787 namespace = kmalloc(sizeof(*namespace), GFP_KERNEL); 1788 ns = kmalloc(sizeof(*ns), GFP_KERNEL);
1788 if (!namespace) 1789 if (!ns)
1789 panic("Can't allocate initial namespace"); 1790 panic("Can't allocate initial namespace");
1790 atomic_set(&namespace->count, 1); 1791 atomic_set(&ns->count, 1);
1791 INIT_LIST_HEAD(&namespace->list); 1792 INIT_LIST_HEAD(&ns->list);
1792 init_waitqueue_head(&namespace->poll); 1793 init_waitqueue_head(&ns->poll);
1793 namespace->event = 0; 1794 ns->event = 0;
1794 list_add(&mnt->mnt_list, &namespace->list); 1795 list_add(&mnt->mnt_list, &ns->list);
1795 namespace->root = mnt; 1796 ns->root = mnt;
1796 mnt->mnt_namespace = namespace; 1797 mnt->mnt_ns = ns;
1797 1798
1798 init_task.nsproxy->namespace = namespace; 1799 init_task.nsproxy->mnt_ns = ns;
1799 get_namespace(namespace); 1800 get_mnt_ns(ns);
1800 1801
1801 set_fs_pwd(current->fs, namespace->root, namespace->root->mnt_root); 1802 set_fs_pwd(current->fs, ns->root, ns->root->mnt_root);
1802 set_fs_root(current->fs, namespace->root, namespace->root->mnt_root); 1803 set_fs_root(current->fs, ns->root, ns->root->mnt_root);
1803} 1804}
1804 1805
1805void __init mnt_init(unsigned long mempages) 1806void __init mnt_init(unsigned long mempages)
@@ -1860,11 +1861,11 @@ void __init mnt_init(unsigned long mempages)
1860 init_mount_tree(); 1861 init_mount_tree();
1861} 1862}
1862 1863
1863void __put_namespace(struct namespace *namespace) 1864void __put_mnt_ns(struct mnt_namespace *ns)
1864{ 1865{
1865 struct vfsmount *root = namespace->root; 1866 struct vfsmount *root = ns->root;
1866 LIST_HEAD(umount_list); 1867 LIST_HEAD(umount_list);
1867 namespace->root = NULL; 1868 ns->root = NULL;
1868 spin_unlock(&vfsmount_lock); 1869 spin_unlock(&vfsmount_lock);
1869 down_write(&namespace_sem); 1870 down_write(&namespace_sem);
1870 spin_lock(&vfsmount_lock); 1871 spin_lock(&vfsmount_lock);
@@ -1872,5 +1873,5 @@ void __put_namespace(struct namespace *namespace)
1872 spin_unlock(&vfsmount_lock); 1873 spin_unlock(&vfsmount_lock);
1873 up_write(&namespace_sem); 1874 up_write(&namespace_sem);
1874 release_mounts(&umount_list); 1875 release_mounts(&umount_list);
1875 kfree(namespace); 1876 kfree(ns);
1876} 1877}
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 458b3b785194..73747772c3bb 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -402,7 +402,7 @@ static time_t ncp_obtain_mtime(struct dentry *dentry)
402 402
403static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir) 403static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
404{ 404{
405 struct dentry *dentry = filp->f_dentry; 405 struct dentry *dentry = filp->f_path.dentry;
406 struct inode *inode = dentry->d_inode; 406 struct inode *inode = dentry->d_inode;
407 struct page *page = NULL; 407 struct page *page = NULL;
408 struct ncp_server *server = NCP_SERVER(inode); 408 struct ncp_server *server = NCP_SERVER(inode);
@@ -554,7 +554,7 @@ static int
554ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir, 554ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
555 struct ncp_cache_control *ctrl, struct ncp_entry_info *entry) 555 struct ncp_cache_control *ctrl, struct ncp_entry_info *entry)
556{ 556{
557 struct dentry *newdent, *dentry = filp->f_dentry; 557 struct dentry *newdent, *dentry = filp->f_path.dentry;
558 struct inode *newino, *inode = dentry->d_inode; 558 struct inode *newino, *inode = dentry->d_inode;
559 struct ncp_cache_control ctl = *ctrl; 559 struct ncp_cache_control ctl = *ctrl;
560 struct qstr qname; 560 struct qstr qname;
@@ -649,7 +649,7 @@ static void
649ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir, 649ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
650 struct ncp_cache_control *ctl) 650 struct ncp_cache_control *ctl)
651{ 651{
652 struct dentry *dentry = filp->f_dentry; 652 struct dentry *dentry = filp->f_path.dentry;
653 struct inode *inode = dentry->d_inode; 653 struct inode *inode = dentry->d_inode;
654 struct ncp_server *server = NCP_SERVER(inode); 654 struct ncp_server *server = NCP_SERVER(inode);
655 struct ncp_volume_info info; 655 struct ncp_volume_info info;
@@ -685,7 +685,7 @@ static void
685ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir, 685ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
686 struct ncp_cache_control *ctl) 686 struct ncp_cache_control *ctl)
687{ 687{
688 struct dentry *dentry = filp->f_dentry; 688 struct dentry *dentry = filp->f_path.dentry;
689 struct inode *dir = dentry->d_inode; 689 struct inode *dir = dentry->d_inode;
690 struct ncp_server *server = NCP_SERVER(dir); 690 struct ncp_server *server = NCP_SERVER(dir);
691 struct nw_search_sequence seq; 691 struct nw_search_sequence seq;
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index df37524b85db..b91fea03b1c3 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -101,7 +101,7 @@ out:
101static ssize_t 101static ssize_t
102ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 102ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
103{ 103{
104 struct dentry *dentry = file->f_dentry; 104 struct dentry *dentry = file->f_path.dentry;
105 struct inode *inode = dentry->d_inode; 105 struct inode *inode = dentry->d_inode;
106 size_t already_read = 0; 106 size_t already_read = 0;
107 off_t pos; 107 off_t pos;
@@ -182,7 +182,7 @@ outrel:
182static ssize_t 182static ssize_t
183ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 183ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
184{ 184{
185 struct dentry *dentry = file->f_dentry; 185 struct dentry *dentry = file->f_path.dentry;
186 struct inode *inode = dentry->d_inode; 186 struct inode *inode = dentry->d_inode;
187 size_t already_written = 0; 187 size_t already_written = 0;
188 off_t pos; 188 off_t pos;
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index fae53243bb92..47462ac94474 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -471,7 +471,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
471 if (!ncp_filp) 471 if (!ncp_filp)
472 goto out; 472 goto out;
473 error = -ENOTSOCK; 473 error = -ENOTSOCK;
474 sock_inode = ncp_filp->f_dentry->d_inode; 474 sock_inode = ncp_filp->f_path.dentry->d_inode;
475 if (!S_ISSOCK(sock_inode->i_mode)) 475 if (!S_ISSOCK(sock_inode->i_mode))
476 goto out_fput; 476 goto out_fput;
477 sock = SOCKET_I(sock_inode); 477 sock = SOCKET_I(sock_inode);
@@ -504,7 +504,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
504 if (!server->info_filp) 504 if (!server->info_filp)
505 goto out_fput; 505 goto out_fput;
506 error = -ENOTSOCK; 506 error = -ENOTSOCK;
507 sock_inode = server->info_filp->f_dentry->d_inode; 507 sock_inode = server->info_filp->f_path.dentry->d_inode;
508 if (!S_ISSOCK(sock_inode->i_mode)) 508 if (!S_ISSOCK(sock_inode->i_mode))
509 goto out_fput2; 509 goto out_fput2;
510 info_sock = SOCKET_I(sock_inode); 510 info_sock = SOCKET_I(sock_inode);
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 589d1eac55c1..8843a83d4ef0 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -35,7 +35,7 @@ static int
35ncp_get_fs_info(struct ncp_server * server, struct file *file, 35ncp_get_fs_info(struct ncp_server * server, struct file *file,
36 struct ncp_fs_info __user *arg) 36 struct ncp_fs_info __user *arg)
37{ 37{
38 struct inode *inode = file->f_dentry->d_inode; 38 struct inode *inode = file->f_path.dentry->d_inode;
39 struct ncp_fs_info info; 39 struct ncp_fs_info info;
40 40
41 if ((file_permission(file, MAY_WRITE) != 0) 41 if ((file_permission(file, MAY_WRITE) != 0)
@@ -65,7 +65,7 @@ static int
65ncp_get_fs_info_v2(struct ncp_server * server, struct file *file, 65ncp_get_fs_info_v2(struct ncp_server * server, struct file *file,
66 struct ncp_fs_info_v2 __user * arg) 66 struct ncp_fs_info_v2 __user * arg)
67{ 67{
68 struct inode *inode = file->f_dentry->d_inode; 68 struct inode *inode = file->f_path.dentry->d_inode;
69 struct ncp_fs_info_v2 info2; 69 struct ncp_fs_info_v2 info2;
70 70
71 if ((file_permission(file, MAY_WRITE) != 0) 71 if ((file_permission(file, MAY_WRITE) != 0)
@@ -136,7 +136,7 @@ static int
136ncp_get_compat_fs_info_v2(struct ncp_server * server, struct file *file, 136ncp_get_compat_fs_info_v2(struct ncp_server * server, struct file *file,
137 struct compat_ncp_fs_info_v2 __user * arg) 137 struct compat_ncp_fs_info_v2 __user * arg)
138{ 138{
139 struct inode *inode = file->f_dentry->d_inode; 139 struct inode *inode = file->f_path.dentry->d_inode;
140 struct compat_ncp_fs_info_v2 info2; 140 struct compat_ncp_fs_info_v2 info2;
141 141
142 if ((file_permission(file, MAY_WRITE) != 0) 142 if ((file_permission(file, MAY_WRITE) != 0)
@@ -824,7 +824,7 @@ outrel:
824#ifdef CONFIG_COMPAT 824#ifdef CONFIG_COMPAT
825long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 825long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
826{ 826{
827 struct inode *inode = file->f_dentry->d_inode; 827 struct inode *inode = file->f_path.dentry->d_inode;
828 int ret; 828 int ret;
829 829
830 lock_kernel(); 830 lock_kernel();
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index e7d5a3097fe6..70a69115500f 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -29,7 +29,7 @@ static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area,
29 unsigned long address, int *type) 29 unsigned long address, int *type)
30{ 30{
31 struct file *file = area->vm_file; 31 struct file *file = area->vm_file;
32 struct dentry *dentry = file->f_dentry; 32 struct dentry *dentry = file->f_path.dentry;
33 struct inode *inode = dentry->d_inode; 33 struct inode *inode = dentry->d_inode;
34 struct page* page; 34 struct page* page;
35 char *pg_addr; 35 char *pg_addr;
@@ -106,7 +106,7 @@ static struct vm_operations_struct ncp_file_mmap =
106/* This is used for a general mmap of a ncp file */ 106/* This is used for a general mmap of a ncp file */
107int ncp_mmap(struct file *file, struct vm_area_struct *vma) 107int ncp_mmap(struct file *file, struct vm_area_struct *vma)
108{ 108{
109 struct inode *inode = file->f_dentry->d_inode; 109 struct inode *inode = file->f_path.dentry->d_inode;
110 110
111 DPRINTK("ncp_mmap: called\n"); 111 DPRINTK("ncp_mmap: called\n");
112 112
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index b34cd16f472f..dee3d6c0f194 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -172,7 +172,7 @@ static
172int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) 172int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
173{ 173{
174 struct file *file = desc->file; 174 struct file *file = desc->file;
175 struct inode *inode = file->f_dentry->d_inode; 175 struct inode *inode = file->f_path.dentry->d_inode;
176 struct rpc_cred *cred = nfs_file_cred(file); 176 struct rpc_cred *cred = nfs_file_cred(file);
177 unsigned long timestamp; 177 unsigned long timestamp;
178 int error; 178 int error;
@@ -183,7 +183,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
183 183
184 again: 184 again:
185 timestamp = jiffies; 185 timestamp = jiffies;
186 error = NFS_PROTO(inode)->readdir(file->f_dentry, cred, desc->entry->cookie, page, 186 error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, desc->entry->cookie, page,
187 NFS_SERVER(inode)->dtsize, desc->plus); 187 NFS_SERVER(inode)->dtsize, desc->plus);
188 if (error < 0) { 188 if (error < 0) {
189 /* We requested READDIRPLUS, but the server doesn't grok it */ 189 /* We requested READDIRPLUS, but the server doesn't grok it */
@@ -308,7 +308,7 @@ int find_dirent_index(nfs_readdir_descriptor_t *desc)
308static inline 308static inline
309int find_dirent_page(nfs_readdir_descriptor_t *desc) 309int find_dirent_page(nfs_readdir_descriptor_t *desc)
310{ 310{
311 struct inode *inode = desc->file->f_dentry->d_inode; 311 struct inode *inode = desc->file->f_path.dentry->d_inode;
312 struct page *page; 312 struct page *page;
313 int status; 313 int status;
314 314
@@ -464,7 +464,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
464 filldir_t filldir) 464 filldir_t filldir)
465{ 465{
466 struct file *file = desc->file; 466 struct file *file = desc->file;
467 struct inode *inode = file->f_dentry->d_inode; 467 struct inode *inode = file->f_path.dentry->d_inode;
468 struct rpc_cred *cred = nfs_file_cred(file); 468 struct rpc_cred *cred = nfs_file_cred(file);
469 struct page *page = NULL; 469 struct page *page = NULL;
470 int status; 470 int status;
@@ -477,7 +477,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
477 status = -ENOMEM; 477 status = -ENOMEM;
478 goto out; 478 goto out;
479 } 479 }
480 desc->error = NFS_PROTO(inode)->readdir(file->f_dentry, cred, *desc->dir_cookie, 480 desc->error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, *desc->dir_cookie,
481 page, 481 page,
482 NFS_SERVER(inode)->dtsize, 482 NFS_SERVER(inode)->dtsize,
483 desc->plus); 483 desc->plus);
@@ -516,7 +516,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
516 */ 516 */
517static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 517static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
518{ 518{
519 struct dentry *dentry = filp->f_dentry; 519 struct dentry *dentry = filp->f_path.dentry;
520 struct inode *inode = dentry->d_inode; 520 struct inode *inode = dentry->d_inode;
521 nfs_readdir_descriptor_t my_desc, 521 nfs_readdir_descriptor_t my_desc,
522 *desc = &my_desc; 522 *desc = &my_desc;
@@ -599,7 +599,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
599 599
600loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) 600loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
601{ 601{
602 mutex_lock(&filp->f_dentry->d_inode->i_mutex); 602 mutex_lock(&filp->f_path.dentry->d_inode->i_mutex);
603 switch (origin) { 603 switch (origin) {
604 case 1: 604 case 1:
605 offset += filp->f_pos; 605 offset += filp->f_pos;
@@ -615,7 +615,7 @@ loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
615 ((struct nfs_open_context *)filp->private_data)->dir_cookie = 0; 615 ((struct nfs_open_context *)filp->private_data)->dir_cookie = 0;
616 } 616 }
617out: 617out:
618 mutex_unlock(&filp->f_dentry->d_inode->i_mutex); 618 mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);
619 return offset; 619 return offset;
620} 620}
621 621
@@ -1102,7 +1102,7 @@ no_open:
1102 1102
1103static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc) 1103static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
1104{ 1104{
1105 struct dentry *parent = desc->file->f_dentry; 1105 struct dentry *parent = desc->file->f_path.dentry;
1106 struct inode *dir = parent->d_inode; 1106 struct inode *dir = parent->d_inode;
1107 struct nfs_entry *entry = desc->entry; 1107 struct nfs_entry *entry = desc->entry;
1108 struct dentry *dentry, *alias; 1108 struct dentry *dentry, *alias;
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index f9d678f4ae06..bd21d7fde650 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -116,7 +116,7 @@ static inline int put_dreq(struct nfs_direct_req *dreq)
116ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) 116ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs)
117{ 117{
118 dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n", 118 dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n",
119 iocb->ki_filp->f_dentry->d_name.name, 119 iocb->ki_filp->f_path.dentry->d_name.name,
120 (long long) pos, nr_segs); 120 (long long) pos, nr_segs);
121 121
122 return -EINVAL; 122 return -EINVAL;
@@ -734,8 +734,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
734 size_t count = iov[0].iov_len; 734 size_t count = iov[0].iov_len;
735 735
736 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", 736 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n",
737 file->f_dentry->d_parent->d_name.name, 737 file->f_path.dentry->d_parent->d_name.name,
738 file->f_dentry->d_name.name, 738 file->f_path.dentry->d_name.name,
739 (unsigned long) count, (long long) pos); 739 (unsigned long) count, (long long) pos);
740 740
741 if (nr_segs != 1) 741 if (nr_segs != 1)
@@ -798,8 +798,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
798 size_t count = iov[0].iov_len; 798 size_t count = iov[0].iov_len;
799 799
800 dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n", 800 dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n",
801 file->f_dentry->d_parent->d_name.name, 801 file->f_path.dentry->d_parent->d_name.name,
802 file->f_dentry->d_name.name, 802 file->f_path.dentry->d_name.name,
803 (unsigned long) count, (long long) pos); 803 (unsigned long) count, (long long) pos);
804 804
805 if (nr_segs != 1) 805 if (nr_segs != 1)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 8e28bffc35a0..0dd6be346aa7 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -176,7 +176,7 @@ static int
176nfs_file_flush(struct file *file, fl_owner_t id) 176nfs_file_flush(struct file *file, fl_owner_t id)
177{ 177{
178 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; 178 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
179 struct inode *inode = file->f_dentry->d_inode; 179 struct inode *inode = file->f_path.dentry->d_inode;
180 int status; 180 int status;
181 181
182 dfprintk(VFS, "nfs: flush(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino); 182 dfprintk(VFS, "nfs: flush(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino);
@@ -201,7 +201,7 @@ static ssize_t
201nfs_file_read(struct kiocb *iocb, const struct iovec *iov, 201nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
202 unsigned long nr_segs, loff_t pos) 202 unsigned long nr_segs, loff_t pos)
203{ 203{
204 struct dentry * dentry = iocb->ki_filp->f_dentry; 204 struct dentry * dentry = iocb->ki_filp->f_path.dentry;
205 struct inode * inode = dentry->d_inode; 205 struct inode * inode = dentry->d_inode;
206 ssize_t result; 206 ssize_t result;
207 size_t count = iov_length(iov, nr_segs); 207 size_t count = iov_length(iov, nr_segs);
@@ -226,7 +226,7 @@ static ssize_t
226nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count, 226nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count,
227 read_actor_t actor, void *target) 227 read_actor_t actor, void *target)
228{ 228{
229 struct dentry *dentry = filp->f_dentry; 229 struct dentry *dentry = filp->f_path.dentry;
230 struct inode *inode = dentry->d_inode; 230 struct inode *inode = dentry->d_inode;
231 ssize_t res; 231 ssize_t res;
232 232
@@ -243,7 +243,7 @@ nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count,
243static int 243static int
244nfs_file_mmap(struct file * file, struct vm_area_struct * vma) 244nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
245{ 245{
246 struct dentry *dentry = file->f_dentry; 246 struct dentry *dentry = file->f_path.dentry;
247 struct inode *inode = dentry->d_inode; 247 struct inode *inode = dentry->d_inode;
248 int status; 248 int status;
249 249
@@ -343,7 +343,7 @@ const struct address_space_operations nfs_file_aops = {
343static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov, 343static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
344 unsigned long nr_segs, loff_t pos) 344 unsigned long nr_segs, loff_t pos)
345{ 345{
346 struct dentry * dentry = iocb->ki_filp->f_dentry; 346 struct dentry * dentry = iocb->ki_filp->f_path.dentry;
347 struct inode * inode = dentry->d_inode; 347 struct inode * inode = dentry->d_inode;
348 ssize_t result; 348 ssize_t result;
349 size_t count = iov_length(iov, nr_segs); 349 size_t count = iov_length(iov, nr_segs);
@@ -535,8 +535,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
535static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl) 535static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
536{ 536{
537 dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n", 537 dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n",
538 filp->f_dentry->d_inode->i_sb->s_id, 538 filp->f_path.dentry->d_inode->i_sb->s_id,
539 filp->f_dentry->d_inode->i_ino, 539 filp->f_path.dentry->d_inode->i_ino,
540 fl->fl_type, fl->fl_flags); 540 fl->fl_type, fl->fl_flags);
541 541
542 /* 542 /*
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 20c6f39ea38a..8391bd7a83ce 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -31,7 +31,7 @@
31#include <linux/nfs_idmap.h> 31#include <linux/nfs_idmap.h>
32#include <linux/vfs.h> 32#include <linux/vfs.h>
33#include <linux/namei.h> 33#include <linux/namei.h>
34#include <linux/namespace.h> 34#include <linux/mnt_namespace.h>
35#include <linux/security.h> 35#include <linux/security.h>
36 36
37#include <asm/system.h> 37#include <asm/system.h>
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 82ad7110a1c0..9d4a6b2d1996 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -377,7 +377,7 @@ idmap_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
377static ssize_t 377static ssize_t
378idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) 378idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
379{ 379{
380 struct rpc_inode *rpci = RPC_I(filp->f_dentry->d_inode); 380 struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode);
381 struct idmap *idmap = (struct idmap *)rpci->private; 381 struct idmap *idmap = (struct idmap *)rpci->private;
382 struct idmap_msg im_in, *im = &idmap->idmap_im; 382 struct idmap_msg im_in, *im = &idmap->idmap_im;
383 struct idmap_hashtable *h; 383 struct idmap_hashtable *h;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 36680d1061b0..63e470279309 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -496,7 +496,7 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
496 */ 496 */
497static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) 497static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
498{ 498{
499 struct inode *inode = filp->f_dentry->d_inode; 499 struct inode *inode = filp->f_path.dentry->d_inode;
500 struct nfs_inode *nfsi = NFS_I(inode); 500 struct nfs_inode *nfsi = NFS_I(inode);
501 501
502 filp->private_data = get_nfs_open_context(ctx); 502 filp->private_data = get_nfs_open_context(ctx);
@@ -528,7 +528,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c
528 528
529static void nfs_file_clear_open_context(struct file *filp) 529static void nfs_file_clear_open_context(struct file *filp)
530{ 530{
531 struct inode *inode = filp->f_dentry->d_inode; 531 struct inode *inode = filp->f_path.dentry->d_inode;
532 struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data; 532 struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data;
533 533
534 if (ctx) { 534 if (ctx) {
@@ -551,7 +551,7 @@ int nfs_open(struct inode *inode, struct file *filp)
551 cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0); 551 cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
552 if (IS_ERR(cred)) 552 if (IS_ERR(cred))
553 return PTR_ERR(cred); 553 return PTR_ERR(cred);
554 ctx = alloc_nfs_open_context(filp->f_vfsmnt, filp->f_dentry, cred); 554 ctx = alloc_nfs_open_context(filp->f_path.mnt, filp->f_path.dentry, cred);
555 put_rpccred(cred); 555 put_rpccred(cred);
556 if (ctx == NULL) 556 if (ctx == NULL)
557 return -ENOMEM; 557 return -ENOMEM;
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 510ae524f3fd..acd8fe9762d3 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -841,7 +841,7 @@ static void nfs3_proc_commit_setup(struct nfs_write_data *data, int how)
841static int 841static int
842nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl) 842nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
843{ 843{
844 return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl); 844 return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
845} 845}
846 846
847const struct nfs_rpc_ops nfs_v3_clientops = { 847const struct nfs_rpc_ops nfs_v3_clientops = {
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 10f5e80ca157..560536ad74a4 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -651,7 +651,7 @@ nfs_proc_commit_setup(struct nfs_write_data *data, int how)
651static int 651static int
652nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) 652nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
653{ 653{
654 return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl); 654 return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
655} 655}
656 656
657 657
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 594eb16879ef..345492e78643 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -754,8 +754,8 @@ int nfs_updatepage(struct file *file, struct page *page,
754 nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE); 754 nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);
755 755
756 dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n", 756 dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n",
757 file->f_dentry->d_parent->d_name.name, 757 file->f_path.dentry->d_parent->d_name.name,
758 file->f_dentry->d_name.name, count, 758 file->f_path.dentry->d_name.name, count,
759 (long long)(page_offset(page) +offset)); 759 (long long)(page_offset(page) +offset));
760 760
761 /* If we're not using byte range locks, and we know the page 761 /* If we're not using byte range locks, and we know the page
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index e3eca0816986..edde5dc5f796 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -222,12 +222,10 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
222{ 222{
223 struct dentry *dentry = resp->fh.fh_dentry; 223 struct dentry *dentry = resp->fh.fh_dentry;
224 struct inode *inode = dentry->d_inode; 224 struct inode *inode = dentry->d_inode;
225 int w = nfsacl_size(
226 (resp->mask & NFS_ACL) ? resp->acl_access : NULL,
227 (resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
228 struct kvec *head = rqstp->rq_res.head; 225 struct kvec *head = rqstp->rq_res.head;
229 unsigned int base; 226 unsigned int base;
230 int n; 227 int n;
228 int w;
231 229
232 if (dentry == NULL || dentry->d_inode == NULL) 230 if (dentry == NULL || dentry->d_inode == NULL)
233 return 0; 231 return 0;
@@ -239,7 +237,9 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
239 return 0; 237 return 0;
240 base = (char *)p - (char *)head->iov_base; 238 base = (char *)p - (char *)head->iov_base;
241 239
242 rqstp->rq_res.page_len = w; 240 rqstp->rq_res.page_len = w = nfsacl_size(
241 (resp->mask & NFS_ACL) ? resp->acl_access : NULL,
242 (resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
243 while (w > 0) { 243 while (w > 0) {
244 if (!rqstp->rq_respages[rqstp->rq_resused++]) 244 if (!rqstp->rq_respages[rqstp->rq_resused++])
245 return 0; 245 return 0;
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index fcad2895ddb0..3e3f2de82c36 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -171,19 +171,19 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
171 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); 171 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
172 if (resp->status == 0 && dentry && dentry->d_inode) { 172 if (resp->status == 0 && dentry && dentry->d_inode) {
173 struct inode *inode = dentry->d_inode; 173 struct inode *inode = dentry->d_inode;
174 int w = nfsacl_size(
175 (resp->mask & NFS_ACL) ? resp->acl_access : NULL,
176 (resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
177 struct kvec *head = rqstp->rq_res.head; 174 struct kvec *head = rqstp->rq_res.head;
178 unsigned int base; 175 unsigned int base;
179 int n; 176 int n;
177 int w;
180 178
181 *p++ = htonl(resp->mask); 179 *p++ = htonl(resp->mask);
182 if (!xdr_ressize_check(rqstp, p)) 180 if (!xdr_ressize_check(rqstp, p))
183 return 0; 181 return 0;
184 base = (char *)p - (char *)head->iov_base; 182 base = (char *)p - (char *)head->iov_base;
185 183
186 rqstp->rq_res.page_len = w; 184 rqstp->rq_res.page_len = w = nfsacl_size(
185 (resp->mask & NFS_ACL) ? resp->acl_access : NULL,
186 (resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
187 while (w > 0) { 187 while (w > 0) {
188 if (!rqstp->rq_respages[rqstp->rq_resused++]) 188 if (!rqstp->rq_respages[rqstp->rq_resused++])
189 return 0; 189 return 0;
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 81b8565d3837..c7774e3a9469 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -259,7 +259,7 @@ nfsd4_remove_clid_file(struct dentry *dir, struct dentry *dentry)
259 printk("nfsd4: non-file found in client recovery directory\n"); 259 printk("nfsd4: non-file found in client recovery directory\n");
260 return -EINVAL; 260 return -EINVAL;
261 } 261 }
262 mutex_lock(&dir->d_inode->i_mutex); 262 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
263 status = vfs_unlink(dir->d_inode, dentry); 263 status = vfs_unlink(dir->d_inode, dentry);
264 mutex_unlock(&dir->d_inode->i_mutex); 264 mutex_unlock(&dir->d_inode->i_mutex);
265 return status; 265 return status;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 640c92b2a9f7..b7179bd45a1e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1310,7 +1310,7 @@ static inline void
1310nfs4_file_downgrade(struct file *filp, unsigned int share_access) 1310nfs4_file_downgrade(struct file *filp, unsigned int share_access)
1311{ 1311{
1312 if (share_access & NFS4_SHARE_ACCESS_WRITE) { 1312 if (share_access & NFS4_SHARE_ACCESS_WRITE) {
1313 put_write_access(filp->f_dentry->d_inode); 1313 put_write_access(filp->f_path.dentry->d_inode);
1314 filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE; 1314 filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE;
1315 } 1315 }
1316} 1316}
@@ -1623,7 +1623,7 @@ static __be32
1623nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open) 1623nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open)
1624{ 1624{
1625 struct file *filp = stp->st_vfs_file; 1625 struct file *filp = stp->st_vfs_file;
1626 struct inode *inode = filp->f_dentry->d_inode; 1626 struct inode *inode = filp->f_path.dentry->d_inode;
1627 unsigned int share_access, new_writer; 1627 unsigned int share_access, new_writer;
1628 __be32 status; 1628 __be32 status;
1629 1629
@@ -1965,7 +1965,7 @@ search_close_lru(u32 st_id, int flags)
1965static inline int 1965static inline int
1966nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp) 1966nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp)
1967{ 1967{
1968 return fhp->fh_dentry->d_inode != stp->st_vfs_file->f_dentry->d_inode; 1968 return fhp->fh_dentry->d_inode != stp->st_vfs_file->f_path.dentry->d_inode;
1969} 1969}
1970 1970
1971static int 1971static int
@@ -2862,7 +2862,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2862 * only the dentry:inode set. 2862 * only the dentry:inode set.
2863 */ 2863 */
2864 memset(&file, 0, sizeof (struct file)); 2864 memset(&file, 0, sizeof (struct file));
2865 file.f_dentry = current_fh->fh_dentry; 2865 file.f_path.dentry = current_fh->fh_dentry;
2866 2866
2867 status = nfs_ok; 2867 status = nfs_ok;
2868 if (posix_test_lock(&file, &file_lock, &conflock)) { 2868 if (posix_test_lock(&file, &file_lock, &conflock)) {
@@ -2952,7 +2952,7 @@ static int
2952check_for_locks(struct file *filp, struct nfs4_stateowner *lowner) 2952check_for_locks(struct file *filp, struct nfs4_stateowner *lowner)
2953{ 2953{
2954 struct file_lock **flpp; 2954 struct file_lock **flpp;
2955 struct inode *inode = filp->f_dentry->d_inode; 2955 struct inode *inode = filp->f_path.dentry->d_inode;
2956 int status = 0; 2956 int status = 0;
2957 2957
2958 lock_kernel(); 2958 lock_kernel();
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 6100bbe27432..f90d70475854 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -66,14 +66,13 @@ nfsd_cache_init(void)
66 printk (KERN_ERR "nfsd: cannot allocate all %d cache entries, only got %d\n", 66 printk (KERN_ERR "nfsd: cannot allocate all %d cache entries, only got %d\n",
67 CACHESIZE, CACHESIZE-i); 67 CACHESIZE, CACHESIZE-i);
68 68
69 hash_list = kmalloc (HASHSIZE * sizeof(struct hlist_head), GFP_KERNEL); 69 hash_list = kcalloc (HASHSIZE, sizeof(struct hlist_head), GFP_KERNEL);
70 if (!hash_list) { 70 if (!hash_list) {
71 nfsd_cache_shutdown(); 71 nfsd_cache_shutdown();
72 printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for hash list\n", 72 printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for hash list\n",
73 HASHSIZE * sizeof(struct hlist_head)); 73 HASHSIZE * sizeof(struct hlist_head));
74 return; 74 return;
75 } 75 }
76 memset(hash_list, 0, HASHSIZE * sizeof(struct hlist_head));
77 76
78 cache_disabled = 0; 77 cache_disabled = 0;
79} 78}
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 39aed901514b..eedf2e3990a9 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -111,7 +111,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = {
111 111
112static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) 112static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
113{ 113{
114 ino_t ino = file->f_dentry->d_inode->i_ino; 114 ino_t ino = file->f_path.dentry->d_inode->i_ino;
115 char *data; 115 char *data;
116 ssize_t rv; 116 ssize_t rv;
117 117
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index bb4d926e4487..4883d7586229 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -736,10 +736,10 @@ static int
736nfsd_sync(struct file *filp) 736nfsd_sync(struct file *filp)
737{ 737{
738 int err; 738 int err;
739 struct inode *inode = filp->f_dentry->d_inode; 739 struct inode *inode = filp->f_path.dentry->d_inode;
740 dprintk("nfsd: sync file %s\n", filp->f_dentry->d_name.name); 740 dprintk("nfsd: sync file %s\n", filp->f_path.dentry->d_name.name);
741 mutex_lock(&inode->i_mutex); 741 mutex_lock(&inode->i_mutex);
742 err=nfsd_dosync(filp, filp->f_dentry, filp->f_op); 742 err=nfsd_dosync(filp, filp->f_path.dentry, filp->f_op);
743 mutex_unlock(&inode->i_mutex); 743 mutex_unlock(&inode->i_mutex);
744 744
745 return err; 745 return err;
@@ -845,7 +845,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
845 int host_err; 845 int host_err;
846 846
847 err = nfserr_perm; 847 err = nfserr_perm;
848 inode = file->f_dentry->d_inode; 848 inode = file->f_path.dentry->d_inode;
849#ifdef MSNFS 849#ifdef MSNFS
850 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && 850 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
851 (!lock_may_read(inode, offset, *count))) 851 (!lock_may_read(inode, offset, *count)))
@@ -883,7 +883,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
883 nfsdstats.io_read += host_err; 883 nfsdstats.io_read += host_err;
884 *count = host_err; 884 *count = host_err;
885 err = 0; 885 err = 0;
886 fsnotify_access(file->f_dentry); 886 fsnotify_access(file->f_path.dentry);
887 } else 887 } else
888 err = nfserrno(host_err); 888 err = nfserrno(host_err);
889out: 889out:
@@ -917,11 +917,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
917 err = nfserr_perm; 917 err = nfserr_perm;
918 918
919 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && 919 if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
920 (!lock_may_write(file->f_dentry->d_inode, offset, cnt))) 920 (!lock_may_write(file->f_path.dentry->d_inode, offset, cnt)))
921 goto out; 921 goto out;
922#endif 922#endif
923 923
924 dentry = file->f_dentry; 924 dentry = file->f_path.dentry;
925 inode = dentry->d_inode; 925 inode = dentry->d_inode;
926 exp = fhp->fh_export; 926 exp = fhp->fh_export;
927 927
@@ -950,7 +950,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
950 set_fs(oldfs); 950 set_fs(oldfs);
951 if (host_err >= 0) { 951 if (host_err >= 0) {
952 nfsdstats.io_write += cnt; 952 nfsdstats.io_write += cnt;
953 fsnotify_modify(file->f_dentry); 953 fsnotify_modify(file->f_path.dentry);
954 } 954 }
955 955
956 /* clear setuid/setgid flag after write */ 956 /* clear setuid/setgid flag after write */
@@ -1885,28 +1885,27 @@ nfsd_racache_init(int cache_size)
1885 return 0; 1885 return 0;
1886 if (cache_size < 2*RAPARM_HASH_SIZE) 1886 if (cache_size < 2*RAPARM_HASH_SIZE)
1887 cache_size = 2*RAPARM_HASH_SIZE; 1887 cache_size = 2*RAPARM_HASH_SIZE;
1888 raparml = kmalloc(sizeof(struct raparms) * cache_size, GFP_KERNEL); 1888 raparml = kcalloc(cache_size, sizeof(struct raparms), GFP_KERNEL);
1889 1889
1890 if (raparml != NULL) { 1890 if (!raparml) {
1891 dprintk("nfsd: allocating %d readahead buffers.\n",
1892 cache_size);
1893 for (i = 0 ; i < RAPARM_HASH_SIZE ; i++) {
1894 raparm_hash[i].pb_head = NULL;
1895 spin_lock_init(&raparm_hash[i].pb_lock);
1896 }
1897 nperbucket = cache_size >> RAPARM_HASH_BITS;
1898 memset(raparml, 0, sizeof(struct raparms) * cache_size);
1899 for (i = 0; i < cache_size - 1; i++) {
1900 if (i % nperbucket == 0)
1901 raparm_hash[j++].pb_head = raparml + i;
1902 if (i % nperbucket < nperbucket-1)
1903 raparml[i].p_next = raparml + i + 1;
1904 }
1905 } else {
1906 printk(KERN_WARNING 1891 printk(KERN_WARNING
1907 "nfsd: Could not allocate memory read-ahead cache.\n"); 1892 "nfsd: Could not allocate memory read-ahead cache.\n");
1908 return -ENOMEM; 1893 return -ENOMEM;
1909 } 1894 }
1895
1896 dprintk("nfsd: allocating %d readahead buffers.\n", cache_size);
1897 for (i = 0 ; i < RAPARM_HASH_SIZE ; i++) {
1898 raparm_hash[i].pb_head = NULL;
1899 spin_lock_init(&raparm_hash[i].pb_lock);
1900 }
1901 nperbucket = cache_size >> RAPARM_HASH_BITS;
1902 for (i = 0; i < cache_size - 1; i++) {
1903 if (i % nperbucket == 0)
1904 raparm_hash[j++].pb_head = raparml + i;
1905 if (i % nperbucket < nperbucket-1)
1906 raparml[i].p_next = raparml + i + 1;
1907 }
1908
1910 nfsdstats.ra_size = cache_size; 1909 nfsdstats.ra_size = cache_size;
1911 return 0; 1910 return 0;
1912} 1911}
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c
index 85c36b8ca452..8296c29ae3b8 100644
--- a/fs/ntfs/dir.c
+++ b/fs/ntfs/dir.c
@@ -1101,7 +1101,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
1101{ 1101{
1102 s64 ia_pos, ia_start, prev_ia_pos, bmp_pos; 1102 s64 ia_pos, ia_start, prev_ia_pos, bmp_pos;
1103 loff_t fpos, i_size; 1103 loff_t fpos, i_size;
1104 struct inode *bmp_vi, *vdir = filp->f_dentry->d_inode; 1104 struct inode *bmp_vi, *vdir = filp->f_path.dentry->d_inode;
1105 struct super_block *sb = vdir->i_sb; 1105 struct super_block *sb = vdir->i_sb;
1106 ntfs_inode *ndir = NTFS_I(vdir); 1106 ntfs_inode *ndir = NTFS_I(vdir);
1107 ntfs_volume *vol = NTFS_SB(sb); 1107 ntfs_volume *vol = NTFS_SB(sb);
@@ -1136,9 +1136,9 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
1136 if (fpos == 1) { 1136 if (fpos == 1) {
1137 ntfs_debug("Calling filldir for .. with len 2, fpos 0x1, " 1137 ntfs_debug("Calling filldir for .. with len 2, fpos 0x1, "
1138 "inode 0x%lx, DT_DIR.", 1138 "inode 0x%lx, DT_DIR.",
1139 (unsigned long)parent_ino(filp->f_dentry)); 1139 (unsigned long)parent_ino(filp->f_path.dentry));
1140 rc = filldir(dirent, "..", 2, fpos, 1140 rc = filldir(dirent, "..", 2, fpos,
1141 parent_ino(filp->f_dentry), DT_DIR); 1141 parent_ino(filp->f_path.dentry), DT_DIR);
1142 if (rc) 1142 if (rc)
1143 goto done; 1143 goto done;
1144 fpos++; 1144 fpos++;
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index ae2fe0016d2c..076c9420c257 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -2162,7 +2162,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb,
2162 goto out; 2162 goto out;
2163 if (!count) 2163 if (!count)
2164 goto out; 2164 goto out;
2165 err = remove_suid(file->f_dentry); 2165 err = remove_suid(file->f_path.dentry);
2166 if (err) 2166 if (err)
2167 goto out; 2167 goto out;
2168 file_update_time(file); 2168 file_update_time(file);
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 2f7268e81520..ef6cd30108a9 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -595,7 +595,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
595 ssize_t bytes, 595 ssize_t bytes,
596 void *private) 596 void *private)
597{ 597{
598 struct inode *inode = iocb->ki_filp->f_dentry->d_inode; 598 struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
599 599
600 /* this io's submitter should not have unlocked this before we could */ 600 /* this io's submitter should not have unlocked this before we could */
601 BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); 601 BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));
@@ -611,7 +611,7 @@ static ssize_t ocfs2_direct_IO(int rw,
611 unsigned long nr_segs) 611 unsigned long nr_segs)
612{ 612{
613 struct file *file = iocb->ki_filp; 613 struct file *file = iocb->ki_filp;
614 struct inode *inode = file->f_dentry->d_inode->i_mapping->host; 614 struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
615 int ret; 615 int ret;
616 616
617 mlog_entry_void(); 617 mlog_entry_void();
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index baad2aa27c14..66821e178167 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -79,7 +79,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
79 struct buffer_head * bh, * tmp; 79 struct buffer_head * bh, * tmp;
80 struct ocfs2_dir_entry * de; 80 struct ocfs2_dir_entry * de;
81 int err; 81 int err;
82 struct inode *inode = filp->f_dentry->d_inode; 82 struct inode *inode = filp->f_path.dentry->d_inode;
83 struct super_block * sb = inode->i_sb; 83 struct super_block * sb = inode->i_sb;
84 unsigned int ra_sectors = 16; 84 unsigned int ra_sectors = 16;
85 int lock_level = 0; 85 int lock_level = 0;
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 941acf14e61f..b7f0ba97a1a2 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -176,7 +176,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
176 int bytes_left; 176 int bytes_left;
177 ssize_t readlen; 177 ssize_t readlen;
178 char *lvb_buf; 178 char *lvb_buf;
179 struct inode *inode = filp->f_dentry->d_inode; 179 struct inode *inode = filp->f_path.dentry->d_inode;
180 180
181 mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", 181 mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
182 inode->i_ino, count, *ppos); 182 inode->i_ino, count, *ppos);
@@ -220,7 +220,7 @@ static ssize_t dlmfs_file_write(struct file *filp,
220 int bytes_left; 220 int bytes_left;
221 ssize_t writelen; 221 ssize_t writelen;
222 char *lvb_buf; 222 char *lvb_buf;
223 struct inode *inode = filp->f_dentry->d_inode; 223 struct inode *inode = filp->f_path.dentry->d_inode;
224 224
225 mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", 225 mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
226 inode->i_ino, count, *ppos); 226 inode->i_ino, count, *ppos);
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 8786b3c490aa..e9a82ad95c1e 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -68,7 +68,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
68 struct ocfs2_inode_info *oi = OCFS2_I(inode); 68 struct ocfs2_inode_info *oi = OCFS2_I(inode);
69 69
70 mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, 70 mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
71 file->f_dentry->d_name.len, file->f_dentry->d_name.name); 71 file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
72 72
73 spin_lock(&oi->ip_lock); 73 spin_lock(&oi->ip_lock);
74 74
@@ -98,8 +98,8 @@ static int ocfs2_file_release(struct inode *inode, struct file *file)
98 struct ocfs2_inode_info *oi = OCFS2_I(inode); 98 struct ocfs2_inode_info *oi = OCFS2_I(inode);
99 99
100 mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, 100 mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
101 file->f_dentry->d_name.len, 101 file->f_path.dentry->d_name.len,
102 file->f_dentry->d_name.name); 102 file->f_path.dentry->d_name.name);
103 103
104 spin_lock(&oi->ip_lock); 104 spin_lock(&oi->ip_lock);
105 if (!--oi->ip_open_count) 105 if (!--oi->ip_open_count)
@@ -1131,13 +1131,13 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
1131{ 1131{
1132 int ret, rw_level, have_alloc_sem = 0; 1132 int ret, rw_level, have_alloc_sem = 0;
1133 struct file *filp = iocb->ki_filp; 1133 struct file *filp = iocb->ki_filp;
1134 struct inode *inode = filp->f_dentry->d_inode; 1134 struct inode *inode = filp->f_path.dentry->d_inode;
1135 int appending = filp->f_flags & O_APPEND ? 1 : 0; 1135 int appending = filp->f_flags & O_APPEND ? 1 : 0;
1136 1136
1137 mlog_entry("(0x%p, %u, '%.*s')\n", filp, 1137 mlog_entry("(0x%p, %u, '%.*s')\n", filp,
1138 (unsigned int)nr_segs, 1138 (unsigned int)nr_segs,
1139 filp->f_dentry->d_name.len, 1139 filp->f_path.dentry->d_name.len,
1140 filp->f_dentry->d_name.name); 1140 filp->f_path.dentry->d_name.name);
1141 1141
1142 /* happy write of zero bytes */ 1142 /* happy write of zero bytes */
1143 if (iocb->ki_left == 0) 1143 if (iocb->ki_left == 0)
@@ -1159,7 +1159,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
1159 goto out; 1159 goto out;
1160 } 1160 }
1161 1161
1162 ret = ocfs2_prepare_inode_for_write(filp->f_dentry, &iocb->ki_pos, 1162 ret = ocfs2_prepare_inode_for_write(filp->f_path.dentry, &iocb->ki_pos,
1163 iocb->ki_left, appending); 1163 iocb->ki_left, appending);
1164 if (ret < 0) { 1164 if (ret < 0) {
1165 mlog_errno(ret); 1165 mlog_errno(ret);
@@ -1207,12 +1207,12 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
1207 unsigned int flags) 1207 unsigned int flags)
1208{ 1208{
1209 int ret; 1209 int ret;
1210 struct inode *inode = out->f_dentry->d_inode; 1210 struct inode *inode = out->f_path.dentry->d_inode;
1211 1211
1212 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe, 1212 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe,
1213 (unsigned int)len, 1213 (unsigned int)len,
1214 out->f_dentry->d_name.len, 1214 out->f_path.dentry->d_name.len,
1215 out->f_dentry->d_name.name); 1215 out->f_path.dentry->d_name.name);
1216 1216
1217 inode_double_lock(inode, pipe->inode); 1217 inode_double_lock(inode, pipe->inode);
1218 1218
@@ -1222,7 +1222,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
1222 goto out; 1222 goto out;
1223 } 1223 }
1224 1224
1225 ret = ocfs2_prepare_inode_for_write(out->f_dentry, ppos, len, 0); 1225 ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, ppos, len, 0);
1226 if (ret < 0) { 1226 if (ret < 0) {
1227 mlog_errno(ret); 1227 mlog_errno(ret);
1228 goto out_unlock; 1228 goto out_unlock;
@@ -1247,12 +1247,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
1247 unsigned int flags) 1247 unsigned int flags)
1248{ 1248{
1249 int ret = 0; 1249 int ret = 0;
1250 struct inode *inode = in->f_dentry->d_inode; 1250 struct inode *inode = in->f_path.dentry->d_inode;
1251 1251
1252 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe, 1252 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe,
1253 (unsigned int)len, 1253 (unsigned int)len,
1254 in->f_dentry->d_name.len, 1254 in->f_path.dentry->d_name.len,
1255 in->f_dentry->d_name.name); 1255 in->f_path.dentry->d_name.name);
1256 1256
1257 /* 1257 /*
1258 * See the comment in ocfs2_file_aio_read() 1258 * See the comment in ocfs2_file_aio_read()
@@ -1278,12 +1278,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
1278{ 1278{
1279 int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0; 1279 int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
1280 struct file *filp = iocb->ki_filp; 1280 struct file *filp = iocb->ki_filp;
1281 struct inode *inode = filp->f_dentry->d_inode; 1281 struct inode *inode = filp->f_path.dentry->d_inode;
1282 1282
1283 mlog_entry("(0x%p, %u, '%.*s')\n", filp, 1283 mlog_entry("(0x%p, %u, '%.*s')\n", filp,
1284 (unsigned int)nr_segs, 1284 (unsigned int)nr_segs,
1285 filp->f_dentry->d_name.len, 1285 filp->f_path.dentry->d_name.len,
1286 filp->f_dentry->d_name.name); 1286 filp->f_path.dentry->d_name.name);
1287 1287
1288 if (!inode) { 1288 if (!inode) {
1289 ret = -EINVAL; 1289 ret = -EINVAL;
diff --git a/fs/open.c b/fs/open.c
index 89e0c237a636..c989fb4cf7b9 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -165,7 +165,7 @@ asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
165 file = fget(fd); 165 file = fget(fd);
166 if (!file) 166 if (!file)
167 goto out; 167 goto out;
168 error = vfs_statfs_native(file->f_dentry, &tmp); 168 error = vfs_statfs_native(file->f_path.dentry, &tmp);
169 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 169 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
170 error = -EFAULT; 170 error = -EFAULT;
171 fput(file); 171 fput(file);
@@ -186,7 +186,7 @@ asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user
186 file = fget(fd); 186 file = fget(fd);
187 if (!file) 187 if (!file)
188 goto out; 188 goto out;
189 error = vfs_statfs64(file->f_dentry, &tmp); 189 error = vfs_statfs64(file->f_path.dentry, &tmp);
190 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 190 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
191 error = -EFAULT; 191 error = -EFAULT;
192 fput(file); 192 fput(file);
@@ -302,7 +302,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
302 if (file->f_flags & O_LARGEFILE) 302 if (file->f_flags & O_LARGEFILE)
303 small = 0; 303 small = 0;
304 304
305 dentry = file->f_dentry; 305 dentry = file->f_path.dentry;
306 inode = dentry->d_inode; 306 inode = dentry->d_inode;
307 error = -EINVAL; 307 error = -EINVAL;
308 if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE)) 308 if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
@@ -448,8 +448,8 @@ asmlinkage long sys_fchdir(unsigned int fd)
448 if (!file) 448 if (!file)
449 goto out; 449 goto out;
450 450
451 dentry = file->f_dentry; 451 dentry = file->f_path.dentry;
452 mnt = file->f_vfsmnt; 452 mnt = file->f_path.mnt;
453 inode = dentry->d_inode; 453 inode = dentry->d_inode;
454 454
455 error = -ENOTDIR; 455 error = -ENOTDIR;
@@ -503,7 +503,7 @@ asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
503 if (!file) 503 if (!file)
504 goto out; 504 goto out;
505 505
506 dentry = file->f_dentry; 506 dentry = file->f_path.dentry;
507 inode = dentry->d_inode; 507 inode = dentry->d_inode;
508 508
509 audit_inode(NULL, inode); 509 audit_inode(NULL, inode);
@@ -662,7 +662,7 @@ asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
662 if (!file) 662 if (!file)
663 goto out; 663 goto out;
664 664
665 dentry = file->f_dentry; 665 dentry = file->f_path.dentry;
666 audit_inode(NULL, dentry->d_inode); 666 audit_inode(NULL, dentry->d_inode);
667 error = chown_common(dentry, user, group); 667 error = chown_common(dentry, user, group);
668 fput(file); 668 fput(file);
@@ -688,8 +688,8 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
688 } 688 }
689 689
690 f->f_mapping = inode->i_mapping; 690 f->f_mapping = inode->i_mapping;
691 f->f_dentry = dentry; 691 f->f_path.dentry = dentry;
692 f->f_vfsmnt = mnt; 692 f->f_path.mnt = mnt;
693 f->f_pos = 0; 693 f->f_pos = 0;
694 f->f_op = fops_get(inode->i_fop); 694 f->f_op = fops_get(inode->i_fop);
695 file_move(f, &inode->i_sb->s_files); 695 file_move(f, &inode->i_sb->s_files);
@@ -723,8 +723,8 @@ cleanup_all:
723 if (f->f_mode & FMODE_WRITE) 723 if (f->f_mode & FMODE_WRITE)
724 put_write_access(inode); 724 put_write_access(inode);
725 file_kill(f); 725 file_kill(f);
726 f->f_dentry = NULL; 726 f->f_path.dentry = NULL;
727 f->f_vfsmnt = NULL; 727 f->f_path.mnt = NULL;
728cleanup_file: 728cleanup_file:
729 put_filp(f); 729 put_filp(f);
730 dput(dentry); 730 dput(dentry);
@@ -822,7 +822,7 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
822 /* Pick up the filp from the open intent */ 822 /* Pick up the filp from the open intent */
823 filp = nd->intent.open.file; 823 filp = nd->intent.open.file;
824 /* Has the filesystem initialised the file for us? */ 824 /* Has the filesystem initialised the file for us? */
825 if (filp->f_dentry == NULL) 825 if (filp->f_path.dentry == NULL)
826 filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL); 826 filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL);
827 else 827 else
828 path_release(nd); 828 path_release(nd);
@@ -864,8 +864,7 @@ int get_unused_fd(void)
864 864
865repeat: 865repeat:
866 fdt = files_fdtable(files); 866 fdt = files_fdtable(files);
867 fd = find_next_zero_bit(fdt->open_fds->fds_bits, 867 fd = find_next_zero_bit(fdt->open_fds->fds_bits, fdt->max_fds,
868 fdt->max_fdset,
869 files->next_fd); 868 files->next_fd);
870 869
871 /* 870 /*
@@ -965,7 +964,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
965 put_unused_fd(fd); 964 put_unused_fd(fd);
966 fd = PTR_ERR(f); 965 fd = PTR_ERR(f);
967 } else { 966 } else {
968 fsnotify_open(f->f_dentry); 967 fsnotify_open(f->f_path.dentry);
969 fd_install(fd, f); 968 fd_install(fd, f);
970 } 969 }
971 } 970 }
@@ -1087,6 +1086,7 @@ EXPORT_SYMBOL(sys_close);
1087asmlinkage long sys_vhangup(void) 1086asmlinkage long sys_vhangup(void)
1088{ 1087{
1089 if (capable(CAP_SYS_TTY_CONFIG)) { 1088 if (capable(CAP_SYS_TTY_CONFIG)) {
1089 /* XXX: this needs locking */
1090 tty_vhangup(current->signal->tty); 1090 tty_vhangup(current->signal->tty);
1091 return 0; 1091 return 0;
1092 } 1092 }
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index 26f44e0074ec..99c0bc37ba09 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -262,7 +262,7 @@ found:
262 262
263static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filldir) 263static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
264{ 264{
265 struct inode *inode = filp->f_dentry->d_inode; 265 struct inode *inode = filp->f_path.dentry->d_inode;
266 struct op_inode_info *oi = OP_I(inode); 266 struct op_inode_info *oi = OP_I(inode);
267 struct device_node *dp = oi->u.node; 267 struct device_node *dp = oi->u.node;
268 struct device_node *child; 268 struct device_node *child;
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig
index e478f1941831..74552c60b671 100644
--- a/fs/partitions/Kconfig
+++ b/fs/partitions/Kconfig
@@ -194,7 +194,7 @@ config LDM_DEBUG
194 194
195config SGI_PARTITION 195config SGI_PARTITION
196 bool "SGI partition support" if PARTITION_ADVANCED 196 bool "SGI partition support" if PARTITION_ADVANCED
197 default y if (SGI_IP22 || SGI_IP27 || ((MACH_JAZZ || SNI_RM200_PCI) && !CPU_LITTLE_ENDIAN)) 197 default y if (SGI_IP22 || SGI_IP27 || ((MACH_JAZZ || SNI_RM) && !CPU_LITTLE_ENDIAN))
198 help 198 help
199 Say Y here if you would like to be able to read the hard disk 199 Say Y here if you would like to be able to read the hard disk
200 partition table format used by SGI machines. 200 partition table format used by SGI machines.
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 1901137f4eca..3d73d94d93a7 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -276,12 +276,39 @@ static struct part_attribute part_attr_stat = {
276 .show = part_stat_read 276 .show = part_stat_read
277}; 277};
278 278
279#ifdef CONFIG_FAIL_MAKE_REQUEST
280
281static ssize_t part_fail_store(struct hd_struct * p,
282 const char *buf, size_t count)
283{
284 int i;
285
286 if (count > 0 && sscanf(buf, "%d", &i) > 0)
287 p->make_it_fail = (i == 0) ? 0 : 1;
288
289 return count;
290}
291static ssize_t part_fail_read(struct hd_struct * p, char *page)
292{
293 return sprintf(page, "%d\n", p->make_it_fail);
294}
295static struct part_attribute part_attr_fail = {
296 .attr = {.name = "make-it-fail", .mode = S_IRUGO | S_IWUSR },
297 .store = part_fail_store,
298 .show = part_fail_read
299};
300
301#endif
302
279static struct attribute * default_attrs[] = { 303static struct attribute * default_attrs[] = {
280 &part_attr_uevent.attr, 304 &part_attr_uevent.attr,
281 &part_attr_dev.attr, 305 &part_attr_dev.attr,
282 &part_attr_start.attr, 306 &part_attr_start.attr,
283 &part_attr_size.attr, 307 &part_attr_size.attr,
284 &part_attr_stat.attr, 308 &part_attr_stat.attr,
309#ifdef CONFIG_FAIL_MAKE_REQUEST
310 &part_attr_fail.attr,
311#endif
285 NULL, 312 NULL,
286}; 313};
287 314
diff --git a/fs/pipe.c b/fs/pipe.c
index ae36b89b1a37..f8b6bdcb879a 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -222,7 +222,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
222 unsigned long nr_segs, loff_t pos) 222 unsigned long nr_segs, loff_t pos)
223{ 223{
224 struct file *filp = iocb->ki_filp; 224 struct file *filp = iocb->ki_filp;
225 struct inode *inode = filp->f_dentry->d_inode; 225 struct inode *inode = filp->f_path.dentry->d_inode;
226 struct pipe_inode_info *pipe; 226 struct pipe_inode_info *pipe;
227 int do_wakeup; 227 int do_wakeup;
228 ssize_t ret; 228 ssize_t ret;
@@ -335,7 +335,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
335 unsigned long nr_segs, loff_t ppos) 335 unsigned long nr_segs, loff_t ppos)
336{ 336{
337 struct file *filp = iocb->ki_filp; 337 struct file *filp = iocb->ki_filp;
338 struct inode *inode = filp->f_dentry->d_inode; 338 struct inode *inode = filp->f_path.dentry->d_inode;
339 struct pipe_inode_info *pipe; 339 struct pipe_inode_info *pipe;
340 ssize_t ret; 340 ssize_t ret;
341 int do_wakeup; 341 int do_wakeup;
@@ -520,7 +520,7 @@ static int
520pipe_ioctl(struct inode *pino, struct file *filp, 520pipe_ioctl(struct inode *pino, struct file *filp,
521 unsigned int cmd, unsigned long arg) 521 unsigned int cmd, unsigned long arg)
522{ 522{
523 struct inode *inode = filp->f_dentry->d_inode; 523 struct inode *inode = filp->f_path.dentry->d_inode;
524 struct pipe_inode_info *pipe; 524 struct pipe_inode_info *pipe;
525 int count, buf, nrbufs; 525 int count, buf, nrbufs;
526 526
@@ -548,7 +548,7 @@ static unsigned int
548pipe_poll(struct file *filp, poll_table *wait) 548pipe_poll(struct file *filp, poll_table *wait)
549{ 549{
550 unsigned int mask; 550 unsigned int mask;
551 struct inode *inode = filp->f_dentry->d_inode; 551 struct inode *inode = filp->f_path.dentry->d_inode;
552 struct pipe_inode_info *pipe = inode->i_pipe; 552 struct pipe_inode_info *pipe = inode->i_pipe;
553 int nrbufs; 553 int nrbufs;
554 554
@@ -601,7 +601,7 @@ pipe_release(struct inode *inode, int decr, int decw)
601static int 601static int
602pipe_read_fasync(int fd, struct file *filp, int on) 602pipe_read_fasync(int fd, struct file *filp, int on)
603{ 603{
604 struct inode *inode = filp->f_dentry->d_inode; 604 struct inode *inode = filp->f_path.dentry->d_inode;
605 int retval; 605 int retval;
606 606
607 mutex_lock(&inode->i_mutex); 607 mutex_lock(&inode->i_mutex);
@@ -618,7 +618,7 @@ pipe_read_fasync(int fd, struct file *filp, int on)
618static int 618static int
619pipe_write_fasync(int fd, struct file *filp, int on) 619pipe_write_fasync(int fd, struct file *filp, int on)
620{ 620{
621 struct inode *inode = filp->f_dentry->d_inode; 621 struct inode *inode = filp->f_path.dentry->d_inode;
622 int retval; 622 int retval;
623 623
624 mutex_lock(&inode->i_mutex); 624 mutex_lock(&inode->i_mutex);
@@ -635,7 +635,7 @@ pipe_write_fasync(int fd, struct file *filp, int on)
635static int 635static int
636pipe_rdwr_fasync(int fd, struct file *filp, int on) 636pipe_rdwr_fasync(int fd, struct file *filp, int on)
637{ 637{
638 struct inode *inode = filp->f_dentry->d_inode; 638 struct inode *inode = filp->f_path.dentry->d_inode;
639 struct pipe_inode_info *pipe = inode->i_pipe; 639 struct pipe_inode_info *pipe = inode->i_pipe;
640 int retval; 640 int retval;
641 641
@@ -914,8 +914,8 @@ struct file *create_write_pipe(void)
914 */ 914 */
915 dentry->d_flags &= ~DCACHE_UNHASHED; 915 dentry->d_flags &= ~DCACHE_UNHASHED;
916 d_instantiate(dentry, inode); 916 d_instantiate(dentry, inode);
917 f->f_vfsmnt = mntget(pipe_mnt); 917 f->f_path.mnt = mntget(pipe_mnt);
918 f->f_dentry = dentry; 918 f->f_path.dentry = dentry;
919 f->f_mapping = inode->i_mapping; 919 f->f_mapping = inode->i_mapping;
920 920
921 f->f_flags = O_WRONLY; 921 f->f_flags = O_WRONLY;
@@ -935,8 +935,8 @@ struct file *create_write_pipe(void)
935 935
936void free_write_pipe(struct file *f) 936void free_write_pipe(struct file *f)
937{ 937{
938 mntput(f->f_vfsmnt); 938 mntput(f->f_path.mnt);
939 dput(f->f_dentry); 939 dput(f->f_path.dentry);
940 put_filp(f); 940 put_filp(f);
941} 941}
942 942
@@ -947,9 +947,9 @@ struct file *create_read_pipe(struct file *wrf)
947 return ERR_PTR(-ENFILE); 947 return ERR_PTR(-ENFILE);
948 948
949 /* Grab pipe from the writer */ 949 /* Grab pipe from the writer */
950 f->f_vfsmnt = mntget(wrf->f_vfsmnt); 950 f->f_path.mnt = mntget(wrf->f_path.mnt);
951 f->f_dentry = dget(wrf->f_dentry); 951 f->f_path.dentry = dget(wrf->f_path.dentry);
952 f->f_mapping = wrf->f_dentry->d_inode->i_mapping; 952 f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping;
953 953
954 f->f_pos = 0; 954 f->f_pos = 0;
955 f->f_flags = O_RDONLY; 955 f->f_flags = O_RDONLY;
diff --git a/fs/pnode.c b/fs/pnode.c
index da42ee61c1df..56aacead8362 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -6,7 +6,7 @@
6 * Author : Ram Pai (linuxram@us.ibm.com) 6 * Author : Ram Pai (linuxram@us.ibm.com)
7 * 7 *
8 */ 8 */
9#include <linux/namespace.h> 9#include <linux/mnt_namespace.h>
10#include <linux/mount.h> 10#include <linux/mount.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include "pnode.h" 12#include "pnode.h"
diff --git a/fs/pnode.h b/fs/pnode.h
index 020e1bb60fdb..d45bd8ec36bf 100644
--- a/fs/pnode.h
+++ b/fs/pnode.h
@@ -13,7 +13,7 @@
13 13
14#define IS_MNT_SHARED(mnt) (mnt->mnt_flags & MNT_SHARED) 14#define IS_MNT_SHARED(mnt) (mnt->mnt_flags & MNT_SHARED)
15#define IS_MNT_SLAVE(mnt) (mnt->mnt_master) 15#define IS_MNT_SLAVE(mnt) (mnt->mnt_master)
16#define IS_MNT_NEW(mnt) (!mnt->mnt_namespace) 16#define IS_MNT_NEW(mnt) (!mnt->mnt_ns)
17#define CLEAR_MNT_SHARED(mnt) (mnt->mnt_flags &= ~MNT_SHARED) 17#define CLEAR_MNT_SHARED(mnt) (mnt->mnt_flags &= ~MNT_SHARED)
18#define IS_MNT_UNBINDABLE(mnt) (mnt->mnt_flags & MNT_UNBINDABLE) 18#define IS_MNT_UNBINDABLE(mnt) (mnt->mnt_flags & MNT_UNBINDABLE)
19 19
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 25e917fb4739..70e4fab117b1 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -346,20 +346,13 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
346 sigemptyset(&sigcatch); 346 sigemptyset(&sigcatch);
347 cutime = cstime = utime = stime = cputime_zero; 347 cutime = cstime = utime = stime = cputime_zero;
348 348
349 mutex_lock(&tty_mutex);
350 rcu_read_lock(); 349 rcu_read_lock();
351 if (lock_task_sighand(task, &flags)) { 350 if (lock_task_sighand(task, &flags)) {
352 struct signal_struct *sig = task->signal; 351 struct signal_struct *sig = task->signal;
353 struct tty_struct *tty = sig->tty; 352
354 353 if (sig->tty) {
355 if (tty) { 354 tty_pgrp = sig->tty->pgrp;
356 /* 355 tty_nr = new_encode_dev(tty_devnum(sig->tty));
357 * sig->tty is not stable, but tty_mutex
358 * protects us from release_dev(tty)
359 */
360 barrier();
361 tty_pgrp = tty->pgrp;
362 tty_nr = new_encode_dev(tty_devnum(tty));
363 } 356 }
364 357
365 num_threads = atomic_read(&sig->count); 358 num_threads = atomic_read(&sig->count);
@@ -388,14 +381,13 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
388 stime = cputime_add(stime, sig->stime); 381 stime = cputime_add(stime, sig->stime);
389 } 382 }
390 383
391 sid = sig->session; 384 sid = signal_session(sig);
392 pgid = process_group(task); 385 pgid = process_group(task);
393 ppid = rcu_dereference(task->real_parent)->tgid; 386 ppid = rcu_dereference(task->real_parent)->tgid;
394 387
395 unlock_task_sighand(task, &flags); 388 unlock_task_sighand(task, &flags);
396 } 389 }
397 rcu_read_unlock(); 390 rcu_read_unlock();
398 mutex_unlock(&tty_mutex);
399 391
400 if (!whole || num_threads<2) 392 if (!whole || num_threads<2)
401 wchan = get_wchan(task); 393 wchan = get_wchan(task);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index b859fc749c07..77a57b5799c4 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -59,7 +59,7 @@
59#include <linux/string.h> 59#include <linux/string.h>
60#include <linux/seq_file.h> 60#include <linux/seq_file.h>
61#include <linux/namei.h> 61#include <linux/namei.h>
62#include <linux/namespace.h> 62#include <linux/mnt_namespace.h>
63#include <linux/mm.h> 63#include <linux/mm.h>
64#include <linux/smp_lock.h> 64#include <linux/smp_lock.h>
65#include <linux/rcupdate.h> 65#include <linux/rcupdate.h>
@@ -365,33 +365,33 @@ struct proc_mounts {
365static int mounts_open(struct inode *inode, struct file *file) 365static int mounts_open(struct inode *inode, struct file *file)
366{ 366{
367 struct task_struct *task = get_proc_task(inode); 367 struct task_struct *task = get_proc_task(inode);
368 struct namespace *namespace = NULL; 368 struct mnt_namespace *ns = NULL;
369 struct proc_mounts *p; 369 struct proc_mounts *p;
370 int ret = -EINVAL; 370 int ret = -EINVAL;
371 371
372 if (task) { 372 if (task) {
373 task_lock(task); 373 task_lock(task);
374 namespace = task->nsproxy->namespace; 374 ns = task->nsproxy->mnt_ns;
375 if (namespace) 375 if (ns)
376 get_namespace(namespace); 376 get_mnt_ns(ns);
377 task_unlock(task); 377 task_unlock(task);
378 put_task_struct(task); 378 put_task_struct(task);
379 } 379 }
380 380
381 if (namespace) { 381 if (ns) {
382 ret = -ENOMEM; 382 ret = -ENOMEM;
383 p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL); 383 p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL);
384 if (p) { 384 if (p) {
385 file->private_data = &p->m; 385 file->private_data = &p->m;
386 ret = seq_open(file, &mounts_op); 386 ret = seq_open(file, &mounts_op);
387 if (!ret) { 387 if (!ret) {
388 p->m.private = namespace; 388 p->m.private = ns;
389 p->event = namespace->event; 389 p->event = ns->event;
390 return 0; 390 return 0;
391 } 391 }
392 kfree(p); 392 kfree(p);
393 } 393 }
394 put_namespace(namespace); 394 put_mnt_ns(ns);
395 } 395 }
396 return ret; 396 return ret;
397} 397}
@@ -399,15 +399,15 @@ static int mounts_open(struct inode *inode, struct file *file)
399static int mounts_release(struct inode *inode, struct file *file) 399static int mounts_release(struct inode *inode, struct file *file)
400{ 400{
401 struct seq_file *m = file->private_data; 401 struct seq_file *m = file->private_data;
402 struct namespace *namespace = m->private; 402 struct mnt_namespace *ns = m->private;
403 put_namespace(namespace); 403 put_mnt_ns(ns);
404 return seq_release(inode, file); 404 return seq_release(inode, file);
405} 405}
406 406
407static unsigned mounts_poll(struct file *file, poll_table *wait) 407static unsigned mounts_poll(struct file *file, poll_table *wait)
408{ 408{
409 struct proc_mounts *p = file->private_data; 409 struct proc_mounts *p = file->private_data;
410 struct namespace *ns = p->m.private; 410 struct mnt_namespace *ns = p->m.private;
411 unsigned res = 0; 411 unsigned res = 0;
412 412
413 poll_wait(file, &ns->poll, wait); 413 poll_wait(file, &ns->poll, wait);
@@ -437,21 +437,21 @@ static int mountstats_open(struct inode *inode, struct file *file)
437 437
438 if (!ret) { 438 if (!ret) {
439 struct seq_file *m = file->private_data; 439 struct seq_file *m = file->private_data;
440 struct namespace *namespace = NULL; 440 struct mnt_namespace *mnt_ns = NULL;
441 struct task_struct *task = get_proc_task(inode); 441 struct task_struct *task = get_proc_task(inode);
442 442
443 if (task) { 443 if (task) {
444 task_lock(task); 444 task_lock(task);
445 if (task->nsproxy) 445 if (task->nsproxy)
446 namespace = task->nsproxy->namespace; 446 mnt_ns = task->nsproxy->mnt_ns;
447 if (namespace) 447 if (mnt_ns)
448 get_namespace(namespace); 448 get_mnt_ns(mnt_ns);
449 task_unlock(task); 449 task_unlock(task);
450 put_task_struct(task); 450 put_task_struct(task);
451 } 451 }
452 452
453 if (namespace) 453 if (mnt_ns)
454 m->private = namespace; 454 m->private = mnt_ns;
455 else { 455 else {
456 seq_release(inode, file); 456 seq_release(inode, file);
457 ret = -EINVAL; 457 ret = -EINVAL;
@@ -472,7 +472,7 @@ static struct file_operations proc_mountstats_operations = {
472static ssize_t proc_info_read(struct file * file, char __user * buf, 472static ssize_t proc_info_read(struct file * file, char __user * buf,
473 size_t count, loff_t *ppos) 473 size_t count, loff_t *ppos)
474{ 474{
475 struct inode * inode = file->f_dentry->d_inode; 475 struct inode * inode = file->f_path.dentry->d_inode;
476 unsigned long page; 476 unsigned long page;
477 ssize_t length; 477 ssize_t length;
478 struct task_struct *task = get_proc_task(inode); 478 struct task_struct *task = get_proc_task(inode);
@@ -512,7 +512,7 @@ static int mem_open(struct inode* inode, struct file* file)
512static ssize_t mem_read(struct file * file, char __user * buf, 512static ssize_t mem_read(struct file * file, char __user * buf,
513 size_t count, loff_t *ppos) 513 size_t count, loff_t *ppos)
514{ 514{
515 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 515 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
516 char *page; 516 char *page;
517 unsigned long src = *ppos; 517 unsigned long src = *ppos;
518 int ret = -ESRCH; 518 int ret = -ESRCH;
@@ -584,7 +584,7 @@ static ssize_t mem_write(struct file * file, const char * buf,
584{ 584{
585 int copied; 585 int copied;
586 char *page; 586 char *page;
587 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 587 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
588 unsigned long dst = *ppos; 588 unsigned long dst = *ppos;
589 589
590 copied = -ESRCH; 590 copied = -ESRCH;
@@ -654,7 +654,7 @@ static struct file_operations proc_mem_operations = {
654static ssize_t oom_adjust_read(struct file *file, char __user *buf, 654static ssize_t oom_adjust_read(struct file *file, char __user *buf,
655 size_t count, loff_t *ppos) 655 size_t count, loff_t *ppos)
656{ 656{
657 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 657 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
658 char buffer[PROC_NUMBUF]; 658 char buffer[PROC_NUMBUF];
659 size_t len; 659 size_t len;
660 int oom_adjust; 660 int oom_adjust;
@@ -694,7 +694,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
694 return -EINVAL; 694 return -EINVAL;
695 if (*end == '\n') 695 if (*end == '\n')
696 end++; 696 end++;
697 task = get_proc_task(file->f_dentry->d_inode); 697 task = get_proc_task(file->f_path.dentry->d_inode);
698 if (!task) 698 if (!task)
699 return -ESRCH; 699 return -ESRCH;
700 if (oom_adjust < task->oomkilladj && !capable(CAP_SYS_RESOURCE)) { 700 if (oom_adjust < task->oomkilladj && !capable(CAP_SYS_RESOURCE)) {
@@ -718,7 +718,7 @@ static struct file_operations proc_oom_adjust_operations = {
718static ssize_t proc_loginuid_read(struct file * file, char __user * buf, 718static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
719 size_t count, loff_t *ppos) 719 size_t count, loff_t *ppos)
720{ 720{
721 struct inode * inode = file->f_dentry->d_inode; 721 struct inode * inode = file->f_path.dentry->d_inode;
722 struct task_struct *task = get_proc_task(inode); 722 struct task_struct *task = get_proc_task(inode);
723 ssize_t length; 723 ssize_t length;
724 char tmpbuf[TMPBUFLEN]; 724 char tmpbuf[TMPBUFLEN];
@@ -734,7 +734,7 @@ static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
734static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, 734static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
735 size_t count, loff_t *ppos) 735 size_t count, loff_t *ppos)
736{ 736{
737 struct inode * inode = file->f_dentry->d_inode; 737 struct inode * inode = file->f_path.dentry->d_inode;
738 char *page, *tmp; 738 char *page, *tmp;
739 ssize_t length; 739 ssize_t length;
740 uid_t loginuid; 740 uid_t loginuid;
@@ -853,6 +853,65 @@ static struct file_operations proc_seccomp_operations = {
853}; 853};
854#endif /* CONFIG_SECCOMP */ 854#endif /* CONFIG_SECCOMP */
855 855
856#ifdef CONFIG_FAULT_INJECTION
857static ssize_t proc_fault_inject_read(struct file * file, char __user * buf,
858 size_t count, loff_t *ppos)
859{
860 struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
861 char buffer[PROC_NUMBUF];
862 size_t len;
863 int make_it_fail;
864 loff_t __ppos = *ppos;
865
866 if (!task)
867 return -ESRCH;
868 make_it_fail = task->make_it_fail;
869 put_task_struct(task);
870
871 len = snprintf(buffer, sizeof(buffer), "%i\n", make_it_fail);
872 if (__ppos >= len)
873 return 0;
874 if (count > len-__ppos)
875 count = len-__ppos;
876 if (copy_to_user(buf, buffer + __ppos, count))
877 return -EFAULT;
878 *ppos = __ppos + count;
879 return count;
880}
881
882static ssize_t proc_fault_inject_write(struct file * file,
883 const char __user * buf, size_t count, loff_t *ppos)
884{
885 struct task_struct *task;
886 char buffer[PROC_NUMBUF], *end;
887 int make_it_fail;
888
889 if (!capable(CAP_SYS_RESOURCE))
890 return -EPERM;
891 memset(buffer, 0, sizeof(buffer));
892 if (count > sizeof(buffer) - 1)
893 count = sizeof(buffer) - 1;
894 if (copy_from_user(buffer, buf, count))
895 return -EFAULT;
896 make_it_fail = simple_strtol(buffer, &end, 0);
897 if (*end == '\n')
898 end++;
899 task = get_proc_task(file->f_dentry->d_inode);
900 if (!task)
901 return -ESRCH;
902 task->make_it_fail = make_it_fail;
903 put_task_struct(task);
904 if (end - buffer == 0)
905 return -EIO;
906 return end - buffer;
907}
908
909static struct file_operations proc_fault_inject_operations = {
910 .read = proc_fault_inject_read,
911 .write = proc_fault_inject_write,
912};
913#endif
914
856static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) 915static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
857{ 916{
858 struct inode *inode = dentry->d_inode; 917 struct inode *inode = dentry->d_inode;
@@ -1078,7 +1137,7 @@ static int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
1078 char *name, int len, 1137 char *name, int len,
1079 instantiate_t instantiate, struct task_struct *task, void *ptr) 1138 instantiate_t instantiate, struct task_struct *task, void *ptr)
1080{ 1139{
1081 struct dentry *child, *dir = filp->f_dentry; 1140 struct dentry *child, *dir = filp->f_path.dentry;
1082 struct inode *inode; 1141 struct inode *inode;
1083 struct qstr qname; 1142 struct qstr qname;
1084 ino_t ino = 0; 1143 ino_t ino = 0;
@@ -1157,8 +1216,8 @@ static int proc_fd_link(struct inode *inode, struct dentry **dentry, struct vfsm
1157 spin_lock(&files->file_lock); 1216 spin_lock(&files->file_lock);
1158 file = fcheck_files(files, fd); 1217 file = fcheck_files(files, fd);
1159 if (file) { 1218 if (file) {
1160 *mnt = mntget(file->f_vfsmnt); 1219 *mnt = mntget(file->f_path.mnt);
1161 *dentry = dget(file->f_dentry); 1220 *dentry = dget(file->f_path.dentry);
1162 spin_unlock(&files->file_lock); 1221 spin_unlock(&files->file_lock);
1163 put_files_struct(files); 1222 put_files_struct(files);
1164 return 0; 1223 return 0;
@@ -1293,7 +1352,7 @@ static int proc_fd_fill_cache(struct file *filp, void *dirent, filldir_t filldir
1293 1352
1294static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir) 1353static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir)
1295{ 1354{
1296 struct dentry *dentry = filp->f_dentry; 1355 struct dentry *dentry = filp->f_path.dentry;
1297 struct inode *inode = dentry->d_inode; 1356 struct inode *inode = dentry->d_inode;
1298 struct task_struct *p = get_proc_task(inode); 1357 struct task_struct *p = get_proc_task(inode);
1299 unsigned int fd, tid, ino; 1358 unsigned int fd, tid, ino;
@@ -1440,7 +1499,7 @@ static int proc_pident_readdir(struct file *filp,
1440{ 1499{
1441 int i; 1500 int i;
1442 int pid; 1501 int pid;
1443 struct dentry *dentry = filp->f_dentry; 1502 struct dentry *dentry = filp->f_path.dentry;
1444 struct inode *inode = dentry->d_inode; 1503 struct inode *inode = dentry->d_inode;
1445 struct task_struct *task = get_proc_task(inode); 1504 struct task_struct *task = get_proc_task(inode);
1446 struct pid_entry *p, *last; 1505 struct pid_entry *p, *last;
@@ -1496,7 +1555,7 @@ out_no_task:
1496static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, 1555static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
1497 size_t count, loff_t *ppos) 1556 size_t count, loff_t *ppos)
1498{ 1557{
1499 struct inode * inode = file->f_dentry->d_inode; 1558 struct inode * inode = file->f_path.dentry->d_inode;
1500 unsigned long page; 1559 unsigned long page;
1501 ssize_t length; 1560 ssize_t length;
1502 struct task_struct *task = get_proc_task(inode); 1561 struct task_struct *task = get_proc_task(inode);
@@ -1512,7 +1571,7 @@ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
1512 goto out; 1571 goto out;
1513 1572
1514 length = security_getprocattr(task, 1573 length = security_getprocattr(task,
1515 (char*)file->f_dentry->d_name.name, 1574 (char*)file->f_path.dentry->d_name.name,
1516 (void*)page, count); 1575 (void*)page, count);
1517 if (length >= 0) 1576 if (length >= 0)
1518 length = simple_read_from_buffer(buf, count, ppos, (char *)page, length); 1577 length = simple_read_from_buffer(buf, count, ppos, (char *)page, length);
@@ -1526,7 +1585,7 @@ out_no_task:
1526static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, 1585static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
1527 size_t count, loff_t *ppos) 1586 size_t count, loff_t *ppos)
1528{ 1587{
1529 struct inode * inode = file->f_dentry->d_inode; 1588 struct inode * inode = file->f_path.dentry->d_inode;
1530 char *page; 1589 char *page;
1531 ssize_t length; 1590 ssize_t length;
1532 struct task_struct *task = get_proc_task(inode); 1591 struct task_struct *task = get_proc_task(inode);
@@ -1552,7 +1611,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
1552 goto out_free; 1611 goto out_free;
1553 1612
1554 length = security_setprocattr(task, 1613 length = security_setprocattr(task,
1555 (char*)file->f_dentry->d_name.name, 1614 (char*)file->f_path.dentry->d_name.name,
1556 (void*)page, count); 1615 (void*)page, count);
1557out_free: 1616out_free:
1558 free_page((unsigned long) page); 1617 free_page((unsigned long) page);
@@ -1745,6 +1804,27 @@ static int proc_base_fill_cache(struct file *filp, void *dirent, filldir_t filld
1745 proc_base_instantiate, task, p); 1804 proc_base_instantiate, task, p);
1746} 1805}
1747 1806
1807#ifdef CONFIG_TASK_IO_ACCOUNTING
1808static int proc_pid_io_accounting(struct task_struct *task, char *buffer)
1809{
1810 return sprintf(buffer,
1811 "rchar: %llu\n"
1812 "wchar: %llu\n"
1813 "syscr: %llu\n"
1814 "syscw: %llu\n"
1815 "read_bytes: %llu\n"
1816 "write_bytes: %llu\n"
1817 "cancelled_write_bytes: %llu\n",
1818 (unsigned long long)task->rchar,
1819 (unsigned long long)task->wchar,
1820 (unsigned long long)task->syscr,
1821 (unsigned long long)task->syscw,
1822 (unsigned long long)task->ioac.read_bytes,
1823 (unsigned long long)task->ioac.write_bytes,
1824 (unsigned long long)task->ioac.cancelled_write_bytes);
1825}
1826#endif
1827
1748/* 1828/*
1749 * Thread groups 1829 * Thread groups
1750 */ 1830 */
@@ -1793,6 +1873,12 @@ static struct pid_entry tgid_base_stuff[] = {
1793#ifdef CONFIG_AUDITSYSCALL 1873#ifdef CONFIG_AUDITSYSCALL
1794 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 1874 REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
1795#endif 1875#endif
1876#ifdef CONFIG_FAULT_INJECTION
1877 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
1878#endif
1879#ifdef CONFIG_TASK_IO_ACCOUNTING
1880 INF("io", S_IRUGO, pid_io_accounting),
1881#endif
1796}; 1882};
1797 1883
1798static int proc_tgid_base_readdir(struct file * filp, 1884static int proc_tgid_base_readdir(struct file * filp,
@@ -1994,7 +2080,7 @@ static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldi
1994int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) 2080int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
1995{ 2081{
1996 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY; 2082 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
1997 struct task_struct *reaper = get_proc_task(filp->f_dentry->d_inode); 2083 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
1998 struct task_struct *task; 2084 struct task_struct *task;
1999 int tgid; 2085 int tgid;
2000 2086
@@ -2068,6 +2154,9 @@ static struct pid_entry tid_base_stuff[] = {
2068#ifdef CONFIG_AUDITSYSCALL 2154#ifdef CONFIG_AUDITSYSCALL
2069 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 2155 REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
2070#endif 2156#endif
2157#ifdef CONFIG_FAULT_INJECTION
2158 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
2159#endif
2071}; 2160};
2072 2161
2073static int proc_tid_base_readdir(struct file * filp, 2162static int proc_tid_base_readdir(struct file * filp,
@@ -2235,7 +2324,7 @@ static int proc_task_fill_cache(struct file *filp, void *dirent, filldir_t filld
2235/* for the /proc/TGID/task/ directories */ 2324/* for the /proc/TGID/task/ directories */
2236static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldir) 2325static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldir)
2237{ 2326{
2238 struct dentry *dentry = filp->f_dentry; 2327 struct dentry *dentry = filp->f_path.dentry;
2239 struct inode *inode = dentry->d_inode; 2328 struct inode *inode = dentry->d_inode;
2240 struct task_struct *leader = get_proc_task(inode); 2329 struct task_struct *leader = get_proc_task(inode);
2241 struct task_struct *task; 2330 struct task_struct *task;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 4ba03009cf72..853cb877d5f3 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -52,7 +52,7 @@ static ssize_t
52proc_file_read(struct file *file, char __user *buf, size_t nbytes, 52proc_file_read(struct file *file, char __user *buf, size_t nbytes,
53 loff_t *ppos) 53 loff_t *ppos)
54{ 54{
55 struct inode * inode = file->f_dentry->d_inode; 55 struct inode * inode = file->f_path.dentry->d_inode;
56 char *page; 56 char *page;
57 ssize_t retval=0; 57 ssize_t retval=0;
58 int eof=0; 58 int eof=0;
@@ -203,7 +203,7 @@ static ssize_t
203proc_file_write(struct file *file, const char __user *buffer, 203proc_file_write(struct file *file, const char __user *buffer,
204 size_t count, loff_t *ppos) 204 size_t count, loff_t *ppos)
205{ 205{
206 struct inode *inode = file->f_dentry->d_inode; 206 struct inode *inode = file->f_path.dentry->d_inode;
207 struct proc_dir_entry * dp; 207 struct proc_dir_entry * dp;
208 208
209 dp = PDE(inode); 209 dp = PDE(inode);
@@ -432,7 +432,7 @@ int proc_readdir(struct file * filp,
432 struct proc_dir_entry * de; 432 struct proc_dir_entry * de;
433 unsigned int ino; 433 unsigned int ino;
434 int i; 434 int i;
435 struct inode *inode = filp->f_dentry->d_inode; 435 struct inode *inode = filp->f_path.dentry->d_inode;
436 int ret = 0; 436 int ret = 0;
437 437
438 lock_kernel(); 438 lock_kernel();
@@ -453,7 +453,7 @@ int proc_readdir(struct file * filp,
453 /* fall through */ 453 /* fall through */
454 case 1: 454 case 1:
455 if (filldir(dirent, "..", 2, i, 455 if (filldir(dirent, "..", 2, i,
456 parent_ino(filp->f_dentry), 456 parent_ino(filp->f_path.dentry),
457 DT_DIR) < 0) 457 DT_DIR) < 0)
458 goto out; 458 goto out;
459 i++; 459 i++;
@@ -558,7 +558,7 @@ static void proc_kill_inodes(struct proc_dir_entry *de)
558 file_list_lock(); 558 file_list_lock();
559 list_for_each(p, &sb->s_files) { 559 list_for_each(p, &sb->s_files) {
560 struct file * filp = list_entry(p, struct file, f_u.fu_list); 560 struct file * filp = list_entry(p, struct file, f_u.fu_list);
561 struct dentry * dentry = filp->f_dentry; 561 struct dentry * dentry = filp->f_path.dentry;
562 struct inode * inode; 562 struct inode * inode;
563 const struct file_operations *fops; 563 const struct file_operations *fops;
564 564
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index d7dbdf9e0f49..5ec67257e5f9 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -46,7 +46,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
46 file = vma->vm_file; 46 file = vma->vm_file;
47 47
48 if (file) { 48 if (file) {
49 struct inode *inode = vma->vm_file->f_dentry->d_inode; 49 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
50 dev = inode->i_sb->s_dev; 50 dev = inode->i_sb->s_dev;
51 ino = inode->i_ino; 51 ino = inode->i_ino;
52 } 52 }
@@ -67,7 +67,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
67 if (len < 1) 67 if (len < 1)
68 len = 1; 68 len = 1;
69 seq_printf(m, "%*c", len, ' '); 69 seq_printf(m, "%*c", len, ' ');
70 seq_path(m, file->f_vfsmnt, file->f_dentry, ""); 70 seq_path(m, file->f_path.mnt, file->f_path.dentry, "");
71 } 71 }
72 72
73 seq_putc(m, '\n'); 73 seq_putc(m, '\n');
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 51815cece6f3..92ea7743fe8f 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -39,13 +39,15 @@
39#include <linux/seq_file.h> 39#include <linux/seq_file.h>
40#include <linux/times.h> 40#include <linux/times.h>
41#include <linux/profile.h> 41#include <linux/profile.h>
42#include <linux/utsname.h>
42#include <linux/blkdev.h> 43#include <linux/blkdev.h>
43#include <linux/hugetlb.h> 44#include <linux/hugetlb.h>
44#include <linux/jiffies.h> 45#include <linux/jiffies.h>
45#include <linux/sysrq.h> 46#include <linux/sysrq.h>
46#include <linux/vmalloc.h> 47#include <linux/vmalloc.h>
47#include <linux/crash_dump.h> 48#include <linux/crash_dump.h>
48#include <linux/pspace.h> 49#include <linux/pid_namespace.h>
50#include <linux/compile.h>
49#include <asm/uaccess.h> 51#include <asm/uaccess.h>
50#include <asm/pgtable.h> 52#include <asm/pgtable.h>
51#include <asm/io.h> 53#include <asm/io.h>
@@ -92,7 +94,7 @@ static int loadavg_read_proc(char *page, char **start, off_t off,
92 LOAD_INT(a), LOAD_FRAC(a), 94 LOAD_INT(a), LOAD_FRAC(a),
93 LOAD_INT(b), LOAD_FRAC(b), 95 LOAD_INT(b), LOAD_FRAC(b),
94 LOAD_INT(c), LOAD_FRAC(c), 96 LOAD_INT(c), LOAD_FRAC(c),
95 nr_running(), nr_threads, init_pspace.last_pid); 97 nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid);
96 return proc_calc_metrics(page, start, off, count, eof, len); 98 return proc_calc_metrics(page, start, off, count, eof, len);
97} 99}
98 100
@@ -252,8 +254,15 @@ static int version_read_proc(char *page, char **start, off_t off,
252{ 254{
253 int len; 255 int len;
254 256
255 strcpy(page, linux_banner); 257 /* FIXED STRING! Don't touch! */
256 len = strlen(page); 258 len = snprintf(page, PAGE_SIZE,
259 "%s version %s"
260 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
261 " (" LINUX_COMPILER ")"
262 " %s\n",
263 utsname()->sysname,
264 utsname()->release,
265 utsname()->version);
257 return proc_calc_metrics(page, start, off, count, eof, len); 266 return proc_calc_metrics(page, start, off, count, eof, len);
258} 267}
259 268
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 6b769afac55a..55ade0d15621 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -94,8 +94,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
94 } 94 }
95 95
96 if (vma) { 96 if (vma) {
97 *mnt = mntget(vma->vm_file->f_vfsmnt); 97 *mnt = mntget(vma->vm_file->f_path.mnt);
98 *dentry = dget(vma->vm_file->f_dentry); 98 *dentry = dget(vma->vm_file->f_path.dentry);
99 result = 0; 99 result = 0;
100 } 100 }
101 101
@@ -135,7 +135,7 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats
135 int len; 135 int len;
136 136
137 if (file) { 137 if (file) {
138 struct inode *inode = vma->vm_file->f_dentry->d_inode; 138 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
139 dev = inode->i_sb->s_dev; 139 dev = inode->i_sb->s_dev;
140 ino = inode->i_ino; 140 ino = inode->i_ino;
141 } 141 }
@@ -156,7 +156,7 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats
156 */ 156 */
157 if (file) { 157 if (file) {
158 pad_len_spaces(m, len); 158 pad_len_spaces(m, len);
159 seq_path(m, file->f_vfsmnt, file->f_dentry, "\n"); 159 seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n");
160 } else { 160 } else {
161 const char *name = arch_vma_name(vma); 161 const char *name = arch_vma_name(vma);
162 if (!name) { 162 if (!name) {
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 091aa8e48e02..fcc5caf93f55 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -126,8 +126,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
126 } 126 }
127 127
128 if (vma) { 128 if (vma) {
129 *mnt = mntget(vma->vm_file->f_vfsmnt); 129 *mnt = mntget(vma->vm_file->f_path.mnt);
130 *dentry = dget(vma->vm_file->f_dentry); 130 *dentry = dget(vma->vm_file->f_path.dentry);
131 result = 0; 131 result = 0;
132 } 132 }
133 133
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
index 0d7103fa0df5..c94db1db7a71 100644
--- a/fs/qnx4/dir.c
+++ b/fs/qnx4/dir.c
@@ -22,7 +22,7 @@
22 22
23static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir) 23static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir)
24{ 24{
25 struct inode *inode = filp->f_dentry->d_inode; 25 struct inode *inode = filp->f_path.dentry->d_inode;
26 unsigned int offset; 26 unsigned int offset;
27 struct buffer_head *bh; 27 struct buffer_head *bh;
28 struct qnx4_inode_entry *de; 28 struct qnx4_inode_entry *de;
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index bfe5dbf1002e..61cbe1ef06b9 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -232,7 +232,7 @@ unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
232 unsigned long pgoff, unsigned long flags) 232 unsigned long pgoff, unsigned long flags)
233{ 233{
234 unsigned long maxpages, lpages, nr, loop, ret; 234 unsigned long maxpages, lpages, nr, loop, ret;
235 struct inode *inode = file->f_dentry->d_inode; 235 struct inode *inode = file->f_path.dentry->d_inode;
236 struct page **pages = NULL, **ptr, *page; 236 struct page **pages = NULL, **ptr, *page;
237 loff_t isize; 237 loff_t isize;
238 238
diff --git a/fs/read_write.c b/fs/read_write.c
index f792000a28e6..1d3dda4fa70c 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -64,13 +64,13 @@ loff_t remote_llseek(struct file *file, loff_t offset, int origin)
64 lock_kernel(); 64 lock_kernel();
65 switch (origin) { 65 switch (origin) {
66 case 2: 66 case 2:
67 offset += i_size_read(file->f_dentry->d_inode); 67 offset += i_size_read(file->f_path.dentry->d_inode);
68 break; 68 break;
69 case 1: 69 case 1:
70 offset += file->f_pos; 70 offset += file->f_pos;
71 } 71 }
72 retval = -EINVAL; 72 retval = -EINVAL;
73 if (offset>=0 && offset<=file->f_dentry->d_inode->i_sb->s_maxbytes) { 73 if (offset>=0 && offset<=file->f_path.dentry->d_inode->i_sb->s_maxbytes) {
74 if (offset != file->f_pos) { 74 if (offset != file->f_pos) {
75 file->f_pos = offset; 75 file->f_pos = offset;
76 file->f_version = 0; 76 file->f_version = 0;
@@ -95,7 +95,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
95 lock_kernel(); 95 lock_kernel();
96 switch (origin) { 96 switch (origin) {
97 case 2: 97 case 2:
98 offset += i_size_read(file->f_dentry->d_inode); 98 offset += i_size_read(file->f_path.dentry->d_inode);
99 break; 99 break;
100 case 1: 100 case 1:
101 offset += file->f_pos; 101 offset += file->f_pos;
@@ -203,7 +203,7 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count
203 if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) 203 if (unlikely((pos < 0) || (loff_t) (pos + count) < 0))
204 goto Einval; 204 goto Einval;
205 205
206 inode = file->f_dentry->d_inode; 206 inode = file->f_path.dentry->d_inode;
207 if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) { 207 if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) {
208 int retval = locks_mandatory_area( 208 int retval = locks_mandatory_area(
209 read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, 209 read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE,
@@ -273,7 +273,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
273 else 273 else
274 ret = do_sync_read(file, buf, count, pos); 274 ret = do_sync_read(file, buf, count, pos);
275 if (ret > 0) { 275 if (ret > 0) {
276 fsnotify_access(file->f_dentry); 276 fsnotify_access(file->f_path.dentry);
277 current->rchar += ret; 277 current->rchar += ret;
278 } 278 }
279 current->syscr++; 279 current->syscr++;
@@ -331,7 +331,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
331 else 331 else
332 ret = do_sync_write(file, buf, count, pos); 332 ret = do_sync_write(file, buf, count, pos);
333 if (ret > 0) { 333 if (ret > 0) {
334 fsnotify_modify(file->f_dentry); 334 fsnotify_modify(file->f_path.dentry);
335 current->wchar += ret; 335 current->wchar += ret;
336 } 336 }
337 current->syscw++; 337 current->syscw++;
@@ -628,9 +628,9 @@ out:
628 kfree(iov); 628 kfree(iov);
629 if ((ret + (type == READ)) > 0) { 629 if ((ret + (type == READ)) > 0) {
630 if (type == READ) 630 if (type == READ)
631 fsnotify_access(file->f_dentry); 631 fsnotify_access(file->f_path.dentry);
632 else 632 else
633 fsnotify_modify(file->f_dentry); 633 fsnotify_modify(file->f_path.dentry);
634 } 634 }
635 return ret; 635 return ret;
636} 636}
@@ -722,7 +722,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
722 if (!(in_file->f_mode & FMODE_READ)) 722 if (!(in_file->f_mode & FMODE_READ))
723 goto fput_in; 723 goto fput_in;
724 retval = -EINVAL; 724 retval = -EINVAL;
725 in_inode = in_file->f_dentry->d_inode; 725 in_inode = in_file->f_path.dentry->d_inode;
726 if (!in_inode) 726 if (!in_inode)
727 goto fput_in; 727 goto fput_in;
728 if (!in_file->f_op || !in_file->f_op->sendfile) 728 if (!in_file->f_op || !in_file->f_op->sendfile)
@@ -754,7 +754,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
754 retval = -EINVAL; 754 retval = -EINVAL;
755 if (!out_file->f_op || !out_file->f_op->sendpage) 755 if (!out_file->f_op || !out_file->f_op->sendpage)
756 goto fput_out; 756 goto fput_out;
757 out_inode = out_file->f_dentry->d_inode; 757 out_inode = out_file->f_path.dentry->d_inode;
758 retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); 758 retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count);
759 if (retval < 0) 759 if (retval < 0)
760 goto fput_out; 760 goto fput_out;
diff --git a/fs/readdir.c b/fs/readdir.c
index bff3ee58e2f8..f39f5b313252 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -21,7 +21,7 @@
21 21
22int vfs_readdir(struct file *file, filldir_t filler, void *buf) 22int vfs_readdir(struct file *file, filldir_t filler, void *buf)
23{ 23{
24 struct inode *inode = file->f_dentry->d_inode; 24 struct inode *inode = file->f_path.dentry->d_inode;
25 int res = -ENOTDIR; 25 int res = -ENOTDIR;
26 if (!file->f_op || !file->f_op->readdir) 26 if (!file->f_op || !file->f_op->readdir)
27 goto out; 27 goto out;
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index e3d466a228d4..b286ccb08587 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -708,7 +708,7 @@ static void oid_groups(reiserfs_blocknr_hint_t * hint)
708 */ 708 */
709static int get_left_neighbor(reiserfs_blocknr_hint_t * hint) 709static int get_left_neighbor(reiserfs_blocknr_hint_t * hint)
710{ 710{
711 struct path *path; 711 struct treepath *path;
712 struct buffer_head *bh; 712 struct buffer_head *bh;
713 struct item_head *ih; 713 struct item_head *ih;
714 int pos_in_item; 714 int pos_in_item;
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index 657050ad7430..96a2f8889da3 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -45,7 +45,7 @@ static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
45// 45//
46static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 46static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
47{ 47{
48 struct inode *inode = filp->f_dentry->d_inode; 48 struct inode *inode = filp->f_path.dentry->d_inode;
49 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */ 49 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
50 INITIALIZE_PATH(path_to_entry); 50 INITIALIZE_PATH(path_to_entry);
51 struct buffer_head *bh; 51 struct buffer_head *bh;
@@ -135,7 +135,7 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
135 /* Ignore the .reiserfs_priv entry */ 135 /* Ignore the .reiserfs_priv entry */
136 if (reiserfs_xattrs(inode->i_sb) && 136 if (reiserfs_xattrs(inode->i_sb) &&
137 !old_format_only(inode->i_sb) && 137 !old_format_only(inode->i_sb) &&
138 filp->f_dentry == inode->i_sb->s_root && 138 filp->f_path.dentry == inode->i_sb->s_root &&
139 REISERFS_SB(inode->i_sb)->priv_root && 139 REISERFS_SB(inode->i_sb)->priv_root &&
140 REISERFS_SB(inode->i_sb)->priv_root->d_inode 140 REISERFS_SB(inode->i_sb)->priv_root->d_inode
141 && deh_objectid(deh) == 141 && deh_objectid(deh) ==
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 373d862c3f87..99b6f329ba23 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -1288,7 +1288,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
1288 loff_t pos; // Current position in the file. 1288 loff_t pos; // Current position in the file.
1289 ssize_t res; // return value of various functions that we call. 1289 ssize_t res; // return value of various functions that we call.
1290 int err = 0; 1290 int err = 0;
1291 struct inode *inode = file->f_dentry->d_inode; // Inode of the file that we are writing to. 1291 struct inode *inode = file->f_path.dentry->d_inode; // Inode of the file that we are writing to.
1292 /* To simplify coding at this time, we store 1292 /* To simplify coding at this time, we store
1293 locked pages in array for now */ 1293 locked pages in array for now */
1294 struct page *prepared_pages[REISERFS_WRITE_PAGES_AT_A_TIME]; 1294 struct page *prepared_pages[REISERFS_WRITE_PAGES_AT_A_TIME];
@@ -1335,7 +1335,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
1335 if (count == 0) 1335 if (count == 0)
1336 goto out; 1336 goto out;
1337 1337
1338 res = remove_suid(file->f_dentry); 1338 res = remove_suid(file->f_path.dentry);
1339 if (res) 1339 if (res)
1340 goto out; 1340 goto out;
1341 1341
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c
index 6d0e554daa9d..0ee35c6c9b72 100644
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -957,7 +957,7 @@ static int get_far_parent(struct tree_balance *p_s_tb,
957{ 957{
958 struct buffer_head *p_s_parent; 958 struct buffer_head *p_s_parent;
959 INITIALIZE_PATH(s_path_to_neighbor_father); 959 INITIALIZE_PATH(s_path_to_neighbor_father);
960 struct path *p_s_path = p_s_tb->tb_path; 960 struct treepath *p_s_path = p_s_tb->tb_path;
961 struct cpu_key s_lr_father_key; 961 struct cpu_key s_lr_father_key;
962 int n_counter, 962 int n_counter,
963 n_position = INT_MAX, 963 n_position = INT_MAX,
@@ -1074,7 +1074,7 @@ static int get_far_parent(struct tree_balance *p_s_tb,
1074 */ 1074 */
1075static int get_parents(struct tree_balance *p_s_tb, int n_h) 1075static int get_parents(struct tree_balance *p_s_tb, int n_h)
1076{ 1076{
1077 struct path *p_s_path = p_s_tb->tb_path; 1077 struct treepath *p_s_path = p_s_tb->tb_path;
1078 int n_position, 1078 int n_position,
1079 n_ret_value, 1079 n_ret_value,
1080 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h); 1080 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h);
@@ -1885,7 +1885,7 @@ static int check_balance(int mode,
1885static int get_direct_parent(struct tree_balance *p_s_tb, int n_h) 1885static int get_direct_parent(struct tree_balance *p_s_tb, int n_h)
1886{ 1886{
1887 struct buffer_head *p_s_bh; 1887 struct buffer_head *p_s_bh;
1888 struct path *p_s_path = p_s_tb->tb_path; 1888 struct treepath *p_s_path = p_s_tb->tb_path;
1889 int n_position, 1889 int n_position,
1890 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h); 1890 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h);
1891 1891
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 254239e6f9e3..f3d1c4a77979 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -207,7 +207,7 @@ static int file_capable(struct inode *inode, long block)
207} 207}
208 208
209/*static*/ int restart_transaction(struct reiserfs_transaction_handle *th, 209/*static*/ int restart_transaction(struct reiserfs_transaction_handle *th,
210 struct inode *inode, struct path *path) 210 struct inode *inode, struct treepath *path)
211{ 211{
212 struct super_block *s = th->t_super; 212 struct super_block *s = th->t_super;
213 int len = th->t_blocks_allocated; 213 int len = th->t_blocks_allocated;
@@ -570,7 +570,7 @@ static inline int _allocate_block(struct reiserfs_transaction_handle *th,
570 long block, 570 long block,
571 struct inode *inode, 571 struct inode *inode,
572 b_blocknr_t * allocated_block_nr, 572 b_blocknr_t * allocated_block_nr,
573 struct path *path, int flags) 573 struct treepath *path, int flags)
574{ 574{
575 BUG_ON(!th->t_trans_id); 575 BUG_ON(!th->t_trans_id);
576 576
@@ -1107,7 +1107,7 @@ static inline ulong to_fake_used_blocks(struct inode *inode, int sd_size)
1107// 1107//
1108 1108
1109// called by read_locked_inode 1109// called by read_locked_inode
1110static void init_inode(struct inode *inode, struct path *path) 1110static void init_inode(struct inode *inode, struct treepath *path)
1111{ 1111{
1112 struct buffer_head *bh; 1112 struct buffer_head *bh;
1113 struct item_head *ih; 1113 struct item_head *ih;
@@ -1284,7 +1284,7 @@ static void inode2sd_v1(void *sd, struct inode *inode, loff_t size)
1284/* NOTE, you must prepare the buffer head before sending it here, 1284/* NOTE, you must prepare the buffer head before sending it here,
1285** and then log it after the call 1285** and then log it after the call
1286*/ 1286*/
1287static void update_stat_data(struct path *path, struct inode *inode, 1287static void update_stat_data(struct treepath *path, struct inode *inode,
1288 loff_t size) 1288 loff_t size)
1289{ 1289{
1290 struct buffer_head *bh; 1290 struct buffer_head *bh;
@@ -1653,7 +1653,7 @@ int reiserfs_write_inode(struct inode *inode, int do_sync)
1653 containing "." and ".." entries */ 1653 containing "." and ".." entries */
1654static int reiserfs_new_directory(struct reiserfs_transaction_handle *th, 1654static int reiserfs_new_directory(struct reiserfs_transaction_handle *th,
1655 struct inode *inode, 1655 struct inode *inode,
1656 struct item_head *ih, struct path *path, 1656 struct item_head *ih, struct treepath *path,
1657 struct inode *dir) 1657 struct inode *dir)
1658{ 1658{
1659 struct super_block *sb = th->t_super; 1659 struct super_block *sb = th->t_super;
@@ -1712,7 +1712,7 @@ static int reiserfs_new_directory(struct reiserfs_transaction_handle *th,
1712 containing the body of symlink */ 1712 containing the body of symlink */
1713static int reiserfs_new_symlink(struct reiserfs_transaction_handle *th, struct inode *inode, /* Inode of symlink */ 1713static int reiserfs_new_symlink(struct reiserfs_transaction_handle *th, struct inode *inode, /* Inode of symlink */
1714 struct item_head *ih, 1714 struct item_head *ih,
1715 struct path *path, const char *symname, 1715 struct treepath *path, const char *symname,
1716 int item_len) 1716 int item_len)
1717{ 1717{
1718 struct super_block *sb = th->t_super; 1718 struct super_block *sb = th->t_super;
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index 9c57578cb831..b484d2913c0d 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -99,7 +99,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
99long reiserfs_compat_ioctl(struct file *file, unsigned int cmd, 99long reiserfs_compat_ioctl(struct file *file, unsigned int cmd,
100 unsigned long arg) 100 unsigned long arg)
101{ 101{
102 struct inode *inode = file->f_dentry->d_inode; 102 struct inode *inode = file->f_path.dentry->d_inode;
103 int ret; 103 int ret;
104 104
105 /* These are just misnamed, they actually get/put from/to user an int */ 105 /* These are just misnamed, they actually get/put from/to user an int */
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index abde1edc2235..23f5cd5bbf56 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -54,7 +54,7 @@ static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off)
54 54
55// comment? maybe something like set de to point to what the path points to? 55// comment? maybe something like set de to point to what the path points to?
56static inline void set_de_item_location(struct reiserfs_dir_entry *de, 56static inline void set_de_item_location(struct reiserfs_dir_entry *de,
57 struct path *path) 57 struct treepath *path)
58{ 58{
59 de->de_bh = get_last_bh(path); 59 de->de_bh = get_last_bh(path);
60 de->de_ih = get_ih(path); 60 de->de_ih = get_ih(path);
@@ -113,7 +113,7 @@ entry position in the item
113 113
114/* The function is NOT SCHEDULE-SAFE! */ 114/* The function is NOT SCHEDULE-SAFE! */
115int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, 115int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
116 struct path *path, struct reiserfs_dir_entry *de) 116 struct treepath *path, struct reiserfs_dir_entry *de)
117{ 117{
118 int retval; 118 int retval;
119 119
@@ -282,7 +282,7 @@ static int linear_search_in_dir_item(struct cpu_key *key,
282// may return NAME_FOUND, NAME_FOUND_INVISIBLE, NAME_NOT_FOUND 282// may return NAME_FOUND, NAME_FOUND_INVISIBLE, NAME_NOT_FOUND
283// FIXME: should add something like IOERROR 283// FIXME: should add something like IOERROR
284static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen, 284static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
285 struct path *path_to_entry, 285 struct treepath *path_to_entry,
286 struct reiserfs_dir_entry *de) 286 struct reiserfs_dir_entry *de)
287{ 287{
288 struct cpu_key key_to_search; 288 struct cpu_key key_to_search;
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
index c533ec1bcaec..ecc9943202fc 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -295,7 +295,7 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb)
295 } 295 }
296#if defined( REISERFS_USE_OIDMAPF ) 296#if defined( REISERFS_USE_OIDMAPF )
297 if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) { 297 if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) {
298 loff_t size = sb_info->oidmap.mapf->f_dentry->d_inode->i_size; 298 loff_t size = sb_info->oidmap.mapf->f_path.dentry->d_inode->i_size;
299 total_used += size / sizeof(reiserfs_oidinterval_d_t); 299 total_used += size / sizeof(reiserfs_oidinterval_d_t);
300 } 300 }
301#endif 301#endif
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 5240abe1a709..47e7027ea39f 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -244,7 +244,7 @@ static const struct reiserfs_key MAX_KEY = {
244 of the path, and going upwards. We must check the path's validity at each step. If the key is not in 244 of the path, and going upwards. We must check the path's validity at each step. If the key is not in
245 the path, there is no delimiting key in the tree (buffer is first or last buffer in tree), and in this 245 the path, there is no delimiting key in the tree (buffer is first or last buffer in tree), and in this
246 case we return a special key, either MIN_KEY or MAX_KEY. */ 246 case we return a special key, either MIN_KEY or MAX_KEY. */
247static inline const struct reiserfs_key *get_lkey(const struct path 247static inline const struct reiserfs_key *get_lkey(const struct treepath
248 *p_s_chk_path, 248 *p_s_chk_path,
249 const struct super_block 249 const struct super_block
250 *p_s_sb) 250 *p_s_sb)
@@ -290,7 +290,7 @@ static inline const struct reiserfs_key *get_lkey(const struct path
290} 290}
291 291
292/* Get delimiting key of the buffer at the path and its right neighbor. */ 292/* Get delimiting key of the buffer at the path and its right neighbor. */
293inline const struct reiserfs_key *get_rkey(const struct path *p_s_chk_path, 293inline const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path,
294 const struct super_block *p_s_sb) 294 const struct super_block *p_s_sb)
295{ 295{
296 int n_position, n_path_offset = p_s_chk_path->path_length; 296 int n_position, n_path_offset = p_s_chk_path->path_length;
@@ -337,7 +337,7 @@ inline const struct reiserfs_key *get_rkey(const struct path *p_s_chk_path,
337 the path. These delimiting keys are stored at least one level above that buffer in the tree. If the 337 the path. These delimiting keys are stored at least one level above that buffer in the tree. If the
338 buffer is the first or last node in the tree order then one of the delimiting keys may be absent, and in 338 buffer is the first or last node in the tree order then one of the delimiting keys may be absent, and in
339 this case get_lkey and get_rkey return a special key which is MIN_KEY or MAX_KEY. */ 339 this case get_lkey and get_rkey return a special key which is MIN_KEY or MAX_KEY. */
340static inline int key_in_buffer(struct path *p_s_chk_path, /* Path which should be checked. */ 340static inline int key_in_buffer(struct treepath *p_s_chk_path, /* Path which should be checked. */
341 const struct cpu_key *p_s_key, /* Key which should be checked. */ 341 const struct cpu_key *p_s_key, /* Key which should be checked. */
342 struct super_block *p_s_sb /* Super block pointer. */ 342 struct super_block *p_s_sb /* Super block pointer. */
343 ) 343 )
@@ -374,7 +374,7 @@ inline void decrement_bcount(struct buffer_head *p_s_bh)
374} 374}
375 375
376/* Decrement b_count field of the all buffers in the path. */ 376/* Decrement b_count field of the all buffers in the path. */
377void decrement_counters_in_path(struct path *p_s_search_path) 377void decrement_counters_in_path(struct treepath *p_s_search_path)
378{ 378{
379 int n_path_offset = p_s_search_path->path_length; 379 int n_path_offset = p_s_search_path->path_length;
380 380
@@ -391,7 +391,7 @@ void decrement_counters_in_path(struct path *p_s_search_path)
391 p_s_search_path->path_length = ILLEGAL_PATH_ELEMENT_OFFSET; 391 p_s_search_path->path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
392} 392}
393 393
394int reiserfs_check_path(struct path *p) 394int reiserfs_check_path(struct treepath *p)
395{ 395{
396 RFALSE(p->path_length != ILLEGAL_PATH_ELEMENT_OFFSET, 396 RFALSE(p->path_length != ILLEGAL_PATH_ELEMENT_OFFSET,
397 "path not properly relsed"); 397 "path not properly relsed");
@@ -403,7 +403,7 @@ int reiserfs_check_path(struct path *p)
403** 403**
404** only called from fix_nodes() 404** only called from fix_nodes()
405*/ 405*/
406void pathrelse_and_restore(struct super_block *s, struct path *p_s_search_path) 406void pathrelse_and_restore(struct super_block *s, struct treepath *p_s_search_path)
407{ 407{
408 int n_path_offset = p_s_search_path->path_length; 408 int n_path_offset = p_s_search_path->path_length;
409 409
@@ -421,7 +421,7 @@ void pathrelse_and_restore(struct super_block *s, struct path *p_s_search_path)
421} 421}
422 422
423/* Release all buffers in the path. */ 423/* Release all buffers in the path. */
424void pathrelse(struct path *p_s_search_path) 424void pathrelse(struct treepath *p_s_search_path)
425{ 425{
426 int n_path_offset = p_s_search_path->path_length; 426 int n_path_offset = p_s_search_path->path_length;
427 427
@@ -602,7 +602,7 @@ static void search_by_key_reada(struct super_block *s,
602 correctness of the bottom of the path */ 602 correctness of the bottom of the path */
603/* The function is NOT SCHEDULE-SAFE! */ 603/* The function is NOT SCHEDULE-SAFE! */
604int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* Key to search. */ 604int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* Key to search. */
605 struct path *p_s_search_path, /* This structure was 605 struct treepath *p_s_search_path,/* This structure was
606 allocated and initialized 606 allocated and initialized
607 by the calling 607 by the calling
608 function. It is filled up 608 function. It is filled up
@@ -813,7 +813,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /*
813/* The function is NOT SCHEDULE-SAFE! */ 813/* The function is NOT SCHEDULE-SAFE! */
814int search_for_position_by_key(struct super_block *p_s_sb, /* Pointer to the super block. */ 814int search_for_position_by_key(struct super_block *p_s_sb, /* Pointer to the super block. */
815 const struct cpu_key *p_cpu_key, /* Key to search (cpu variable) */ 815 const struct cpu_key *p_cpu_key, /* Key to search (cpu variable) */
816 struct path *p_s_search_path /* Filled up by this function. */ 816 struct treepath *p_s_search_path /* Filled up by this function. */
817 ) 817 )
818{ 818{
819 struct item_head *p_le_ih; /* pointer to on-disk structure */ 819 struct item_head *p_le_ih; /* pointer to on-disk structure */
@@ -884,7 +884,7 @@ int search_for_position_by_key(struct super_block *p_s_sb, /* Pointer to the sup
884} 884}
885 885
886/* Compare given item and item pointed to by the path. */ 886/* Compare given item and item pointed to by the path. */
887int comp_items(const struct item_head *stored_ih, const struct path *p_s_path) 887int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path)
888{ 888{
889 struct buffer_head *p_s_bh; 889 struct buffer_head *p_s_bh;
890 struct item_head *ih; 890 struct item_head *ih;
@@ -911,7 +911,7 @@ int comp_items(const struct item_head *stored_ih, const struct path *p_s_path)
911#define block_in_use(bh) (buffer_locked(bh) || (held_by_others(bh))) 911#define block_in_use(bh) (buffer_locked(bh) || (held_by_others(bh)))
912 912
913// prepare for delete or cut of direct item 913// prepare for delete or cut of direct item
914static inline int prepare_for_direct_item(struct path *path, 914static inline int prepare_for_direct_item(struct treepath *path,
915 struct item_head *le_ih, 915 struct item_head *le_ih,
916 struct inode *inode, 916 struct inode *inode,
917 loff_t new_file_length, int *cut_size) 917 loff_t new_file_length, int *cut_size)
@@ -952,7 +952,7 @@ static inline int prepare_for_direct_item(struct path *path,
952 return M_CUT; /* Cut from this item. */ 952 return M_CUT; /* Cut from this item. */
953} 953}
954 954
955static inline int prepare_for_direntry_item(struct path *path, 955static inline int prepare_for_direntry_item(struct treepath *path,
956 struct item_head *le_ih, 956 struct item_head *le_ih,
957 struct inode *inode, 957 struct inode *inode,
958 loff_t new_file_length, 958 loff_t new_file_length,
@@ -987,7 +987,7 @@ static inline int prepare_for_direntry_item(struct path *path,
987 In case of file truncate calculate whether this item must be deleted/truncated or last 987 In case of file truncate calculate whether this item must be deleted/truncated or last
988 unformatted node of this item will be converted to a direct item. 988 unformatted node of this item will be converted to a direct item.
989 This function returns a determination of what balance mode the calling function should employ. */ 989 This function returns a determination of what balance mode the calling function should employ. */
990static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, struct inode *inode, struct path *p_s_path, const struct cpu_key *p_s_item_key, int *p_n_removed, /* Number of unformatted nodes which were removed 990static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, struct inode *inode, struct treepath *p_s_path, const struct cpu_key *p_s_item_key, int *p_n_removed, /* Number of unformatted nodes which were removed
991 from end of the file. */ 991 from end of the file. */
992 int *p_n_cut_size, unsigned long long n_new_file_length /* MAX_KEY_OFFSET in case of delete. */ 992 int *p_n_cut_size, unsigned long long n_new_file_length /* MAX_KEY_OFFSET in case of delete. */
993 ) 993 )
@@ -1125,7 +1125,7 @@ static int calc_deleted_bytes_number(struct tree_balance *p_s_tb, char c_mode)
1125static void init_tb_struct(struct reiserfs_transaction_handle *th, 1125static void init_tb_struct(struct reiserfs_transaction_handle *th,
1126 struct tree_balance *p_s_tb, 1126 struct tree_balance *p_s_tb,
1127 struct super_block *p_s_sb, 1127 struct super_block *p_s_sb,
1128 struct path *p_s_path, int n_size) 1128 struct treepath *p_s_path, int n_size)
1129{ 1129{
1130 1130
1131 BUG_ON(!th->t_trans_id); 1131 BUG_ON(!th->t_trans_id);
@@ -1176,7 +1176,7 @@ char head2type(struct item_head *ih)
1176#endif 1176#endif
1177 1177
1178/* Delete object item. */ 1178/* Delete object item. */
1179int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct path *p_s_path, /* Path to the deleted item. */ 1179int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath *p_s_path, /* Path to the deleted item. */
1180 const struct cpu_key *p_s_item_key, /* Key to search for the deleted item. */ 1180 const struct cpu_key *p_s_item_key, /* Key to search for the deleted item. */
1181 struct inode *p_s_inode, /* inode is here just to update i_blocks and quotas */ 1181 struct inode *p_s_inode, /* inode is here just to update i_blocks and quotas */
1182 struct buffer_head *p_s_un_bh) 1182 struct buffer_head *p_s_un_bh)
@@ -1468,7 +1468,7 @@ static void unmap_buffers(struct page *page, loff_t pos)
1468static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th, 1468static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th,
1469 struct inode *p_s_inode, 1469 struct inode *p_s_inode,
1470 struct page *page, 1470 struct page *page,
1471 struct path *p_s_path, 1471 struct treepath *p_s_path,
1472 const struct cpu_key *p_s_item_key, 1472 const struct cpu_key *p_s_item_key,
1473 loff_t n_new_file_size, char *p_c_mode) 1473 loff_t n_new_file_size, char *p_c_mode)
1474{ 1474{
@@ -1503,7 +1503,7 @@ static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th,
1503 pointer being converted. Therefore we have to delete inserted 1503 pointer being converted. Therefore we have to delete inserted
1504 direct item(s) */ 1504 direct item(s) */
1505static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th, 1505static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th,
1506 struct inode *inode, struct path *path) 1506 struct inode *inode, struct treepath *path)
1507{ 1507{
1508 struct cpu_key tail_key; 1508 struct cpu_key tail_key;
1509 int tail_len; 1509 int tail_len;
@@ -1545,7 +1545,7 @@ static void indirect_to_direct_roll_back(struct reiserfs_transaction_handle *th,
1545 1545
1546/* (Truncate or cut entry) or delete object item. Returns < 0 on failure */ 1546/* (Truncate or cut entry) or delete object item. Returns < 0 on failure */
1547int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, 1547int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1548 struct path *p_s_path, 1548 struct treepath *p_s_path,
1549 struct cpu_key *p_s_item_key, 1549 struct cpu_key *p_s_item_key,
1550 struct inode *p_s_inode, 1550 struct inode *p_s_inode,
1551 struct page *page, loff_t n_new_file_size) 1551 struct page *page, loff_t n_new_file_size)
@@ -1920,7 +1920,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p
1920 1920
1921#ifdef CONFIG_REISERFS_CHECK 1921#ifdef CONFIG_REISERFS_CHECK
1922// this makes sure, that we __append__, not overwrite or add holes 1922// this makes sure, that we __append__, not overwrite or add holes
1923static void check_research_for_paste(struct path *path, 1923static void check_research_for_paste(struct treepath *path,
1924 const struct cpu_key *p_s_key) 1924 const struct cpu_key *p_s_key)
1925{ 1925{
1926 struct item_head *found_ih = get_ih(path); 1926 struct item_head *found_ih = get_ih(path);
@@ -1954,7 +1954,7 @@ static void check_research_for_paste(struct path *path,
1954#endif /* config reiserfs check */ 1954#endif /* config reiserfs check */
1955 1955
1956/* Paste bytes to the existing item. Returns bytes number pasted into the item. */ 1956/* Paste bytes to the existing item. Returns bytes number pasted into the item. */
1957int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct path *p_s_search_path, /* Path to the pasted item. */ 1957int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct treepath *p_s_search_path, /* Path to the pasted item. */
1958 const struct cpu_key *p_s_key, /* Key to search for the needed item. */ 1958 const struct cpu_key *p_s_key, /* Key to search for the needed item. */
1959 struct inode *inode, /* Inode item belongs to */ 1959 struct inode *inode, /* Inode item belongs to */
1960 const char *p_c_body, /* Pointer to the bytes to paste. */ 1960 const char *p_c_body, /* Pointer to the bytes to paste. */
@@ -2036,7 +2036,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct path
2036} 2036}
2037 2037
2038/* Insert new item into the buffer at the path. */ 2038/* Insert new item into the buffer at the path. */
2039int reiserfs_insert_item(struct reiserfs_transaction_handle *th, struct path *p_s_path, /* Path to the inserteded item. */ 2039int reiserfs_insert_item(struct reiserfs_transaction_handle *th, struct treepath *p_s_path, /* Path to the inserteded item. */
2040 const struct cpu_key *key, struct item_head *p_s_ih, /* Pointer to the item header to insert. */ 2040 const struct cpu_key *key, struct item_head *p_s_ih, /* Pointer to the item header to insert. */
2041 struct inode *inode, const char *p_c_body) 2041 struct inode *inode, const char *p_c_body)
2042{ /* Pointer to the bytes to insert. */ 2042{ /* Pointer to the bytes to insert. */
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 7fb5fb036f90..58ad4551a7c1 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -23,7 +23,7 @@
23#include <linux/blkdev.h> 23#include <linux/blkdev.h>
24#include <linux/buffer_head.h> 24#include <linux/buffer_head.h>
25#include <linux/vfs.h> 25#include <linux/vfs.h>
26#include <linux/namespace.h> 26#include <linux/mnt_namespace.h>
27#include <linux/mount.h> 27#include <linux/mount.h>
28#include <linux/namei.h> 28#include <linux/namei.h>
29#include <linux/quotaops.h> 29#include <linux/quotaops.h>
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
index 36f108fc1cf5..f8121a1147e8 100644
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -15,7 +15,7 @@
15/* path points to first direct item of the file regarless of how many of 15/* path points to first direct item of the file regarless of how many of
16 them are there */ 16 them are there */
17int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode, 17int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
18 struct path *path, struct buffer_head *unbh, 18 struct treepath *path, struct buffer_head *unbh,
19 loff_t tail_offset) 19 loff_t tail_offset)
20{ 20{
21 struct super_block *sb = inode->i_sb; 21 struct super_block *sb = inode->i_sb;
@@ -171,7 +171,7 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
171 what we expect from it (number of cut bytes). But when tail remains 171 what we expect from it (number of cut bytes). But when tail remains
172 in the unformatted node, we set mode to SKIP_BALANCING and unlock 172 in the unformatted node, we set mode to SKIP_BALANCING and unlock
173 inode */ 173 inode */
174int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct path *p_s_path, /* path to the indirect item. */ 174int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct treepath *p_s_path, /* path to the indirect item. */
175 const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */ 175 const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
176 loff_t n_new_file_size, /* New file size. */ 176 loff_t n_new_file_size, /* New file size. */
177 char *p_c_mode) 177 char *p_c_mode)
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 1e4d68590178..f01389fd162e 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -274,7 +274,7 @@ static struct file *open_xa_file(const struct inode *inode, const char *name,
274 */ 274 */
275static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) 275static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
276{ 276{
277 struct inode *inode = filp->f_dentry->d_inode; 277 struct inode *inode = filp->f_path.dentry->d_inode;
278 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */ 278 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
279 INITIALIZE_PATH(path_to_entry); 279 INITIALIZE_PATH(path_to_entry);
280 struct buffer_head *bh; 280 struct buffer_head *bh;
@@ -420,7 +420,7 @@ static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
420static 420static
421int xattr_readdir(struct file *file, filldir_t filler, void *buf) 421int xattr_readdir(struct file *file, filldir_t filler, void *buf)
422{ 422{
423 struct inode *inode = file->f_dentry->d_inode; 423 struct inode *inode = file->f_path.dentry->d_inode;
424 int res = -ENOTDIR; 424 int res = -ENOTDIR;
425 if (!file->f_op || !file->f_op->readdir) 425 if (!file->f_op || !file->f_op->readdir)
426 goto out; 426 goto out;
@@ -508,7 +508,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
508 goto out; 508 goto out;
509 } 509 }
510 510
511 xinode = fp->f_dentry->d_inode; 511 xinode = fp->f_path.dentry->d_inode;
512 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 512 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
513 513
514 /* we need to copy it off.. */ 514 /* we need to copy it off.. */
@@ -527,7 +527,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
527 newattrs.ia_size = buffer_size; 527 newattrs.ia_size = buffer_size;
528 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 528 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
529 mutex_lock(&xinode->i_mutex); 529 mutex_lock(&xinode->i_mutex);
530 err = notify_change(fp->f_dentry, &newattrs); 530 err = notify_change(fp->f_path.dentry, &newattrs);
531 if (err) 531 if (err)
532 goto out_filp; 532 goto out_filp;
533 533
@@ -626,7 +626,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
626 goto out; 626 goto out;
627 } 627 }
628 628
629 xinode = fp->f_dentry->d_inode; 629 xinode = fp->f_path.dentry->d_inode;
630 isize = xinode->i_size; 630 isize = xinode->i_size;
631 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 631 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
632 632
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index c5af088d4a4c..d3e243a6f609 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -276,7 +276,7 @@ static unsigned char romfs_dtype_table[] = {
276static int 276static int
277romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 277romfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
278{ 278{
279 struct inode *i = filp->f_dentry->d_inode; 279 struct inode *i = filp->f_path.dentry->d_inode;
280 struct romfs_inode ri; 280 struct romfs_inode ri;
281 unsigned long offset, maxoff; 281 unsigned long offset, maxoff;
282 int j, ino, nextfh; 282 int j, ino, nextfh;
diff --git a/fs/select.c b/fs/select.c
index dcbc1112b7ec..fe0893afd931 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -311,7 +311,7 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
311{ 311{
312 fd_set_bits fds; 312 fd_set_bits fds;
313 void *bits; 313 void *bits;
314 int ret, max_fdset; 314 int ret, max_fds;
315 unsigned int size; 315 unsigned int size;
316 struct fdtable *fdt; 316 struct fdtable *fdt;
317 /* Allocate small arguments on the stack to save memory and be faster */ 317 /* Allocate small arguments on the stack to save memory and be faster */
@@ -321,13 +321,13 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
321 if (n < 0) 321 if (n < 0)
322 goto out_nofds; 322 goto out_nofds;
323 323
324 /* max_fdset can increase, so grab it once to avoid race */ 324 /* max_fds can increase, so grab it once to avoid race */
325 rcu_read_lock(); 325 rcu_read_lock();
326 fdt = files_fdtable(current->files); 326 fdt = files_fdtable(current->files);
327 max_fdset = fdt->max_fdset; 327 max_fds = fdt->max_fds;
328 rcu_read_unlock(); 328 rcu_read_unlock();
329 if (n > max_fdset) 329 if (n > max_fds)
330 n = max_fdset; 330 n = max_fds;
331 331
332 /* 332 /*
333 * We need 6 bitmaps (in/out/ex for both incoming and outgoing), 333 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 10690aa401c7..0ac22af7afe5 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -269,7 +269,7 @@ EXPORT_SYMBOL(seq_lseek);
269/** 269/**
270 * seq_release - free the structures associated with sequential file. 270 * seq_release - free the structures associated with sequential file.
271 * @file: file in question 271 * @file: file in question
272 * @inode: file->f_dentry->d_inode 272 * @inode: file->f_path.dentry->d_inode
273 * 273 *
274 * Frees the structures associated with sequential file; can be used 274 * Frees the structures associated with sequential file; can be used
275 * as ->f_op->release() if you don't have private data to destroy. 275 * as ->f_op->release() if you don't have private data to destroy.
diff --git a/fs/smbfs/cache.c b/fs/smbfs/cache.c
index 74b86d9725a6..8182f0542a21 100644
--- a/fs/smbfs/cache.c
+++ b/fs/smbfs/cache.c
@@ -125,7 +125,7 @@ smb_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
125 struct smb_cache_control *ctrl, struct qstr *qname, 125 struct smb_cache_control *ctrl, struct qstr *qname,
126 struct smb_fattr *entry) 126 struct smb_fattr *entry)
127{ 127{
128 struct dentry *newdent, *dentry = filp->f_dentry; 128 struct dentry *newdent, *dentry = filp->f_path.dentry;
129 struct inode *newino, *inode = dentry->d_inode; 129 struct inode *newino, *inode = dentry->d_inode;
130 struct smb_cache_control ctl = *ctrl; 130 struct smb_cache_control ctl = *ctrl;
131 int valid = 0; 131 int valid = 0;
diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c
index 70d9c5a37f5a..b1e58d1ac9ca 100644
--- a/fs/smbfs/dir.c
+++ b/fs/smbfs/dir.c
@@ -78,7 +78,7 @@ struct inode_operations smb_dir_inode_operations_unix =
78static int 78static int
79smb_readdir(struct file *filp, void *dirent, filldir_t filldir) 79smb_readdir(struct file *filp, void *dirent, filldir_t filldir)
80{ 80{
81 struct dentry *dentry = filp->f_dentry; 81 struct dentry *dentry = filp->f_path.dentry;
82 struct inode *dir = dentry->d_inode; 82 struct inode *dir = dentry->d_inode;
83 struct smb_sb_info *server = server_from_dentry(dentry); 83 struct smb_sb_info *server = server_from_dentry(dentry);
84 union smb_dir_cache *cache = NULL; 84 union smb_dir_cache *cache = NULL;
@@ -238,12 +238,12 @@ out:
238static int 238static int
239smb_dir_open(struct inode *dir, struct file *file) 239smb_dir_open(struct inode *dir, struct file *file)
240{ 240{
241 struct dentry *dentry = file->f_dentry; 241 struct dentry *dentry = file->f_path.dentry;
242 struct smb_sb_info *server; 242 struct smb_sb_info *server;
243 int error = 0; 243 int error = 0;
244 244
245 VERBOSE("(%s/%s)\n", dentry->d_parent->d_name.name, 245 VERBOSE("(%s/%s)\n", dentry->d_parent->d_name.name,
246 file->f_dentry->d_name.name); 246 file->f_path.dentry->d_name.name);
247 247
248 /* 248 /*
249 * Directory timestamps in the core protocol aren't updated 249 * Directory timestamps in the core protocol aren't updated
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index 50784d13c87b..e50533a79517 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -102,7 +102,7 @@ static int
102smb_readpage(struct file *file, struct page *page) 102smb_readpage(struct file *file, struct page *page)
103{ 103{
104 int error; 104 int error;
105 struct dentry *dentry = file->f_dentry; 105 struct dentry *dentry = file->f_path.dentry;
106 106
107 page_cache_get(page); 107 page_cache_get(page);
108 error = smb_readpage_sync(dentry, page); 108 error = smb_readpage_sync(dentry, page);
@@ -205,7 +205,7 @@ static int
205smb_updatepage(struct file *file, struct page *page, unsigned long offset, 205smb_updatepage(struct file *file, struct page *page, unsigned long offset,
206 unsigned int count) 206 unsigned int count)
207{ 207{
208 struct dentry *dentry = file->f_dentry; 208 struct dentry *dentry = file->f_path.dentry;
209 209
210 DEBUG1("(%s/%s %d@%lld)\n", DENTRY_PATH(dentry), count, 210 DEBUG1("(%s/%s %d@%lld)\n", DENTRY_PATH(dentry), count,
211 ((unsigned long long)page->index << PAGE_CACHE_SHIFT) + offset); 211 ((unsigned long long)page->index << PAGE_CACHE_SHIFT) + offset);
@@ -218,7 +218,7 @@ smb_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
218 unsigned long nr_segs, loff_t pos) 218 unsigned long nr_segs, loff_t pos)
219{ 219{
220 struct file * file = iocb->ki_filp; 220 struct file * file = iocb->ki_filp;
221 struct dentry * dentry = file->f_dentry; 221 struct dentry * dentry = file->f_path.dentry;
222 ssize_t status; 222 ssize_t status;
223 223
224 VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry), 224 VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry),
@@ -243,7 +243,7 @@ out:
243static int 243static int
244smb_file_mmap(struct file * file, struct vm_area_struct * vma) 244smb_file_mmap(struct file * file, struct vm_area_struct * vma)
245{ 245{
246 struct dentry * dentry = file->f_dentry; 246 struct dentry * dentry = file->f_path.dentry;
247 int status; 247 int status;
248 248
249 VERBOSE("file %s/%s, address %lu - %lu\n", 249 VERBOSE("file %s/%s, address %lu - %lu\n",
@@ -264,7 +264,7 @@ static ssize_t
264smb_file_sendfile(struct file *file, loff_t *ppos, 264smb_file_sendfile(struct file *file, loff_t *ppos,
265 size_t count, read_actor_t actor, void *target) 265 size_t count, read_actor_t actor, void *target)
266{ 266{
267 struct dentry *dentry = file->f_dentry; 267 struct dentry *dentry = file->f_path.dentry;
268 ssize_t status; 268 ssize_t status;
269 269
270 VERBOSE("file %s/%s, pos=%Ld, count=%d\n", 270 VERBOSE("file %s/%s, pos=%Ld, count=%d\n",
@@ -323,7 +323,7 @@ smb_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
323 unsigned long nr_segs, loff_t pos) 323 unsigned long nr_segs, loff_t pos)
324{ 324{
325 struct file * file = iocb->ki_filp; 325 struct file * file = iocb->ki_filp;
326 struct dentry * dentry = file->f_dentry; 326 struct dentry * dentry = file->f_path.dentry;
327 ssize_t result; 327 ssize_t result;
328 328
329 VERBOSE("file %s/%s, count=%lu@%lu\n", 329 VERBOSE("file %s/%s, count=%lu@%lu\n",
@@ -355,7 +355,7 @@ static int
355smb_file_open(struct inode *inode, struct file * file) 355smb_file_open(struct inode *inode, struct file * file)
356{ 356{
357 int result; 357 int result;
358 struct dentry *dentry = file->f_dentry; 358 struct dentry *dentry = file->f_path.dentry;
359 int smb_mode = (file->f_mode & O_ACCMODE) - 1; 359 int smb_mode = (file->f_mode & O_ACCMODE) - 1;
360 360
361 lock_kernel(); 361 lock_kernel();
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c
index 40e174db9872..a5ced9e0c6c4 100644
--- a/fs/smbfs/proc.c
+++ b/fs/smbfs/proc.c
@@ -873,7 +873,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
873 filp = fget(opt->fd); 873 filp = fget(opt->fd);
874 if (!filp) 874 if (!filp)
875 goto out; 875 goto out;
876 if (!smb_valid_socket(filp->f_dentry->d_inode)) 876 if (!smb_valid_socket(filp->f_path.dentry->d_inode))
877 goto out_putf; 877 goto out_putf;
878 878
879 server->sock_file = filp; 879 server->sock_file = filp;
@@ -898,7 +898,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
898 /* 898 /*
899 * Store the server in sock user_data (Only used by sunrpc) 899 * Store the server in sock user_data (Only used by sunrpc)
900 */ 900 */
901 sk = SOCKET_I(filp->f_dentry->d_inode)->sk; 901 sk = SOCKET_I(filp->f_path.dentry->d_inode)->sk;
902 sk->sk_user_data = server; 902 sk->sk_user_data = server;
903 903
904 /* chain into the data_ready callback */ 904 /* chain into the data_ready callback */
@@ -1939,7 +1939,7 @@ static int
1939smb_proc_readdir_short(struct file *filp, void *dirent, filldir_t filldir, 1939smb_proc_readdir_short(struct file *filp, void *dirent, filldir_t filldir,
1940 struct smb_cache_control *ctl) 1940 struct smb_cache_control *ctl)
1941{ 1941{
1942 struct dentry *dir = filp->f_dentry; 1942 struct dentry *dir = filp->f_path.dentry;
1943 struct smb_sb_info *server = server_from_dentry(dir); 1943 struct smb_sb_info *server = server_from_dentry(dir);
1944 struct qstr qname; 1944 struct qstr qname;
1945 struct smb_fattr fattr; 1945 struct smb_fattr fattr;
@@ -2291,7 +2291,7 @@ static int
2291smb_proc_readdir_long(struct file *filp, void *dirent, filldir_t filldir, 2291smb_proc_readdir_long(struct file *filp, void *dirent, filldir_t filldir,
2292 struct smb_cache_control *ctl) 2292 struct smb_cache_control *ctl)
2293{ 2293{
2294 struct dentry *dir = filp->f_dentry; 2294 struct dentry *dir = filp->f_path.dentry;
2295 struct smb_sb_info *server = server_from_dentry(dir); 2295 struct smb_sb_info *server = server_from_dentry(dir);
2296 struct qstr qname; 2296 struct qstr qname;
2297 struct smb_fattr fattr; 2297 struct smb_fattr fattr;
@@ -2859,7 +2859,7 @@ static int
2859smb_proc_readdir_null(struct file *filp, void *dirent, filldir_t filldir, 2859smb_proc_readdir_null(struct file *filp, void *dirent, filldir_t filldir,
2860 struct smb_cache_control *ctl) 2860 struct smb_cache_control *ctl)
2861{ 2861{
2862 struct smb_sb_info *server = server_from_dentry(filp->f_dentry); 2862 struct smb_sb_info *server = server_from_dentry(filp->f_path.dentry);
2863 2863
2864 if (smb_proc_ops_wait(server) < 0) 2864 if (smb_proc_ops_wait(server) < 0)
2865 return -EIO; 2865 return -EIO;
diff --git a/fs/smbfs/sock.c b/fs/smbfs/sock.c
index 6815b1b12b68..92ea6b2367d7 100644
--- a/fs/smbfs/sock.c
+++ b/fs/smbfs/sock.c
@@ -82,10 +82,10 @@ server_sock(struct smb_sb_info *server)
82 if (server && (file = server->sock_file)) 82 if (server && (file = server->sock_file))
83 { 83 {
84#ifdef SMBFS_PARANOIA 84#ifdef SMBFS_PARANOIA
85 if (!smb_valid_socket(file->f_dentry->d_inode)) 85 if (!smb_valid_socket(file->f_path.dentry->d_inode))
86 PARANOIA("bad socket!\n"); 86 PARANOIA("bad socket!\n");
87#endif 87#endif
88 return SOCKET_I(file->f_dentry->d_inode); 88 return SOCKET_I(file->f_path.dentry->d_inode);
89 } 89 }
90 return NULL; 90 return NULL;
91} 91}
diff --git a/fs/splice.c b/fs/splice.c
index da74583a00ee..bbd0aeb3f68e 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -844,7 +844,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
844 ssize_t ret; 844 ssize_t ret;
845 int err; 845 int err;
846 846
847 err = remove_suid(out->f_dentry); 847 err = remove_suid(out->f_path.dentry);
848 if (unlikely(err)) 848 if (unlikely(err))
849 return err; 849 return err;
850 850
@@ -890,10 +890,10 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
890 ssize_t ret; 890 ssize_t ret;
891 int err; 891 int err;
892 892
893 err = should_remove_suid(out->f_dentry); 893 err = should_remove_suid(out->f_path.dentry);
894 if (unlikely(err)) { 894 if (unlikely(err)) {
895 mutex_lock(&inode->i_mutex); 895 mutex_lock(&inode->i_mutex);
896 err = __remove_suid(out->f_dentry, err); 896 err = __remove_suid(out->f_path.dentry, err);
897 mutex_unlock(&inode->i_mutex); 897 mutex_unlock(&inode->i_mutex);
898 if (err) 898 if (err)
899 return err; 899 return err;
@@ -1008,7 +1008,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
1008 * randomly drop data for eg socket -> socket splicing. Use the 1008 * randomly drop data for eg socket -> socket splicing. Use the
1009 * piped splicing for that! 1009 * piped splicing for that!
1010 */ 1010 */
1011 i_mode = in->f_dentry->d_inode->i_mode; 1011 i_mode = in->f_path.dentry->d_inode->i_mode;
1012 if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) 1012 if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode)))
1013 return -EINVAL; 1013 return -EINVAL;
1014 1014
@@ -1132,7 +1132,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
1132 loff_t offset, *off; 1132 loff_t offset, *off;
1133 long ret; 1133 long ret;
1134 1134
1135 pipe = pipe_info(in->f_dentry->d_inode); 1135 pipe = pipe_info(in->f_path.dentry->d_inode);
1136 if (pipe) { 1136 if (pipe) {
1137 if (off_in) 1137 if (off_in)
1138 return -ESPIPE; 1138 return -ESPIPE;
@@ -1153,7 +1153,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
1153 return ret; 1153 return ret;
1154 } 1154 }
1155 1155
1156 pipe = pipe_info(out->f_dentry->d_inode); 1156 pipe = pipe_info(out->f_path.dentry->d_inode);
1157 if (pipe) { 1157 if (pipe) {
1158 if (off_out) 1158 if (off_out)
1159 return -ESPIPE; 1159 return -ESPIPE;
@@ -1321,7 +1321,7 @@ static long do_vmsplice(struct file *file, const struct iovec __user *iov,
1321 .ops = &user_page_pipe_buf_ops, 1321 .ops = &user_page_pipe_buf_ops,
1322 }; 1322 };
1323 1323
1324 pipe = pipe_info(file->f_dentry->d_inode); 1324 pipe = pipe_info(file->f_path.dentry->d_inode);
1325 if (!pipe) 1325 if (!pipe)
1326 return -EBADF; 1326 return -EBADF;
1327 if (unlikely(nr_segs > UIO_MAXIOV)) 1327 if (unlikely(nr_segs > UIO_MAXIOV))
@@ -1549,8 +1549,8 @@ static int link_pipe(struct pipe_inode_info *ipipe,
1549static long do_tee(struct file *in, struct file *out, size_t len, 1549static long do_tee(struct file *in, struct file *out, size_t len,
1550 unsigned int flags) 1550 unsigned int flags)
1551{ 1551{
1552 struct pipe_inode_info *ipipe = pipe_info(in->f_dentry->d_inode); 1552 struct pipe_inode_info *ipipe = pipe_info(in->f_path.dentry->d_inode);
1553 struct pipe_inode_info *opipe = pipe_info(out->f_dentry->d_inode); 1553 struct pipe_inode_info *opipe = pipe_info(out->f_path.dentry->d_inode);
1554 int ret = -EINVAL; 1554 int ret = -EINVAL;
1555 1555
1556 /* 1556 /*
diff --git a/fs/stack.c b/fs/stack.c
new file mode 100644
index 000000000000..5ddbc34535f9
--- /dev/null
+++ b/fs/stack.c
@@ -0,0 +1,40 @@
1#include <linux/module.h>
2#include <linux/fs.h>
3#include <linux/fs_stack.h>
4
5/* does _NOT_ require i_mutex to be held.
6 *
7 * This function cannot be inlined since i_size_{read,write} is rather
8 * heavy-weight on 32-bit systems
9 */
10void fsstack_copy_inode_size(struct inode *dst, const struct inode *src)
11{
12 i_size_write(dst, i_size_read((struct inode *)src));
13 dst->i_blocks = src->i_blocks;
14}
15EXPORT_SYMBOL_GPL(fsstack_copy_inode_size);
16
17/* copy all attributes; get_nlinks is optional way to override the i_nlink
18 * copying
19 */
20void fsstack_copy_attr_all(struct inode *dest, const struct inode *src,
21 int (*get_nlinks)(struct inode *))
22{
23 if (!get_nlinks)
24 dest->i_nlink = src->i_nlink;
25 else
26 dest->i_nlink = (*get_nlinks)(dest);
27
28 dest->i_mode = src->i_mode;
29 dest->i_uid = src->i_uid;
30 dest->i_gid = src->i_gid;
31 dest->i_rdev = src->i_rdev;
32 dest->i_atime = src->i_atime;
33 dest->i_mtime = src->i_mtime;
34 dest->i_ctime = src->i_ctime;
35 dest->i_blkbits = src->i_blkbits;
36 dest->i_flags = src->i_flags;
37
38 fsstack_copy_inode_size(dest, src);
39}
40EXPORT_SYMBOL_GPL(fsstack_copy_attr_all);
diff --git a/fs/stat.c b/fs/stat.c
index a0ebfc7f8a64..38a8cb2a28de 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -102,7 +102,7 @@ int vfs_fstat(unsigned int fd, struct kstat *stat)
102 int error = -EBADF; 102 int error = -EBADF;
103 103
104 if (f) { 104 if (f) {
105 error = vfs_getattr(f->f_vfsmnt, f->f_dentry, stat); 105 error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat);
106 fput(f); 106 fput(f);
107 } 107 }
108 return error; 108 return error;
diff --git a/fs/super.c b/fs/super.c
index 84c320f6ad7e..f961e0307997 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -570,7 +570,7 @@ static void mark_files_ro(struct super_block *sb)
570 570
571 file_list_lock(); 571 file_list_lock();
572 list_for_each_entry(f, &sb->s_files, f_u.fu_list) { 572 list_for_each_entry(f, &sb->s_files, f_u.fu_list) {
573 if (S_ISREG(f->f_dentry->d_inode->i_mode) && file_count(f)) 573 if (S_ISREG(f->f_path.dentry->d_inode->i_mode) && file_count(f))
574 f->f_mode &= ~FMODE_WRITE; 574 f->f_mode &= ~FMODE_WRITE;
575 } 575 }
576 file_list_unlock(); 576 file_list_unlock();
diff --git a/fs/sync.c b/fs/sync.c
index 865f32be386e..d0feff61e6aa 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -94,7 +94,7 @@ long do_fsync(struct file *file, int datasync)
94 * livelocks in fsync_buffers_list(). 94 * livelocks in fsync_buffers_list().
95 */ 95 */
96 mutex_lock(&mapping->host->i_mutex); 96 mutex_lock(&mapping->host->i_mutex);
97 err = file->f_op->fsync(file, file->f_dentry, datasync); 97 err = file->f_op->fsync(file, file->f_path.dentry, datasync);
98 if (!ret) 98 if (!ret)
99 ret = err; 99 ret = err;
100 mutex_unlock(&mapping->host->i_mutex); 100 mutex_unlock(&mapping->host->i_mutex);
@@ -223,7 +223,7 @@ asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
223 if (!file) 223 if (!file)
224 goto out; 224 goto out;
225 225
226 i_mode = file->f_dentry->d_inode->i_mode; 226 i_mode = file->f_path.dentry->d_inode->i_mode;
227 ret = -ESPIPE; 227 ret = -ESPIPE;
228 if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) && 228 if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) &&
229 !S_ISLNK(i_mode)) 229 !S_ISLNK(i_mode))
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 98022e41cda1..e8f540d38d48 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -35,7 +35,7 @@ static ssize_t
35read(struct file * file, char __user * userbuf, size_t count, loff_t * off) 35read(struct file * file, char __user * userbuf, size_t count, loff_t * off)
36{ 36{
37 char *buffer = file->private_data; 37 char *buffer = file->private_data;
38 struct dentry *dentry = file->f_dentry; 38 struct dentry *dentry = file->f_path.dentry;
39 int size = dentry->d_inode->i_size; 39 int size = dentry->d_inode->i_size;
40 loff_t offs = *off; 40 loff_t offs = *off;
41 int ret; 41 int ret;
@@ -81,7 +81,7 @@ static ssize_t write(struct file * file, const char __user * userbuf,
81 size_t count, loff_t * off) 81 size_t count, loff_t * off)
82{ 82{
83 char *buffer = file->private_data; 83 char *buffer = file->private_data;
84 struct dentry *dentry = file->f_dentry; 84 struct dentry *dentry = file->f_path.dentry;
85 int size = dentry->d_inode->i_size; 85 int size = dentry->d_inode->i_size;
86 loff_t offs = *off; 86 loff_t offs = *off;
87 87
@@ -105,7 +105,7 @@ static ssize_t write(struct file * file, const char __user * userbuf,
105 105
106static int mmap(struct file *file, struct vm_area_struct *vma) 106static int mmap(struct file *file, struct vm_area_struct *vma)
107{ 107{
108 struct dentry *dentry = file->f_dentry; 108 struct dentry *dentry = file->f_path.dentry;
109 struct bin_attribute *attr = to_bin_attr(dentry); 109 struct bin_attribute *attr = to_bin_attr(dentry);
110 struct kobject *kobj = to_kobj(dentry->d_parent); 110 struct kobject *kobj = to_kobj(dentry->d_parent);
111 111
@@ -117,8 +117,8 @@ static int mmap(struct file *file, struct vm_area_struct *vma)
117 117
118static int open(struct inode * inode, struct file * file) 118static int open(struct inode * inode, struct file * file)
119{ 119{
120 struct kobject *kobj = sysfs_get_kobject(file->f_dentry->d_parent); 120 struct kobject *kobj = sysfs_get_kobject(file->f_path.dentry->d_parent);
121 struct bin_attribute * attr = to_bin_attr(file->f_dentry); 121 struct bin_attribute * attr = to_bin_attr(file->f_path.dentry);
122 int error = -EINVAL; 122 int error = -EINVAL;
123 123
124 if (!kobj || !attr) 124 if (!kobj || !attr)
@@ -153,8 +153,8 @@ static int open(struct inode * inode, struct file * file)
153 153
154static int release(struct inode * inode, struct file * file) 154static int release(struct inode * inode, struct file * file)
155{ 155{
156 struct kobject * kobj = to_kobj(file->f_dentry->d_parent); 156 struct kobject * kobj = to_kobj(file->f_path.dentry->d_parent);
157 struct bin_attribute * attr = to_bin_attr(file->f_dentry); 157 struct bin_attribute * attr = to_bin_attr(file->f_path.dentry);
158 u8 * buffer = file->private_data; 158 u8 * buffer = file->private_data;
159 159
160 if (kobj) 160 if (kobj)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index a5782e8c7f07..511edef8b321 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -419,7 +419,7 @@ out:
419 419
420static int sysfs_dir_open(struct inode *inode, struct file *file) 420static int sysfs_dir_open(struct inode *inode, struct file *file)
421{ 421{
422 struct dentry * dentry = file->f_dentry; 422 struct dentry * dentry = file->f_path.dentry;
423 struct sysfs_dirent * parent_sd = dentry->d_fsdata; 423 struct sysfs_dirent * parent_sd = dentry->d_fsdata;
424 424
425 mutex_lock(&dentry->d_inode->i_mutex); 425 mutex_lock(&dentry->d_inode->i_mutex);
@@ -432,7 +432,7 @@ static int sysfs_dir_open(struct inode *inode, struct file *file)
432 432
433static int sysfs_dir_close(struct inode *inode, struct file *file) 433static int sysfs_dir_close(struct inode *inode, struct file *file)
434{ 434{
435 struct dentry * dentry = file->f_dentry; 435 struct dentry * dentry = file->f_path.dentry;
436 struct sysfs_dirent * cursor = file->private_data; 436 struct sysfs_dirent * cursor = file->private_data;
437 437
438 mutex_lock(&dentry->d_inode->i_mutex); 438 mutex_lock(&dentry->d_inode->i_mutex);
@@ -452,7 +452,7 @@ static inline unsigned char dt_type(struct sysfs_dirent *sd)
452 452
453static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) 453static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
454{ 454{
455 struct dentry *dentry = filp->f_dentry; 455 struct dentry *dentry = filp->f_path.dentry;
456 struct sysfs_dirent * parent_sd = dentry->d_fsdata; 456 struct sysfs_dirent * parent_sd = dentry->d_fsdata;
457 struct sysfs_dirent *cursor = filp->private_data; 457 struct sysfs_dirent *cursor = filp->private_data;
458 struct list_head *p, *q = &cursor->s_sibling; 458 struct list_head *p, *q = &cursor->s_sibling;
@@ -509,7 +509,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
509 509
510static loff_t sysfs_dir_lseek(struct file * file, loff_t offset, int origin) 510static loff_t sysfs_dir_lseek(struct file * file, loff_t offset, int origin)
511{ 511{
512 struct dentry * dentry = file->f_dentry; 512 struct dentry * dentry = file->f_path.dentry;
513 513
514 mutex_lock(&dentry->d_inode->i_mutex); 514 mutex_lock(&dentry->d_inode->i_mutex);
515 switch (origin) { 515 switch (origin) {
@@ -519,7 +519,7 @@ static loff_t sysfs_dir_lseek(struct file * file, loff_t offset, int origin)
519 if (offset >= 0) 519 if (offset >= 0)
520 break; 520 break;
521 default: 521 default:
522 mutex_unlock(&file->f_dentry->d_inode->i_mutex); 522 mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
523 return -EINVAL; 523 return -EINVAL;
524 } 524 }
525 if (offset != file->f_pos) { 525 if (offset != file->f_pos) {
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 95c165101c98..9cfe53e1e00d 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -154,7 +154,7 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
154 154
155 down(&buffer->sem); 155 down(&buffer->sem);
156 if (buffer->needs_read_fill) { 156 if (buffer->needs_read_fill) {
157 if ((retval = fill_read_buffer(file->f_dentry,buffer))) 157 if ((retval = fill_read_buffer(file->f_path.dentry,buffer)))
158 goto out; 158 goto out;
159 } 159 }
160 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n", 160 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
@@ -245,7 +245,7 @@ sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t
245 down(&buffer->sem); 245 down(&buffer->sem);
246 len = fill_write_buffer(buffer, buf, count); 246 len = fill_write_buffer(buffer, buf, count);
247 if (len > 0) 247 if (len > 0)
248 len = flush_write_buffer(file->f_dentry, buffer, len); 248 len = flush_write_buffer(file->f_path.dentry, buffer, len);
249 if (len > 0) 249 if (len > 0)
250 *ppos += len; 250 *ppos += len;
251 up(&buffer->sem); 251 up(&buffer->sem);
@@ -254,8 +254,8 @@ sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t
254 254
255static int check_perm(struct inode * inode, struct file * file) 255static int check_perm(struct inode * inode, struct file * file)
256{ 256{
257 struct kobject *kobj = sysfs_get_kobject(file->f_dentry->d_parent); 257 struct kobject *kobj = sysfs_get_kobject(file->f_path.dentry->d_parent);
258 struct attribute * attr = to_attr(file->f_dentry); 258 struct attribute * attr = to_attr(file->f_path.dentry);
259 struct sysfs_buffer * buffer; 259 struct sysfs_buffer * buffer;
260 struct sysfs_ops * ops = NULL; 260 struct sysfs_ops * ops = NULL;
261 int error = 0; 261 int error = 0;
@@ -337,8 +337,8 @@ static int sysfs_open_file(struct inode * inode, struct file * filp)
337 337
338static int sysfs_release(struct inode * inode, struct file * filp) 338static int sysfs_release(struct inode * inode, struct file * filp)
339{ 339{
340 struct kobject * kobj = to_kobj(filp->f_dentry->d_parent); 340 struct kobject * kobj = to_kobj(filp->f_path.dentry->d_parent);
341 struct attribute * attr = to_attr(filp->f_dentry); 341 struct attribute * attr = to_attr(filp->f_path.dentry);
342 struct module * owner = attr->owner; 342 struct module * owner = attr->owner;
343 struct sysfs_buffer * buffer = filp->private_data; 343 struct sysfs_buffer * buffer = filp->private_data;
344 344
@@ -372,8 +372,8 @@ static int sysfs_release(struct inode * inode, struct file * filp)
372static unsigned int sysfs_poll(struct file *filp, poll_table *wait) 372static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
373{ 373{
374 struct sysfs_buffer * buffer = filp->private_data; 374 struct sysfs_buffer * buffer = filp->private_data;
375 struct kobject * kobj = to_kobj(filp->f_dentry->d_parent); 375 struct kobject * kobj = to_kobj(filp->f_path.dentry->d_parent);
376 struct sysfs_dirent * sd = filp->f_dentry->d_fsdata; 376 struct sysfs_dirent * sd = filp->f_path.dentry->d_fsdata;
377 int res = 0; 377 int res = 0;
378 378
379 poll_wait(filp, &kobj->poll, wait); 379 poll_wait(filp, &kobj->poll, wait);
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index f2bef962d309..ebf7007fa161 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -70,7 +70,7 @@ fail:
70static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) 70static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir)
71{ 71{
72 unsigned long pos = filp->f_pos; 72 unsigned long pos = filp->f_pos;
73 struct inode *inode = filp->f_dentry->d_inode; 73 struct inode *inode = filp->f_path.dentry->d_inode;
74 struct super_block *sb = inode->i_sb; 74 struct super_block *sb = inode->i_sb;
75 unsigned offset = pos & ~PAGE_CACHE_MASK; 75 unsigned offset = pos & ~PAGE_CACHE_MASK;
76 unsigned long n = pos >> PAGE_CACHE_SHIFT; 76 unsigned long n = pos >> PAGE_CACHE_SHIFT;
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 8c28efa3b8ff..2391c9150c49 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -77,7 +77,7 @@ const struct file_operations udf_dir_operations = {
77 77
78int udf_readdir(struct file *filp, void *dirent, filldir_t filldir) 78int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
79{ 79{
80 struct inode *dir = filp->f_dentry->d_inode; 80 struct inode *dir = filp->f_path.dentry->d_inode;
81 int result; 81 int result;
82 82
83 lock_kernel(); 83 lock_kernel();
@@ -225,7 +225,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
225 225
226 if ( cfi.fileCharacteristics & FID_FILE_CHAR_PARENT ) 226 if ( cfi.fileCharacteristics & FID_FILE_CHAR_PARENT )
227 { 227 {
228 iblock = parent_ino(filp->f_dentry); 228 iblock = parent_ino(filp->f_path.dentry);
229 flen = 2; 229 flen = 2;
230 memcpy(fname, "..", flen); 230 memcpy(fname, "..", flen);
231 dt_type = DT_DIR; 231 dt_type = DT_DIR;
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 7aedd552cba1..d81f2db7b0e3 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -108,7 +108,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
108{ 108{
109 ssize_t retval; 109 ssize_t retval;
110 struct file *file = iocb->ki_filp; 110 struct file *file = iocb->ki_filp;
111 struct inode *inode = file->f_dentry->d_inode; 111 struct inode *inode = file->f_path.dentry->d_inode;
112 int err, pos; 112 int err, pos;
113 size_t count = iocb->ki_left; 113 size_t count = iocb->ki_left;
114 114
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 7f0a0aa63584..433b6f68403a 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -426,7 +426,7 @@ static int
426ufs_readdir(struct file *filp, void *dirent, filldir_t filldir) 426ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
427{ 427{
428 loff_t pos = filp->f_pos; 428 loff_t pos = filp->f_pos;
429 struct inode *inode = filp->f_dentry->d_inode; 429 struct inode *inode = filp->f_path.dentry->d_inode;
430 struct super_block *sb = inode->i_sb; 430 struct super_block *sb = inode->i_sb;
431 unsigned int offset = pos & ~PAGE_CACHE_MASK; 431 unsigned int offset = pos & ~PAGE_CACHE_MASK;
432 unsigned long n = pos >> PAGE_CACHE_SHIFT; 432 unsigned long n = pos >> PAGE_CACHE_SHIFT;
diff --git a/fs/xattr.c b/fs/xattr.c
index 0901bdc2ce24..38646132ab0e 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -268,7 +268,7 @@ sys_fsetxattr(int fd, char __user *name, void __user *value,
268 f = fget(fd); 268 f = fget(fd);
269 if (!f) 269 if (!f)
270 return error; 270 return error;
271 dentry = f->f_dentry; 271 dentry = f->f_path.dentry;
272 audit_inode(NULL, dentry->d_inode); 272 audit_inode(NULL, dentry->d_inode);
273 error = setxattr(dentry, name, value, size, flags); 273 error = setxattr(dentry, name, value, size, flags);
274 fput(f); 274 fput(f);
@@ -351,7 +351,7 @@ sys_fgetxattr(int fd, char __user *name, void __user *value, size_t size)
351 f = fget(fd); 351 f = fget(fd);
352 if (!f) 352 if (!f)
353 return error; 353 return error;
354 error = getxattr(f->f_dentry, name, value, size); 354 error = getxattr(f->f_path.dentry, name, value, size);
355 fput(f); 355 fput(f);
356 return error; 356 return error;
357} 357}
@@ -423,7 +423,7 @@ sys_flistxattr(int fd, char __user *list, size_t size)
423 f = fget(fd); 423 f = fget(fd);
424 if (!f) 424 if (!f)
425 return error; 425 return error;
426 error = listxattr(f->f_dentry, list, size); 426 error = listxattr(f->f_path.dentry, list, size);
427 fput(f); 427 fput(f);
428 return error; 428 return error;
429} 429}
@@ -484,7 +484,7 @@ sys_fremovexattr(int fd, char __user *name)
484 f = fget(fd); 484 f = fget(fd);
485 if (!f) 485 if (!f)
486 return error; 486 return error;
487 dentry = f->f_dentry; 487 dentry = f->f_path.dentry;
488 audit_inode(NULL, dentry->d_inode); 488 audit_inode(NULL, dentry->d_inode);
489 error = removexattr(dentry, name); 489 error = removexattr(dentry, name);
490 fput(f); 490 fput(f);
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 8e6b56fc1cad..b56eb754e2d2 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1406,7 +1406,7 @@ xfs_vm_direct_IO(
1406 xfs_end_io_direct); 1406 xfs_end_io_direct);
1407 } 1407 }
1408 1408
1409 if (unlikely(ret <= 0 && iocb->private)) 1409 if (unlikely(ret != -EIOCBQUEUED && iocb->private))
1410 xfs_destroy_ioend(iocb->private); 1410 xfs_destroy_ioend(iocb->private);
1411 return ret; 1411 return ret;
1412} 1412}
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index d93d8dd1958d..d26f5cd2ba70 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -55,7 +55,7 @@ __xfs_file_read(
55 loff_t pos) 55 loff_t pos)
56{ 56{
57 struct file *file = iocb->ki_filp; 57 struct file *file = iocb->ki_filp;
58 bhv_vnode_t *vp = vn_from_inode(file->f_dentry->d_inode); 58 bhv_vnode_t *vp = vn_from_inode(file->f_path.dentry->d_inode);
59 59
60 BUG_ON(iocb->ki_pos != pos); 60 BUG_ON(iocb->ki_pos != pos);
61 if (unlikely(file->f_flags & O_DIRECT)) 61 if (unlikely(file->f_flags & O_DIRECT))
@@ -131,7 +131,7 @@ xfs_file_sendfile(
131 read_actor_t actor, 131 read_actor_t actor,
132 void *target) 132 void *target)
133{ 133{
134 return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode), 134 return bhv_vop_sendfile(vn_from_inode(filp->f_path.dentry->d_inode),
135 filp, pos, 0, count, actor, target, NULL); 135 filp, pos, 0, count, actor, target, NULL);
136} 136}
137 137
@@ -143,7 +143,7 @@ xfs_file_sendfile_invis(
143 read_actor_t actor, 143 read_actor_t actor,
144 void *target) 144 void *target)
145{ 145{
146 return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode), 146 return bhv_vop_sendfile(vn_from_inode(filp->f_path.dentry->d_inode),
147 filp, pos, IO_INVIS, count, actor, target, NULL); 147 filp, pos, IO_INVIS, count, actor, target, NULL);
148} 148}
149 149
@@ -155,7 +155,7 @@ xfs_file_splice_read(
155 size_t len, 155 size_t len,
156 unsigned int flags) 156 unsigned int flags)
157{ 157{
158 return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode), 158 return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
159 infilp, ppos, pipe, len, flags, 0, NULL); 159 infilp, ppos, pipe, len, flags, 0, NULL);
160} 160}
161 161
@@ -167,7 +167,7 @@ xfs_file_splice_read_invis(
167 size_t len, 167 size_t len,
168 unsigned int flags) 168 unsigned int flags)
169{ 169{
170 return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode), 170 return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
171 infilp, ppos, pipe, len, flags, IO_INVIS, 171 infilp, ppos, pipe, len, flags, IO_INVIS,
172 NULL); 172 NULL);
173} 173}
@@ -180,7 +180,7 @@ xfs_file_splice_write(
180 size_t len, 180 size_t len,
181 unsigned int flags) 181 unsigned int flags)
182{ 182{
183 return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode), 183 return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
184 pipe, outfilp, ppos, len, flags, 0, NULL); 184 pipe, outfilp, ppos, len, flags, 0, NULL);
185} 185}
186 186
@@ -192,7 +192,7 @@ xfs_file_splice_write_invis(
192 size_t len, 192 size_t len,
193 unsigned int flags) 193 unsigned int flags)
194{ 194{
195 return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode), 195 return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
196 pipe, outfilp, ppos, len, flags, IO_INVIS, 196 pipe, outfilp, ppos, len, flags, IO_INVIS,
197 NULL); 197 NULL);
198} 198}
@@ -212,7 +212,7 @@ xfs_file_close(
212 struct file *filp, 212 struct file *filp,
213 fl_owner_t id) 213 fl_owner_t id)
214{ 214{
215 return -bhv_vop_close(vn_from_inode(filp->f_dentry->d_inode), 0, 215 return -bhv_vop_close(vn_from_inode(filp->f_path.dentry->d_inode), 0,
216 file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL); 216 file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL);
217} 217}
218 218
@@ -251,7 +251,7 @@ xfs_vm_nopage(
251 unsigned long address, 251 unsigned long address,
252 int *type) 252 int *type)
253{ 253{
254 struct inode *inode = area->vm_file->f_dentry->d_inode; 254 struct inode *inode = area->vm_file->f_path.dentry->d_inode;
255 bhv_vnode_t *vp = vn_from_inode(inode); 255 bhv_vnode_t *vp = vn_from_inode(inode);
256 256
257 ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI); 257 ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
@@ -268,7 +268,7 @@ xfs_file_readdir(
268 filldir_t filldir) 268 filldir_t filldir)
269{ 269{
270 int error = 0; 270 int error = 0;
271 bhv_vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); 271 bhv_vnode_t *vp = vn_from_inode(filp->f_path.dentry->d_inode);
272 uio_t uio; 272 uio_t uio;
273 iovec_t iov; 273 iovec_t iov;
274 int eof = 0; 274 int eof = 0;
@@ -345,7 +345,7 @@ xfs_file_mmap(
345 vma->vm_ops = &xfs_file_vm_ops; 345 vma->vm_ops = &xfs_file_vm_ops;
346 346
347#ifdef CONFIG_XFS_DMAPI 347#ifdef CONFIG_XFS_DMAPI
348 if (vn_from_inode(filp->f_dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI) 348 if (vn_from_inode(filp->f_path.dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI)
349 vma->vm_ops = &xfs_dmapi_file_vm_ops; 349 vma->vm_ops = &xfs_dmapi_file_vm_ops;
350#endif /* CONFIG_XFS_DMAPI */ 350#endif /* CONFIG_XFS_DMAPI */
351 351
@@ -360,7 +360,7 @@ xfs_file_ioctl(
360 unsigned long p) 360 unsigned long p)
361{ 361{
362 int error; 362 int error;
363 struct inode *inode = filp->f_dentry->d_inode; 363 struct inode *inode = filp->f_path.dentry->d_inode;
364 bhv_vnode_t *vp = vn_from_inode(inode); 364 bhv_vnode_t *vp = vn_from_inode(inode);
365 365
366 error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p); 366 error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p);
@@ -382,7 +382,7 @@ xfs_file_ioctl_invis(
382 unsigned long p) 382 unsigned long p)
383{ 383{
384 int error; 384 int error;
385 struct inode *inode = filp->f_dentry->d_inode; 385 struct inode *inode = filp->f_path.dentry->d_inode;
386 bhv_vnode_t *vp = vn_from_inode(inode); 386 bhv_vnode_t *vp = vn_from_inode(inode);
387 387
388 error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p); 388 error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p);
@@ -404,7 +404,7 @@ xfs_vm_mprotect(
404 struct vm_area_struct *vma, 404 struct vm_area_struct *vma,
405 unsigned int newflags) 405 unsigned int newflags)
406{ 406{
407 bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode); 407 bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_path.dentry->d_inode);
408 int error = 0; 408 int error = 0;
409 409
410 if (vp->v_vfsp->vfs_flag & VFS_DMI) { 410 if (vp->v_vfsp->vfs_flag & VFS_DMI) {
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 74d094829a4d..f011c9cd0d62 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -107,9 +107,9 @@ xfs_find_handle(
107 if (!file) 107 if (!file)
108 return -EBADF; 108 return -EBADF;
109 109
110 ASSERT(file->f_dentry); 110 ASSERT(file->f_path.dentry);
111 ASSERT(file->f_dentry->d_inode); 111 ASSERT(file->f_path.dentry->d_inode);
112 inode = igrab(file->f_dentry->d_inode); 112 inode = igrab(file->f_path.dentry->d_inode);
113 fput(file); 113 fput(file);
114 break; 114 break;
115 } 115 }
@@ -333,10 +333,10 @@ xfs_open_by_handle(
333 } 333 }
334 334
335 /* Ensure umount returns EBUSY on umounts while this file is open. */ 335 /* Ensure umount returns EBUSY on umounts while this file is open. */
336 mntget(parfilp->f_vfsmnt); 336 mntget(parfilp->f_path.mnt);
337 337
338 /* Create file pointer. */ 338 /* Create file pointer. */
339 filp = dentry_open(dentry, parfilp->f_vfsmnt, hreq.oflags); 339 filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags);
340 if (IS_ERR(filp)) { 340 if (IS_ERR(filp)) {
341 put_unused_fd(new_fd); 341 put_unused_fd(new_fd);
342 return -XFS_ERROR(-PTR_ERR(filp)); 342 return -XFS_ERROR(-PTR_ERR(filp));
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index 270db0f3861d..b83cebc165f1 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -112,7 +112,7 @@ xfs_compat_ioctl(
112 unsigned cmd, 112 unsigned cmd,
113 unsigned long arg) 113 unsigned long arg)
114{ 114{
115 struct inode *inode = file->f_dentry->d_inode; 115 struct inode *inode = file->f_path.dentry->d_inode;
116 bhv_vnode_t *vp = vn_from_inode(inode); 116 bhv_vnode_t *vp = vn_from_inode(inode);
117 int error; 117 int error;
118 118
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index fa842f1c9fa2..65e79b471d49 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -805,7 +805,7 @@ start:
805 !capable(CAP_FSETID)) { 805 !capable(CAP_FSETID)) {
806 error = xfs_write_clear_setuid(xip); 806 error = xfs_write_clear_setuid(xip);
807 if (likely(!error)) 807 if (likely(!error))
808 error = -remove_suid(file->f_dentry); 808 error = -remove_suid(file->f_path.dentry);
809 if (unlikely(error)) { 809 if (unlikely(error)) {
810 xfs_iunlock(xip, iolock); 810 xfs_iunlock(xip, iolock);
811 goto out_unlock_mutex; 811 goto out_unlock_mutex;
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 80562b60fb95..50d0faea371d 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -71,7 +71,7 @@ xfs_swapext(
71 71
72 /* Pull information for the target fd */ 72 /* Pull information for the target fd */
73 if (((fp = fget((int)sxp->sx_fdtarget)) == NULL) || 73 if (((fp = fget((int)sxp->sx_fdtarget)) == NULL) ||
74 ((vp = vn_from_inode(fp->f_dentry->d_inode)) == NULL)) { 74 ((vp = vn_from_inode(fp->f_path.dentry->d_inode)) == NULL)) {
75 error = XFS_ERROR(EINVAL); 75 error = XFS_ERROR(EINVAL);
76 goto error0; 76 goto error0;
77 } 77 }
@@ -83,7 +83,7 @@ xfs_swapext(
83 } 83 }
84 84
85 if (((tfp = fget((int)sxp->sx_fdtmp)) == NULL) || 85 if (((tfp = fget((int)sxp->sx_fdtmp)) == NULL) ||
86 ((tvp = vn_from_inode(tfp->f_dentry->d_inode)) == NULL)) { 86 ((tvp = vn_from_inode(tfp->f_path.dentry->d_inode)) == NULL)) {
87 error = XFS_ERROR(EINVAL); 87 error = XFS_ERROR(EINVAL);
88 goto error0; 88 goto error0;
89 } 89 }