diff options
383 files changed, 1276 insertions, 1423 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index f48e0c6b4c42..0706d32a61e6 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -10,6 +10,7 @@ be able to use diff(1). | |||
10 | --------------------------- dentry_operations -------------------------- | 10 | --------------------------- dentry_operations -------------------------- |
11 | prototypes: | 11 | prototypes: |
12 | int (*d_revalidate)(struct dentry *, unsigned int); | 12 | int (*d_revalidate)(struct dentry *, unsigned int); |
13 | int (*d_weak_revalidate)(struct dentry *, unsigned int); | ||
13 | int (*d_hash)(const struct dentry *, const struct inode *, | 14 | int (*d_hash)(const struct dentry *, const struct inode *, |
14 | struct qstr *); | 15 | struct qstr *); |
15 | int (*d_compare)(const struct dentry *, const struct inode *, | 16 | int (*d_compare)(const struct dentry *, const struct inode *, |
@@ -25,6 +26,7 @@ prototypes: | |||
25 | locking rules: | 26 | locking rules: |
26 | rename_lock ->d_lock may block rcu-walk | 27 | rename_lock ->d_lock may block rcu-walk |
27 | d_revalidate: no no yes (ref-walk) maybe | 28 | d_revalidate: no no yes (ref-walk) maybe |
29 | d_weak_revalidate:no no yes no | ||
28 | d_hash no no no maybe | 30 | d_hash no no no maybe |
29 | d_compare: yes no no maybe | 31 | d_compare: yes no no maybe |
30 | d_delete: no yes no no | 32 | d_delete: no yes no no |
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index 0472c31c163b..4db22f6491e0 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
@@ -441,3 +441,7 @@ d_make_root() drops the reference to inode if dentry allocation fails. | |||
441 | two, it gets "is it an O_EXCL or equivalent?" boolean argument. Note that | 441 | two, it gets "is it an O_EXCL or equivalent?" boolean argument. Note that |
442 | local filesystems can ignore tha argument - they are guaranteed that the | 442 | local filesystems can ignore tha argument - they are guaranteed that the |
443 | object doesn't exist. It's remote/distributed ones that might care... | 443 | object doesn't exist. It's remote/distributed ones that might care... |
444 | -- | ||
445 | [mandatory] | ||
446 | FS_REVAL_DOT is gone; if you used to have it, add ->d_weak_revalidate() | ||
447 | in your dentry operations instead. | ||
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index e3869098163e..bc4b06b3160a 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -900,6 +900,7 @@ defined: | |||
900 | 900 | ||
901 | struct dentry_operations { | 901 | struct dentry_operations { |
902 | int (*d_revalidate)(struct dentry *, unsigned int); | 902 | int (*d_revalidate)(struct dentry *, unsigned int); |
903 | int (*d_weak_revalidate)(struct dentry *, unsigned int); | ||
903 | int (*d_hash)(const struct dentry *, const struct inode *, | 904 | int (*d_hash)(const struct dentry *, const struct inode *, |
904 | struct qstr *); | 905 | struct qstr *); |
905 | int (*d_compare)(const struct dentry *, const struct inode *, | 906 | int (*d_compare)(const struct dentry *, const struct inode *, |
@@ -915,8 +916,13 @@ struct dentry_operations { | |||
915 | 916 | ||
916 | d_revalidate: called when the VFS needs to revalidate a dentry. This | 917 | d_revalidate: called when the VFS needs to revalidate a dentry. This |
917 | is called whenever a name look-up finds a dentry in the | 918 | is called whenever a name look-up finds a dentry in the |
918 | dcache. Most filesystems leave this as NULL, because all their | 919 | dcache. Most local filesystems leave this as NULL, because all their |
919 | dentries in the dcache are valid | 920 | dentries in the dcache are valid. Network filesystems are different |
921 | since things can change on the server without the client necessarily | ||
922 | being aware of it. | ||
923 | |||
924 | This function should return a positive value if the dentry is still | ||
925 | valid, and zero or a negative error code if it isn't. | ||
920 | 926 | ||
921 | d_revalidate may be called in rcu-walk mode (flags & LOOKUP_RCU). | 927 | d_revalidate may be called in rcu-walk mode (flags & LOOKUP_RCU). |
922 | If in rcu-walk mode, the filesystem must revalidate the dentry without | 928 | If in rcu-walk mode, the filesystem must revalidate the dentry without |
@@ -927,6 +933,20 @@ struct dentry_operations { | |||
927 | If a situation is encountered that rcu-walk cannot handle, return | 933 | If a situation is encountered that rcu-walk cannot handle, return |
928 | -ECHILD and it will be called again in ref-walk mode. | 934 | -ECHILD and it will be called again in ref-walk mode. |
929 | 935 | ||
936 | d_weak_revalidate: called when the VFS needs to revalidate a "jumped" dentry. | ||
937 | This is called when a path-walk ends at dentry that was not acquired by | ||
938 | doing a lookup in the parent directory. This includes "/", "." and "..", | ||
939 | as well as procfs-style symlinks and mountpoint traversal. | ||
940 | |||
941 | In this case, we are less concerned with whether the dentry is still | ||
942 | fully correct, but rather that the inode is still valid. As with | ||
943 | d_revalidate, most local filesystems will set this to NULL since their | ||
944 | dcache entries are always valid. | ||
945 | |||
946 | This function has the same return code semantics as d_revalidate. | ||
947 | |||
948 | d_weak_revalidate is only called after leaving rcu-walk mode. | ||
949 | |||
930 | d_hash: called when the VFS adds a dentry to the hash table. The first | 950 | d_hash: called when the VFS adds a dentry to the hash table. The first |
931 | dentry passed to d_hash is the parent directory that the name is | 951 | dentry passed to d_hash is the parent directory that the name is |
932 | to be hashed into. The inode is the dentry's inode. | 952 | to be hashed into. The inode is the dentry's inode. |
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c index b9fc6c309d2e..e64559f0a82d 100644 --- a/arch/alpha/kernel/srm_env.c +++ b/arch/alpha/kernel/srm_env.c | |||
@@ -111,7 +111,7 @@ static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer, | |||
111 | size_t count, loff_t *pos) | 111 | size_t count, loff_t *pos) |
112 | { | 112 | { |
113 | int res; | 113 | int res; |
114 | srm_env_t *entry = PDE(file->f_path.dentry->d_inode)->data; | 114 | srm_env_t *entry = PDE(file_inode(file))->data; |
115 | char *buf = (char *) __get_free_page(GFP_USER); | 115 | char *buf = (char *) __get_free_page(GFP_USER); |
116 | unsigned long ret1, ret2; | 116 | unsigned long ret1, ret2; |
117 | 117 | ||
diff --git a/arch/avr32/include/asm/elf.h b/arch/avr32/include/asm/elf.h index e2c328739808..d232888b99d5 100644 --- a/arch/avr32/include/asm/elf.h +++ b/arch/avr32/include/asm/elf.h | |||
@@ -102,7 +102,4 @@ typedef struct user_fpu_struct elf_fpregset_t; | |||
102 | 102 | ||
103 | #define ELF_PLATFORM (NULL) | 103 | #define ELF_PLATFORM (NULL) |
104 | 104 | ||
105 | #define SET_PERSONALITY(ex) \ | ||
106 | set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))) | ||
107 | |||
108 | #endif /* __ASM_AVR32_ELF_H */ | 105 | #endif /* __ASM_AVR32_ELF_H */ |
diff --git a/arch/blackfin/include/asm/elf.h b/arch/blackfin/include/asm/elf.h index 14bc98ff668f..d15cb9b5d52c 100644 --- a/arch/blackfin/include/asm/elf.h +++ b/arch/blackfin/include/asm/elf.h | |||
@@ -132,7 +132,4 @@ do { \ | |||
132 | 132 | ||
133 | #define ELF_PLATFORM (NULL) | 133 | #define ELF_PLATFORM (NULL) |
134 | 134 | ||
135 | #define SET_PERSONALITY(ex) \ | ||
136 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
137 | |||
138 | #endif | 135 | #endif |
diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c index 0bdaa517a501..e1d0b24c6070 100644 --- a/arch/blackfin/kernel/cplbinfo.c +++ b/arch/blackfin/kernel/cplbinfo.c | |||
@@ -116,7 +116,7 @@ static const struct seq_operations cplbinfo_sops = { | |||
116 | 116 | ||
117 | static int cplbinfo_open(struct inode *inode, struct file *file) | 117 | static int cplbinfo_open(struct inode *inode, struct file *file) |
118 | { | 118 | { |
119 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 119 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
120 | char cplb_type; | 120 | char cplb_type; |
121 | unsigned int cpu; | 121 | unsigned int cpu; |
122 | int ret; | 122 | int ret; |
diff --git a/arch/c6x/include/asm/elf.h b/arch/c6x/include/asm/elf.h index 32b997126adf..9a4dfc5eb249 100644 --- a/arch/c6x/include/asm/elf.h +++ b/arch/c6x/include/asm/elf.h | |||
@@ -77,9 +77,6 @@ do { \ | |||
77 | 77 | ||
78 | #define ELF_PLATFORM (NULL) | 78 | #define ELF_PLATFORM (NULL) |
79 | 79 | ||
80 | #define SET_PERSONALITY(ex) \ | ||
81 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
82 | |||
83 | /* C6X specific section types */ | 80 | /* C6X specific section types */ |
84 | #define SHT_C6000_UNWIND 0x70000001 | 81 | #define SHT_C6000_UNWIND 0x70000001 |
85 | #define SHT_C6000_PREEMPTMAP 0x70000002 | 82 | #define SHT_C6000_PREEMPTMAP 0x70000002 |
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c index c4b71710fb0e..a1c498d18d31 100644 --- a/arch/cris/arch-v10/drivers/sync_serial.c +++ b/arch/cris/arch-v10/drivers/sync_serial.c | |||
@@ -654,7 +654,7 @@ static int sync_serial_release(struct inode *inode, struct file *file) | |||
654 | 654 | ||
655 | static unsigned int sync_serial_poll(struct file *file, poll_table *wait) | 655 | static unsigned int sync_serial_poll(struct file *file, poll_table *wait) |
656 | { | 656 | { |
657 | int dev = MINOR(file->f_dentry->d_inode->i_rdev); | 657 | int dev = MINOR(file_inode(file)->i_rdev); |
658 | unsigned int mask = 0; | 658 | unsigned int mask = 0; |
659 | struct sync_port *port; | 659 | struct sync_port *port; |
660 | DEBUGPOLL(static unsigned int prev_mask = 0); | 660 | DEBUGPOLL(static unsigned int prev_mask = 0); |
@@ -685,7 +685,7 @@ static int sync_serial_ioctl_unlocked(struct file *file, | |||
685 | int return_val = 0; | 685 | int return_val = 0; |
686 | unsigned long flags; | 686 | unsigned long flags; |
687 | 687 | ||
688 | int dev = MINOR(file->f_dentry->d_inode->i_rdev); | 688 | int dev = MINOR(file_inode(file)->i_rdev); |
689 | struct sync_port *port; | 689 | struct sync_port *port; |
690 | 690 | ||
691 | if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) { | 691 | if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) { |
@@ -973,7 +973,7 @@ static long sync_serial_ioctl(struct file *file, | |||
973 | static ssize_t sync_serial_write(struct file *file, const char *buf, | 973 | static ssize_t sync_serial_write(struct file *file, const char *buf, |
974 | size_t count, loff_t *ppos) | 974 | size_t count, loff_t *ppos) |
975 | { | 975 | { |
976 | int dev = MINOR(file->f_dentry->d_inode->i_rdev); | 976 | int dev = MINOR(file_inode(file)->i_rdev); |
977 | DECLARE_WAITQUEUE(wait, current); | 977 | DECLARE_WAITQUEUE(wait, current); |
978 | struct sync_port *port; | 978 | struct sync_port *port; |
979 | unsigned long flags; | 979 | unsigned long flags; |
@@ -1097,7 +1097,7 @@ static ssize_t sync_serial_write(struct file *file, const char *buf, | |||
1097 | static ssize_t sync_serial_read(struct file *file, char *buf, | 1097 | static ssize_t sync_serial_read(struct file *file, char *buf, |
1098 | size_t count, loff_t *ppos) | 1098 | size_t count, loff_t *ppos) |
1099 | { | 1099 | { |
1100 | int dev = MINOR(file->f_dentry->d_inode->i_rdev); | 1100 | int dev = MINOR(file_inode(file)->i_rdev); |
1101 | int avail; | 1101 | int avail; |
1102 | struct sync_port *port; | 1102 | struct sync_port *port; |
1103 | unsigned char *start; | 1103 | unsigned char *start; |
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c index f8476d9e856b..877da1908234 100644 --- a/arch/cris/arch-v32/drivers/cryptocop.c +++ b/arch/cris/arch-v32/drivers/cryptocop.c | |||
@@ -3135,11 +3135,10 @@ static long cryptocop_ioctl_unlocked(struct inode *inode, | |||
3135 | static long | 3135 | static long |
3136 | cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 3136 | cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
3137 | { | 3137 | { |
3138 | struct inode *inode = file->f_path.dentry->d_inode; | ||
3139 | long ret; | 3138 | long ret; |
3140 | 3139 | ||
3141 | mutex_lock(&cryptocop_mutex); | 3140 | mutex_lock(&cryptocop_mutex); |
3142 | ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg); | 3141 | ret = cryptocop_ioctl_unlocked(file_inode(filp), filp, cmd, arg); |
3143 | mutex_unlock(&cryptocop_mutex); | 3142 | mutex_unlock(&cryptocop_mutex); |
3144 | 3143 | ||
3145 | return ret; | 3144 | return ret; |
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c index a6a180bc566f..219f704e3221 100644 --- a/arch/cris/arch-v32/drivers/sync_serial.c +++ b/arch/cris/arch-v32/drivers/sync_serial.c | |||
@@ -609,7 +609,7 @@ static int sync_serial_release(struct inode *inode, struct file *file) | |||
609 | 609 | ||
610 | static unsigned int sync_serial_poll(struct file *file, poll_table *wait) | 610 | static unsigned int sync_serial_poll(struct file *file, poll_table *wait) |
611 | { | 611 | { |
612 | int dev = iminor(file->f_path.dentry->d_inode); | 612 | int dev = iminor(file_inode(file)); |
613 | unsigned int mask = 0; | 613 | unsigned int mask = 0; |
614 | sync_port *port; | 614 | sync_port *port; |
615 | DEBUGPOLL( static unsigned int prev_mask = 0; ); | 615 | DEBUGPOLL( static unsigned int prev_mask = 0; ); |
@@ -657,7 +657,7 @@ static int sync_serial_ioctl(struct file *file, | |||
657 | { | 657 | { |
658 | int return_val = 0; | 658 | int return_val = 0; |
659 | int dma_w_size = regk_dma_set_w_size1; | 659 | int dma_w_size = regk_dma_set_w_size1; |
660 | int dev = iminor(file->f_path.dentry->d_inode); | 660 | int dev = iminor(file_inode(file)); |
661 | sync_port *port; | 661 | sync_port *port; |
662 | reg_sser_rw_tr_cfg tr_cfg; | 662 | reg_sser_rw_tr_cfg tr_cfg; |
663 | reg_sser_rw_rec_cfg rec_cfg; | 663 | reg_sser_rw_rec_cfg rec_cfg; |
@@ -979,7 +979,7 @@ static long sync_serial_ioctl(struct file *file, | |||
979 | static ssize_t sync_serial_write(struct file *file, const char *buf, | 979 | static ssize_t sync_serial_write(struct file *file, const char *buf, |
980 | size_t count, loff_t *ppos) | 980 | size_t count, loff_t *ppos) |
981 | { | 981 | { |
982 | int dev = iminor(file->f_path.dentry->d_inode); | 982 | int dev = iminor(file_inode(file)); |
983 | DECLARE_WAITQUEUE(wait, current); | 983 | DECLARE_WAITQUEUE(wait, current); |
984 | struct sync_port *port; | 984 | struct sync_port *port; |
985 | int trunc_count; | 985 | int trunc_count; |
@@ -1102,7 +1102,7 @@ static ssize_t sync_serial_write(struct file *file, const char *buf, | |||
1102 | static ssize_t sync_serial_read(struct file * file, char * buf, | 1102 | static ssize_t sync_serial_read(struct file * file, char * buf, |
1103 | size_t count, loff_t *ppos) | 1103 | size_t count, loff_t *ppos) |
1104 | { | 1104 | { |
1105 | int dev = iminor(file->f_path.dentry->d_inode); | 1105 | int dev = iminor(file_inode(file)); |
1106 | int avail; | 1106 | int avail; |
1107 | sync_port *port; | 1107 | sync_port *port; |
1108 | unsigned char* start; | 1108 | unsigned char* start; |
diff --git a/arch/cris/include/asm/elf.h b/arch/cris/include/asm/elf.h index 8182f2dc89d0..30ded8fbf592 100644 --- a/arch/cris/include/asm/elf.h +++ b/arch/cris/include/asm/elf.h | |||
@@ -86,7 +86,4 @@ typedef unsigned long elf_fpregset_t; | |||
86 | 86 | ||
87 | #define ELF_PLATFORM (NULL) | 87 | #define ELF_PLATFORM (NULL) |
88 | 88 | ||
89 | #define SET_PERSONALITY(ex) \ | ||
90 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
91 | |||
92 | #endif | 89 | #endif |
diff --git a/arch/frv/include/asm/elf.h b/arch/frv/include/asm/elf.h index 9ccbc80f0b11..2bac6446db41 100644 --- a/arch/frv/include/asm/elf.h +++ b/arch/frv/include/asm/elf.h | |||
@@ -137,7 +137,4 @@ do { \ | |||
137 | 137 | ||
138 | #define ELF_PLATFORM (NULL) | 138 | #define ELF_PLATFORM (NULL) |
139 | 139 | ||
140 | #define SET_PERSONALITY(ex) \ | ||
141 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
142 | |||
143 | #endif | 140 | #endif |
diff --git a/arch/h8300/include/asm/elf.h b/arch/h8300/include/asm/elf.h index 41193c396bff..6db71248a82f 100644 --- a/arch/h8300/include/asm/elf.h +++ b/arch/h8300/include/asm/elf.h | |||
@@ -54,9 +54,6 @@ typedef unsigned long elf_fpregset_t; | |||
54 | 54 | ||
55 | #define ELF_PLATFORM (NULL) | 55 | #define ELF_PLATFORM (NULL) |
56 | 56 | ||
57 | #define SET_PERSONALITY(ex) \ | ||
58 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
59 | |||
60 | #define R_H8_NONE 0 | 57 | #define R_H8_NONE 0 |
61 | #define R_H8_DIR32 1 | 58 | #define R_H8_DIR32 1 |
62 | #define R_H8_DIR32_28 2 | 59 | #define R_H8_DIR32_28 2 |
diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h index 1ba4b3bff5ed..1f14e082588e 100644 --- a/arch/hexagon/include/asm/elf.h +++ b/arch/hexagon/include/asm/elf.h | |||
@@ -216,11 +216,6 @@ do { \ | |||
216 | */ | 216 | */ |
217 | #define ELF_PLATFORM (NULL) | 217 | #define ELF_PLATFORM (NULL) |
218 | 218 | ||
219 | #ifdef __KERNEL__ | ||
220 | #define SET_PERSONALITY(ex) \ | ||
221 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
222 | #endif | ||
223 | |||
224 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 | 219 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 |
225 | struct linux_binprm; | 220 | struct linux_binprm; |
226 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, | 221 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, |
diff --git a/arch/ia64/include/asm/elf.h b/arch/ia64/include/asm/elf.h index b5298eb09adb..5a83c5cc3dc8 100644 --- a/arch/ia64/include/asm/elf.h +++ b/arch/ia64/include/asm/elf.h | |||
@@ -201,9 +201,6 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst); | |||
201 | relevant until we have real hardware to play with... */ | 201 | relevant until we have real hardware to play with... */ |
202 | #define ELF_PLATFORM NULL | 202 | #define ELF_PLATFORM NULL |
203 | 203 | ||
204 | #define SET_PERSONALITY(ex) \ | ||
205 | set_personality((current->personality & ~PER_MASK) | PER_LINUX) | ||
206 | |||
207 | #define elf_read_implies_exec(ex, executable_stack) \ | 204 | #define elf_read_implies_exec(ex, executable_stack) \ |
208 | ((executable_stack!=EXSTACK_DISABLE_X) && ((ex).e_flags & EF_IA_64_LINUX_EXECUTABLE_STACK) != 0) | 205 | ((executable_stack!=EXSTACK_DISABLE_X) && ((ex).e_flags & EF_IA_64_LINUX_EXECUTABLE_STACK) != 0) |
209 | 206 | ||
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index ea39eba61ef5..433f5e8a2cd1 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2221,9 +2221,9 @@ pfm_alloc_file(pfm_context_t *ctx) | |||
2221 | d_add(path.dentry, inode); | 2221 | d_add(path.dentry, inode); |
2222 | 2222 | ||
2223 | file = alloc_file(&path, FMODE_READ, &pfm_file_ops); | 2223 | file = alloc_file(&path, FMODE_READ, &pfm_file_ops); |
2224 | if (!file) { | 2224 | if (IS_ERR(file)) { |
2225 | path_put(&path); | 2225 | path_put(&path); |
2226 | return ERR_PTR(-ENFILE); | 2226 | return file; |
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | file->f_flags = O_RDONLY; | 2229 | file->f_flags = O_RDONLY; |
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c index 79802e540e53..aa527d7e91f2 100644 --- a/arch/ia64/kernel/salinfo.c +++ b/arch/ia64/kernel/salinfo.c | |||
@@ -301,7 +301,7 @@ salinfo_event_open(struct inode *inode, struct file *file) | |||
301 | static ssize_t | 301 | static ssize_t |
302 | salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 302 | salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
303 | { | 303 | { |
304 | struct inode *inode = file->f_path.dentry->d_inode; | 304 | struct inode *inode = file_inode(file); |
305 | struct proc_dir_entry *entry = PDE(inode); | 305 | struct proc_dir_entry *entry = PDE(inode); |
306 | struct salinfo_data *data = entry->data; | 306 | struct salinfo_data *data = entry->data; |
307 | char cmd[32]; | 307 | char cmd[32]; |
@@ -463,7 +463,7 @@ retry: | |||
463 | static ssize_t | 463 | static ssize_t |
464 | salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 464 | salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
465 | { | 465 | { |
466 | struct inode *inode = file->f_path.dentry->d_inode; | 466 | struct inode *inode = file_inode(file); |
467 | struct proc_dir_entry *entry = PDE(inode); | 467 | struct proc_dir_entry *entry = PDE(inode); |
468 | struct salinfo_data *data = entry->data; | 468 | struct salinfo_data *data = entry->data; |
469 | u8 *buf; | 469 | u8 *buf; |
@@ -524,7 +524,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu) | |||
524 | static ssize_t | 524 | static ssize_t |
525 | salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 525 | salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
526 | { | 526 | { |
527 | struct inode *inode = file->f_path.dentry->d_inode; | 527 | struct inode *inode = file_inode(file); |
528 | struct proc_dir_entry *entry = PDE(inode); | 528 | struct proc_dir_entry *entry = PDE(inode); |
529 | struct salinfo_data *data = entry->data; | 529 | struct salinfo_data *data = entry->data; |
530 | char cmd[32]; | 530 | char cmd[32]; |
diff --git a/arch/m32r/include/asm/elf.h b/arch/m32r/include/asm/elf.h index 70896161c636..8acc9da9a15e 100644 --- a/arch/m32r/include/asm/elf.h +++ b/arch/m32r/include/asm/elf.h | |||
@@ -128,7 +128,4 @@ typedef elf_fpreg_t elf_fpregset_t; | |||
128 | intent than poking at uname or /proc/cpuinfo. */ | 128 | intent than poking at uname or /proc/cpuinfo. */ |
129 | #define ELF_PLATFORM (NULL) | 129 | #define ELF_PLATFORM (NULL) |
130 | 130 | ||
131 | #define SET_PERSONALITY(ex) \ | ||
132 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
133 | |||
134 | #endif /* _ASM_M32R__ELF_H */ | 131 | #endif /* _ASM_M32R__ELF_H */ |
diff --git a/arch/m68k/include/asm/elf.h b/arch/m68k/include/asm/elf.h index f83c1d0a87cf..b1c26de438be 100644 --- a/arch/m68k/include/asm/elf.h +++ b/arch/m68k/include/asm/elf.h | |||
@@ -113,7 +113,4 @@ typedef struct user_m68kfp_struct elf_fpregset_t; | |||
113 | 113 | ||
114 | #define ELF_PLATFORM (NULL) | 114 | #define ELF_PLATFORM (NULL) |
115 | 115 | ||
116 | #define SET_PERSONALITY(ex) \ | ||
117 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
118 | |||
119 | #endif | 116 | #endif |
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index b8c18dcdd2c4..88f7b50d541c 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
@@ -399,11 +399,9 @@ static int file_release(struct inode *inode, struct file *filp) | |||
399 | 399 | ||
400 | static unsigned int file_poll(struct file *file, poll_table * wait) | 400 | static unsigned int file_poll(struct file *file, poll_table * wait) |
401 | { | 401 | { |
402 | int minor; | 402 | int minor = iminor(file_inode(file)); |
403 | unsigned int mask = 0; | 403 | unsigned int mask = 0; |
404 | 404 | ||
405 | minor = iminor(file->f_path.dentry->d_inode); | ||
406 | |||
407 | poll_wait(file, &channel_wqs[minor].rt_queue, wait); | 405 | poll_wait(file, &channel_wqs[minor].rt_queue, wait); |
408 | poll_wait(file, &channel_wqs[minor].lx_queue, wait); | 406 | poll_wait(file, &channel_wqs[minor].lx_queue, wait); |
409 | 407 | ||
@@ -424,7 +422,7 @@ static unsigned int file_poll(struct file *file, poll_table * wait) | |||
424 | static ssize_t file_read(struct file *file, char __user * buffer, size_t count, | 422 | static ssize_t file_read(struct file *file, char __user * buffer, size_t count, |
425 | loff_t * ppos) | 423 | loff_t * ppos) |
426 | { | 424 | { |
427 | int minor = iminor(file->f_path.dentry->d_inode); | 425 | int minor = iminor(file_inode(file)); |
428 | 426 | ||
429 | /* data available? */ | 427 | /* data available? */ |
430 | if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) { | 428 | if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) { |
@@ -437,11 +435,8 @@ static ssize_t file_read(struct file *file, char __user * buffer, size_t count, | |||
437 | static ssize_t file_write(struct file *file, const char __user * buffer, | 435 | static ssize_t file_write(struct file *file, const char __user * buffer, |
438 | size_t count, loff_t * ppos) | 436 | size_t count, loff_t * ppos) |
439 | { | 437 | { |
440 | int minor; | 438 | int minor = iminor(file_inode(file)); |
441 | struct rtlx_channel *rt; | 439 | struct rtlx_channel *rt = &rtlx->channel[minor]; |
442 | |||
443 | minor = iminor(file->f_path.dentry->d_inode); | ||
444 | rt = &rtlx->channel[minor]; | ||
445 | 440 | ||
446 | /* any space left... */ | 441 | /* any space left... */ |
447 | if (!rtlx_write_poll(minor)) { | 442 | if (!rtlx_write_poll(minor)) { |
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 147cec19621d..29933652ff4a 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -1149,7 +1149,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, | |||
1149 | size_t ret = count; | 1149 | size_t ret = count; |
1150 | struct vpe *v; | 1150 | struct vpe *v; |
1151 | 1151 | ||
1152 | if (iminor(file->f_path.dentry->d_inode) != minor) | 1152 | if (iminor(file_inode(file)) != minor) |
1153 | return -ENODEV; | 1153 | return -ENODEV; |
1154 | 1154 | ||
1155 | v = get_vpe(tclimit); | 1155 | v = get_vpe(tclimit); |
diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c index 8e388da1926f..c592bc8b8c99 100644 --- a/arch/mips/lasat/picvue_proc.c +++ b/arch/mips/lasat/picvue_proc.c | |||
@@ -64,7 +64,7 @@ static int pvc_line_proc_open(struct inode *inode, struct file *file) | |||
64 | static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf, | 64 | static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf, |
65 | size_t count, loff_t *pos) | 65 | size_t count, loff_t *pos) |
66 | { | 66 | { |
67 | int lineno = *(int *)PDE(file->f_path.dentry->d_inode)->data; | 67 | int lineno = *(int *)PDE(file_inode(file))->data; |
68 | char kbuf[PVC_LINELEN]; | 68 | char kbuf[PVC_LINELEN]; |
69 | size_t len; | 69 | size_t len; |
70 | 70 | ||
diff --git a/arch/mn10300/include/asm/elf.h b/arch/mn10300/include/asm/elf.h index 4ebd6b3a0a1e..f592d7a9f032 100644 --- a/arch/mn10300/include/asm/elf.h +++ b/arch/mn10300/include/asm/elf.h | |||
@@ -150,9 +150,4 @@ do { \ | |||
150 | */ | 150 | */ |
151 | #define ELF_PLATFORM (NULL) | 151 | #define ELF_PLATFORM (NULL) |
152 | 152 | ||
153 | #ifdef __KERNEL__ | ||
154 | #define SET_PERSONALITY(ex) \ | ||
155 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
156 | #endif | ||
157 | |||
158 | #endif /* _ASM_ELF_H */ | 153 | #endif /* _ASM_ELF_H */ |
diff --git a/arch/openrisc/include/asm/elf.h b/arch/openrisc/include/asm/elf.h index f4aa8a542a22..d334e204bbdd 100644 --- a/arch/openrisc/include/asm/elf.h +++ b/arch/openrisc/include/asm/elf.h | |||
@@ -62,7 +62,4 @@ extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt); | |||
62 | 62 | ||
63 | #define ELF_PLATFORM (NULL) | 63 | #define ELF_PLATFORM (NULL) |
64 | 64 | ||
65 | #define SET_PERSONALITY(ex) \ | ||
66 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
67 | |||
68 | #endif | 65 | #endif |
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index 6abf0a163233..ac9790fc3836 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h | |||
@@ -103,8 +103,6 @@ do { \ | |||
103 | # define elf_read_implies_exec(ex, exec_stk) (is_32bit_task() ? \ | 103 | # define elf_read_implies_exec(ex, exec_stk) (is_32bit_task() ? \ |
104 | (exec_stk == EXSTACK_DEFAULT) : 0) | 104 | (exec_stk == EXSTACK_DEFAULT) : 0) |
105 | #else | 105 | #else |
106 | # define SET_PERSONALITY(ex) \ | ||
107 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
108 | # define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT) | 106 | # define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT) |
109 | #endif /* __powerpc64__ */ | 107 | #endif /* __powerpc64__ */ |
110 | 108 | ||
diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c index c8ae3714e79b..f19d0bdc3241 100644 --- a/arch/powerpc/kernel/proc_powerpc.c +++ b/arch/powerpc/kernel/proc_powerpc.c | |||
@@ -32,7 +32,7 @@ | |||
32 | static loff_t page_map_seek( struct file *file, loff_t off, int whence) | 32 | static loff_t page_map_seek( struct file *file, loff_t off, int whence) |
33 | { | 33 | { |
34 | loff_t new; | 34 | loff_t new; |
35 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 35 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
36 | 36 | ||
37 | switch(whence) { | 37 | switch(whence) { |
38 | case 0: | 38 | case 0: |
@@ -55,13 +55,13 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence) | |||
55 | static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, | 55 | static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, |
56 | loff_t *ppos) | 56 | loff_t *ppos) |
57 | { | 57 | { |
58 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 58 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
59 | return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size); | 59 | return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size); |
60 | } | 60 | } |
61 | 61 | ||
62 | static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) | 62 | static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) |
63 | { | 63 | { |
64 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 64 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
65 | 65 | ||
66 | if ((vma->vm_end - vma->vm_start) > dp->size) | 66 | if ((vma->vm_end - vma->vm_start) > dp->size) |
67 | return -EINVAL; | 67 | return -EINVAL; |
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 8329190312c1..c642f0132988 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -191,7 +191,7 @@ static void free_flash_list(struct flash_block_list *f) | |||
191 | 191 | ||
192 | static int rtas_flash_release(struct inode *inode, struct file *file) | 192 | static int rtas_flash_release(struct inode *inode, struct file *file) |
193 | { | 193 | { |
194 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 194 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
195 | struct rtas_update_flash_t *uf; | 195 | struct rtas_update_flash_t *uf; |
196 | 196 | ||
197 | uf = (struct rtas_update_flash_t *) dp->data; | 197 | uf = (struct rtas_update_flash_t *) dp->data; |
@@ -253,7 +253,7 @@ static void get_flash_status_msg(int status, char *buf) | |||
253 | static ssize_t rtas_flash_read(struct file *file, char __user *buf, | 253 | static ssize_t rtas_flash_read(struct file *file, char __user *buf, |
254 | size_t count, loff_t *ppos) | 254 | size_t count, loff_t *ppos) |
255 | { | 255 | { |
256 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 256 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
257 | struct rtas_update_flash_t *uf; | 257 | struct rtas_update_flash_t *uf; |
258 | char msg[RTAS_MSG_MAXLEN]; | 258 | char msg[RTAS_MSG_MAXLEN]; |
259 | 259 | ||
@@ -282,7 +282,7 @@ void rtas_block_ctor(void *ptr) | |||
282 | static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, | 282 | static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, |
283 | size_t count, loff_t *off) | 283 | size_t count, loff_t *off) |
284 | { | 284 | { |
285 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 285 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
286 | struct rtas_update_flash_t *uf; | 286 | struct rtas_update_flash_t *uf; |
287 | char *p; | 287 | char *p; |
288 | int next_free; | 288 | int next_free; |
@@ -374,7 +374,7 @@ static void manage_flash(struct rtas_manage_flash_t *args_buf) | |||
374 | static ssize_t manage_flash_read(struct file *file, char __user *buf, | 374 | static ssize_t manage_flash_read(struct file *file, char __user *buf, |
375 | size_t count, loff_t *ppos) | 375 | size_t count, loff_t *ppos) |
376 | { | 376 | { |
377 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 377 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
378 | struct rtas_manage_flash_t *args_buf; | 378 | struct rtas_manage_flash_t *args_buf; |
379 | char msg[RTAS_MSG_MAXLEN]; | 379 | char msg[RTAS_MSG_MAXLEN]; |
380 | int msglen; | 380 | int msglen; |
@@ -391,7 +391,7 @@ static ssize_t manage_flash_read(struct file *file, char __user *buf, | |||
391 | static ssize_t manage_flash_write(struct file *file, const char __user *buf, | 391 | static ssize_t manage_flash_write(struct file *file, const char __user *buf, |
392 | size_t count, loff_t *off) | 392 | size_t count, loff_t *off) |
393 | { | 393 | { |
394 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 394 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
395 | struct rtas_manage_flash_t *args_buf; | 395 | struct rtas_manage_flash_t *args_buf; |
396 | const char reject_str[] = "0"; | 396 | const char reject_str[] = "0"; |
397 | const char commit_str[] = "1"; | 397 | const char commit_str[] = "1"; |
@@ -462,7 +462,7 @@ static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf, | |||
462 | static ssize_t validate_flash_read(struct file *file, char __user *buf, | 462 | static ssize_t validate_flash_read(struct file *file, char __user *buf, |
463 | size_t count, loff_t *ppos) | 463 | size_t count, loff_t *ppos) |
464 | { | 464 | { |
465 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 465 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
466 | struct rtas_validate_flash_t *args_buf; | 466 | struct rtas_validate_flash_t *args_buf; |
467 | char msg[RTAS_MSG_MAXLEN]; | 467 | char msg[RTAS_MSG_MAXLEN]; |
468 | int msglen; | 468 | int msglen; |
@@ -477,7 +477,7 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf, | |||
477 | static ssize_t validate_flash_write(struct file *file, const char __user *buf, | 477 | static ssize_t validate_flash_write(struct file *file, const char __user *buf, |
478 | size_t count, loff_t *off) | 478 | size_t count, loff_t *off) |
479 | { | 479 | { |
480 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 480 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
481 | struct rtas_validate_flash_t *args_buf; | 481 | struct rtas_validate_flash_t *args_buf; |
482 | int rc; | 482 | int rc; |
483 | 483 | ||
@@ -526,7 +526,7 @@ done: | |||
526 | 526 | ||
527 | static int validate_flash_release(struct inode *inode, struct file *file) | 527 | static int validate_flash_release(struct inode *inode, struct file *file) |
528 | { | 528 | { |
529 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | 529 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
530 | struct rtas_validate_flash_t *args_buf; | 530 | struct rtas_validate_flash_t *args_buf; |
531 | 531 | ||
532 | args_buf = (struct rtas_validate_flash_t *) dp->data; | 532 | args_buf = (struct rtas_validate_flash_t *) dp->data; |
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index 657e3f233a64..c9500ea7be2f 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c | |||
@@ -111,7 +111,7 @@ static int match_context(const void *v, struct file *file, unsigned fd) | |||
111 | struct spu_context *ctx; | 111 | struct spu_context *ctx; |
112 | if (file->f_op != &spufs_context_fops) | 112 | if (file->f_op != &spufs_context_fops) |
113 | return 0; | 113 | return 0; |
114 | ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; | 114 | ctx = SPUFS_I(file_inode(file))->i_ctx; |
115 | if (ctx->flags & SPU_CREATE_NOSCHED) | 115 | if (ctx->flags & SPU_CREATE_NOSCHED) |
116 | return 0; | 116 | return 0; |
117 | return fd + 1; | 117 | return fd + 1; |
@@ -137,7 +137,7 @@ static struct spu_context *coredump_next_context(int *fd) | |||
137 | return NULL; | 137 | return NULL; |
138 | *fd = n - 1; | 138 | *fd = n - 1; |
139 | file = fcheck(*fd); | 139 | file = fcheck(*fd); |
140 | return SPUFS_I(file->f_dentry->d_inode)->i_ctx; | 140 | return SPUFS_I(file_inode(file))->i_ctx; |
141 | } | 141 | } |
142 | 142 | ||
143 | int spufs_coredump_extra_notes_size(void) | 143 | int spufs_coredump_extra_notes_size(void) |
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 0cfece4cf6ef..68c57d38745a 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -1852,7 +1852,7 @@ out: | |||
1852 | 1852 | ||
1853 | static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 1853 | static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
1854 | { | 1854 | { |
1855 | struct inode *inode = file->f_path.dentry->d_inode; | 1855 | struct inode *inode = file_inode(file); |
1856 | int err = filemap_write_and_wait_range(inode->i_mapping, start, end); | 1856 | int err = filemap_write_and_wait_range(inode->i_mapping, start, end); |
1857 | if (!err) { | 1857 | if (!err) { |
1858 | mutex_lock(&inode->i_mutex); | 1858 | mutex_lock(&inode->i_mutex); |
@@ -2501,7 +2501,7 @@ static int switch_log_sprint(struct spu_context *ctx, char *tbuf, int n) | |||
2501 | static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, | 2501 | static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, |
2502 | size_t len, loff_t *ppos) | 2502 | size_t len, loff_t *ppos) |
2503 | { | 2503 | { |
2504 | struct inode *inode = file->f_path.dentry->d_inode; | 2504 | struct inode *inode = file_inode(file); |
2505 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; | 2505 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; |
2506 | int error = 0, cnt = 0; | 2506 | int error = 0, cnt = 0; |
2507 | 2507 | ||
@@ -2571,7 +2571,7 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, | |||
2571 | 2571 | ||
2572 | static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait) | 2572 | static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait) |
2573 | { | 2573 | { |
2574 | struct inode *inode = file->f_path.dentry->d_inode; | 2574 | struct inode *inode = file_inode(file); |
2575 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; | 2575 | struct spu_context *ctx = SPUFS_I(inode)->i_ctx; |
2576 | unsigned int mask = 0; | 2576 | unsigned int mask = 0; |
2577 | int rc; | 2577 | int rc; |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index dba1ce235da5..863184b182f4 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -199,37 +199,18 @@ static int spufs_fill_dir(struct dentry *dir, | |||
199 | const struct spufs_tree_descr *files, umode_t mode, | 199 | const struct spufs_tree_descr *files, umode_t mode, |
200 | struct spu_context *ctx) | 200 | struct spu_context *ctx) |
201 | { | 201 | { |
202 | struct dentry *dentry, *tmp; | ||
203 | int ret; | ||
204 | |||
205 | while (files->name && files->name[0]) { | 202 | while (files->name && files->name[0]) { |
206 | ret = -ENOMEM; | 203 | int ret; |
207 | dentry = d_alloc_name(dir, files->name); | 204 | struct dentry *dentry = d_alloc_name(dir, files->name); |
208 | if (!dentry) | 205 | if (!dentry) |
209 | goto out; | 206 | return -ENOMEM; |
210 | ret = spufs_new_file(dir->d_sb, dentry, files->ops, | 207 | ret = spufs_new_file(dir->d_sb, dentry, files->ops, |
211 | files->mode & mode, files->size, ctx); | 208 | files->mode & mode, files->size, ctx); |
212 | if (ret) | 209 | if (ret) |
213 | goto out; | 210 | return ret; |
214 | files++; | 211 | files++; |
215 | } | 212 | } |
216 | return 0; | 213 | return 0; |
217 | out: | ||
218 | /* | ||
219 | * remove all children from dir. dir->inode is not set so don't | ||
220 | * just simply use spufs_prune_dir() and panic afterwards :) | ||
221 | * dput() looks like it will do the right thing: | ||
222 | * - dec parent's ref counter | ||
223 | * - remove child from parent's child list | ||
224 | * - free child's inode if possible | ||
225 | * - free child | ||
226 | */ | ||
227 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { | ||
228 | dput(dentry); | ||
229 | } | ||
230 | |||
231 | shrink_dcache_parent(dir); | ||
232 | return ret; | ||
233 | } | 214 | } |
234 | 215 | ||
235 | static int spufs_dir_close(struct inode *inode, struct file *file) | 216 | static int spufs_dir_close(struct inode *inode, struct file *file) |
@@ -269,10 +250,9 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, | |||
269 | struct inode *inode; | 250 | struct inode *inode; |
270 | struct spu_context *ctx; | 251 | struct spu_context *ctx; |
271 | 252 | ||
272 | ret = -ENOSPC; | ||
273 | inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR); | 253 | inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR); |
274 | if (!inode) | 254 | if (!inode) |
275 | goto out; | 255 | return -ENOSPC; |
276 | 256 | ||
277 | if (dir->i_mode & S_ISGID) { | 257 | if (dir->i_mode & S_ISGID) { |
278 | inode->i_gid = dir->i_gid; | 258 | inode->i_gid = dir->i_gid; |
@@ -280,40 +260,38 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, | |||
280 | } | 260 | } |
281 | ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */ | 261 | ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */ |
282 | SPUFS_I(inode)->i_ctx = ctx; | 262 | SPUFS_I(inode)->i_ctx = ctx; |
283 | if (!ctx) | 263 | if (!ctx) { |
284 | goto out_iput; | 264 | iput(inode); |
265 | return -ENOSPC; | ||
266 | } | ||
285 | 267 | ||
286 | ctx->flags = flags; | 268 | ctx->flags = flags; |
287 | inode->i_op = &simple_dir_inode_operations; | 269 | inode->i_op = &simple_dir_inode_operations; |
288 | inode->i_fop = &simple_dir_operations; | 270 | inode->i_fop = &simple_dir_operations; |
271 | |||
272 | mutex_lock(&inode->i_mutex); | ||
273 | |||
274 | dget(dentry); | ||
275 | inc_nlink(dir); | ||
276 | inc_nlink(inode); | ||
277 | |||
278 | d_instantiate(dentry, inode); | ||
279 | |||
289 | if (flags & SPU_CREATE_NOSCHED) | 280 | if (flags & SPU_CREATE_NOSCHED) |
290 | ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents, | 281 | ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents, |
291 | mode, ctx); | 282 | mode, ctx); |
292 | else | 283 | else |
293 | ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx); | 284 | ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx); |
294 | 285 | ||
295 | if (ret) | 286 | if (!ret && spufs_get_sb_info(dir->i_sb)->debug) |
296 | goto out_free_ctx; | ||
297 | |||
298 | if (spufs_get_sb_info(dir->i_sb)->debug) | ||
299 | ret = spufs_fill_dir(dentry, spufs_dir_debug_contents, | 287 | ret = spufs_fill_dir(dentry, spufs_dir_debug_contents, |
300 | mode, ctx); | 288 | mode, ctx); |
301 | 289 | ||
302 | if (ret) | 290 | if (ret) |
303 | goto out_free_ctx; | 291 | spufs_rmdir(dir, dentry); |
304 | 292 | ||
305 | d_instantiate(dentry, inode); | 293 | mutex_unlock(&inode->i_mutex); |
306 | dget(dentry); | ||
307 | inc_nlink(dir); | ||
308 | inc_nlink(dentry->d_inode); | ||
309 | goto out; | ||
310 | 294 | ||
311 | out_free_ctx: | ||
312 | spu_forget(ctx); | ||
313 | put_spu_context(ctx); | ||
314 | out_iput: | ||
315 | iput(inode); | ||
316 | out: | ||
317 | return ret; | 295 | return ret; |
318 | } | 296 | } |
319 | 297 | ||
@@ -368,7 +346,7 @@ spufs_assert_affinity(unsigned int flags, struct spu_gang *gang, | |||
368 | return ERR_PTR(-EINVAL); | 346 | return ERR_PTR(-EINVAL); |
369 | 347 | ||
370 | neighbor = get_spu_context( | 348 | neighbor = get_spu_context( |
371 | SPUFS_I(filp->f_dentry->d_inode)->i_ctx); | 349 | SPUFS_I(file_inode(filp))->i_ctx); |
372 | 350 | ||
373 | if (!list_empty(&neighbor->aff_list) && !(neighbor->aff_head) && | 351 | if (!list_empty(&neighbor->aff_list) && !(neighbor->aff_head) && |
374 | !list_is_last(&neighbor->aff_list, &gang->aff_list_head) && | 352 | !list_is_last(&neighbor->aff_list, &gang->aff_list_head) && |
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c index baee994fe810..b045fdda4845 100644 --- a/arch/powerpc/platforms/cell/spufs/syscalls.c +++ b/arch/powerpc/platforms/cell/spufs/syscalls.c | |||
@@ -47,7 +47,7 @@ static long do_spu_run(struct file *filp, | |||
47 | if (filp->f_op != &spufs_context_fops) | 47 | if (filp->f_op != &spufs_context_fops) |
48 | goto out; | 48 | goto out; |
49 | 49 | ||
50 | i = SPUFS_I(filp->f_path.dentry->d_inode); | 50 | i = SPUFS_I(file_inode(filp)); |
51 | ret = spufs_run_spu(i->i_ctx, &npc, &status); | 51 | ret = spufs_run_spu(i->i_ctx, &npc, &status); |
52 | 52 | ||
53 | if (put_user(npc, unpc)) | 53 | if (put_user(npc, unpc)) |
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c index c9311cfdfcac..cf4e7736e4f1 100644 --- a/arch/powerpc/platforms/pseries/hvCall_inst.c +++ b/arch/powerpc/platforms/pseries/hvCall_inst.c | |||
@@ -86,7 +86,7 @@ static int hcall_inst_seq_open(struct inode *inode, struct file *file) | |||
86 | 86 | ||
87 | rc = seq_open(file, &hcall_inst_seq_ops); | 87 | rc = seq_open(file, &hcall_inst_seq_ops); |
88 | seq = file->private_data; | 88 | seq = file->private_data; |
89 | seq->private = file->f_path.dentry->d_inode->i_private; | 89 | seq->private = file_inode(file)->i_private; |
90 | 90 | ||
91 | return rc; | 91 | return rc; |
92 | } | 92 | } |
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index 554457294a2b..47f3cda2a68b 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c | |||
@@ -46,16 +46,12 @@ static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */ | |||
46 | static ssize_t scanlog_read(struct file *file, char __user *buf, | 46 | static ssize_t scanlog_read(struct file *file, char __user *buf, |
47 | size_t count, loff_t *ppos) | 47 | size_t count, loff_t *ppos) |
48 | { | 48 | { |
49 | struct inode * inode = file->f_path.dentry->d_inode; | 49 | struct proc_dir_entry *dp = PDE(file_inode(file)); |
50 | struct proc_dir_entry *dp; | 50 | unsigned int *data = (unsigned int *)dp->data; |
51 | unsigned int *data; | ||
52 | int status; | 51 | int status; |
53 | unsigned long len, off; | 52 | unsigned long len, off; |
54 | unsigned int wait_time; | 53 | unsigned int wait_time; |
55 | 54 | ||
56 | dp = PDE(inode); | ||
57 | data = (unsigned int *)dp->data; | ||
58 | |||
59 | if (count > RTAS_DATA_BUF_SIZE) | 55 | if (count > RTAS_DATA_BUF_SIZE) |
60 | count = RTAS_DATA_BUF_SIZE; | 56 | count = RTAS_DATA_BUF_SIZE; |
61 | 57 | ||
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c index 13e76dabbe8b..9fd4a40c6752 100644 --- a/arch/s390/hypfs/hypfs_dbfs.c +++ b/arch/s390/hypfs/hypfs_dbfs.c | |||
@@ -54,7 +54,7 @@ static ssize_t dbfs_read(struct file *file, char __user *buf, | |||
54 | if (*ppos != 0) | 54 | if (*ppos != 0) |
55 | return 0; | 55 | return 0; |
56 | 56 | ||
57 | df = file->f_path.dentry->d_inode->i_private; | 57 | df = file_inode(file)->i_private; |
58 | mutex_lock(&df->lock); | 58 | mutex_lock(&df->lock); |
59 | if (!df->data) { | 59 | if (!df->data) { |
60 | data = hypfs_dbfs_data_alloc(df); | 60 | data = hypfs_dbfs_data_alloc(df); |
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 06ea69bd387a..280ded8b79ba 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c | |||
@@ -119,7 +119,7 @@ static void hypfs_evict_inode(struct inode *inode) | |||
119 | 119 | ||
120 | static int hypfs_open(struct inode *inode, struct file *filp) | 120 | static int hypfs_open(struct inode *inode, struct file *filp) |
121 | { | 121 | { |
122 | char *data = filp->f_path.dentry->d_inode->i_private; | 122 | char *data = file_inode(filp)->i_private; |
123 | struct hypfs_sb_info *fs_info; | 123 | struct hypfs_sb_info *fs_info; |
124 | 124 | ||
125 | if (filp->f_mode & FMODE_WRITE) { | 125 | if (filp->f_mode & FMODE_WRITE) { |
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 178ff966a8ba..1bfdf24b85a2 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h | |||
@@ -180,10 +180,7 @@ extern unsigned long elf_hwcap; | |||
180 | extern char elf_platform[]; | 180 | extern char elf_platform[]; |
181 | #define ELF_PLATFORM (elf_platform) | 181 | #define ELF_PLATFORM (elf_platform) |
182 | 182 | ||
183 | #ifndef CONFIG_64BIT | 183 | #ifdef CONFIG_64BIT |
184 | #define SET_PERSONALITY(ex) \ | ||
185 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
186 | #else /* CONFIG_64BIT */ | ||
187 | #define SET_PERSONALITY(ex) \ | 184 | #define SET_PERSONALITY(ex) \ |
188 | do { \ | 185 | do { \ |
189 | if (personality(current->personality) != PER_LINUX32) \ | 186 | if (personality(current->personality) != PER_LINUX32) \ |
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index 09a94cd9debc..f1279dc2e1bc 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c | |||
@@ -611,7 +611,7 @@ debug_open(struct inode *inode, struct file *file) | |||
611 | debug_info_t *debug_info, *debug_info_snapshot; | 611 | debug_info_t *debug_info, *debug_info_snapshot; |
612 | 612 | ||
613 | mutex_lock(&debug_mutex); | 613 | mutex_lock(&debug_mutex); |
614 | debug_info = file->f_path.dentry->d_inode->i_private; | 614 | debug_info = file_inode(file)->i_private; |
615 | /* find debug view */ | 615 | /* find debug view */ |
616 | for (i = 0; i < DEBUG_MAX_VIEWS; i++) { | 616 | for (i = 0; i < DEBUG_MAX_VIEWS; i++) { |
617 | if (!debug_info->views[i]) | 617 | if (!debug_info->views[i]) |
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c index a303c95346cb..a5d07bc2a547 100644 --- a/arch/s390/pci/pci_debug.c +++ b/arch/s390/pci/pci_debug.c | |||
@@ -99,7 +99,7 @@ static ssize_t pci_perf_seq_write(struct file *file, const char __user *ubuf, | |||
99 | static int pci_perf_seq_open(struct inode *inode, struct file *filp) | 99 | static int pci_perf_seq_open(struct inode *inode, struct file *filp) |
100 | { | 100 | { |
101 | return single_open(filp, pci_perf_show, | 101 | return single_open(filp, pci_perf_show, |
102 | filp->f_path.dentry->d_inode->i_private); | 102 | file_inode(filp)->i_private); |
103 | } | 103 | } |
104 | 104 | ||
105 | static const struct file_operations debugfs_pci_perf_fops = { | 105 | static const struct file_operations debugfs_pci_perf_fops = { |
@@ -121,7 +121,7 @@ static int pci_debug_show(struct seq_file *m, void *v) | |||
121 | static int pci_debug_seq_open(struct inode *inode, struct file *filp) | 121 | static int pci_debug_seq_open(struct inode *inode, struct file *filp) |
122 | { | 122 | { |
123 | return single_open(filp, pci_debug_show, | 123 | return single_open(filp, pci_debug_show, |
124 | filp->f_path.dentry->d_inode->i_private); | 124 | file_inode(filp)->i_private); |
125 | } | 125 | } |
126 | 126 | ||
127 | static const struct file_operations debugfs_pci_debug_fops = { | 127 | static const struct file_operations debugfs_pci_debug_fops = { |
diff --git a/arch/score/include/asm/elf.h b/arch/score/include/asm/elf.h index 5d566c7a0af2..6a9421c693ca 100644 --- a/arch/score/include/asm/elf.h +++ b/arch/score/include/asm/elf.h | |||
@@ -52,11 +52,6 @@ typedef elf_fpreg_t elf_fpregset_t; | |||
52 | #define ELF_DATA ELFDATA2LSB | 52 | #define ELF_DATA ELFDATA2LSB |
53 | #define ELF_ARCH EM_SCORE7 | 53 | #define ELF_ARCH EM_SCORE7 |
54 | 54 | ||
55 | #define SET_PERSONALITY(ex) \ | ||
56 | do { \ | ||
57 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \ | ||
58 | } while (0) | ||
59 | |||
60 | struct task_struct; | 55 | struct task_struct; |
61 | struct pt_regs; | 56 | struct pt_regs; |
62 | 57 | ||
diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c index 620fa7ff9eec..aea14855e656 100644 --- a/arch/sh/mm/alignment.c +++ b/arch/sh/mm/alignment.c | |||
@@ -140,7 +140,7 @@ static int alignment_proc_open(struct inode *inode, struct file *file) | |||
140 | static ssize_t alignment_proc_write(struct file *file, | 140 | static ssize_t alignment_proc_write(struct file *file, |
141 | const char __user *buffer, size_t count, loff_t *pos) | 141 | const char __user *buffer, size_t count, loff_t *pos) |
142 | { | 142 | { |
143 | int *data = PDE(file->f_path.dentry->d_inode)->data; | 143 | int *data = PDE(file_inode(file))->data; |
144 | char mode; | 144 | char mode; |
145 | 145 | ||
146 | if (count > 0) { | 146 | if (count > 0) { |
diff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h index ac74a2c98e6d..a24e41fcdde1 100644 --- a/arch/sparc/include/asm/elf_32.h +++ b/arch/sparc/include/asm/elf_32.h | |||
@@ -128,7 +128,4 @@ typedef struct { | |||
128 | 128 | ||
129 | #define ELF_PLATFORM (NULL) | 129 | #define ELF_PLATFORM (NULL) |
130 | 130 | ||
131 | #define SET_PERSONALITY(ex) \ | ||
132 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
133 | |||
134 | #endif /* !(__ASMSPARC_ELF_H) */ | 131 | #endif /* !(__ASMSPARC_ELF_H) */ |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index a703af19c281..03abf9b70011 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -271,7 +271,7 @@ static int load_aout_binary(struct linux_binprm *bprm) | |||
271 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && | 271 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && |
272 | N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || | 272 | N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || |
273 | N_TRSIZE(ex) || N_DRSIZE(ex) || | 273 | N_TRSIZE(ex) || N_DRSIZE(ex) || |
274 | i_size_read(bprm->file->f_path.dentry->d_inode) < | 274 | i_size_read(file_inode(bprm->file)) < |
275 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { | 275 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { |
276 | return -ENOEXEC; | 276 | return -ENOEXEC; |
277 | } | 277 | } |
@@ -425,12 +425,10 @@ beyond_if: | |||
425 | 425 | ||
426 | static int load_aout_library(struct file *file) | 426 | static int load_aout_library(struct file *file) |
427 | { | 427 | { |
428 | struct inode *inode; | ||
429 | unsigned long bss, start_addr, len, error; | 428 | unsigned long bss, start_addr, len, error; |
430 | int retval; | 429 | int retval; |
431 | struct exec ex; | 430 | struct exec ex; |
432 | 431 | ||
433 | inode = file->f_path.dentry->d_inode; | ||
434 | 432 | ||
435 | retval = -ENOEXEC; | 433 | retval = -ENOEXEC; |
436 | error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); | 434 | error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); |
@@ -440,7 +438,7 @@ static int load_aout_library(struct file *file) | |||
440 | /* We come in here for the regular a.out style of shared libraries */ | 438 | /* We come in here for the regular a.out style of shared libraries */ |
441 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != QMAGIC) || N_TRSIZE(ex) || | 439 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != QMAGIC) || N_TRSIZE(ex) || |
442 | N_DRSIZE(ex) || ((ex.a_entry & 0xfff) && N_MAGIC(ex) == ZMAGIC) || | 440 | N_DRSIZE(ex) || ((ex.a_entry & 0xfff) && N_MAGIC(ex) == ZMAGIC) || |
443 | i_size_read(inode) < | 441 | i_size_read(file_inode(file)) < |
444 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { | 442 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { |
445 | goto out; | 443 | goto out; |
446 | } | 444 | } |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 60c78917190c..1e4dbcfe6d31 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -85,7 +85,7 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
85 | { | 85 | { |
86 | char __user *tmp = buf; | 86 | char __user *tmp = buf; |
87 | struct cpuid_regs cmd; | 87 | struct cpuid_regs cmd; |
88 | int cpu = iminor(file->f_path.dentry->d_inode); | 88 | int cpu = iminor(file_inode(file)); |
89 | u64 pos = *ppos; | 89 | u64 pos = *ppos; |
90 | ssize_t bytes = 0; | 90 | ssize_t bytes = 0; |
91 | int err = 0; | 91 | int err = 0; |
@@ -116,7 +116,7 @@ static int cpuid_open(struct inode *inode, struct file *file) | |||
116 | unsigned int cpu; | 116 | unsigned int cpu; |
117 | struct cpuinfo_x86 *c; | 117 | struct cpuinfo_x86 *c; |
118 | 118 | ||
119 | cpu = iminor(file->f_path.dentry->d_inode); | 119 | cpu = iminor(file_inode(file)); |
120 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) | 120 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) |
121 | return -ENXIO; /* No such CPU */ | 121 | return -ENXIO; /* No such CPU */ |
122 | 122 | ||
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 17cf7cad601e..01fc5b07f951 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
@@ -302,7 +302,8 @@ static int handle_remove(const char *nodename, struct device *dev) | |||
302 | 302 | ||
303 | if (dentry->d_inode) { | 303 | if (dentry->d_inode) { |
304 | struct kstat stat; | 304 | struct kstat stat; |
305 | err = vfs_getattr(parent.mnt, dentry, &stat); | 305 | struct path p = {.mnt = parent.mnt, .dentry = dentry}; |
306 | err = vfs_getattr(&p, &stat); | ||
306 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { | 307 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { |
307 | struct iattr newattrs; | 308 | struct iattr newattrs; |
308 | /* | 309 | /* |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 4a223fedcd73..4b1f9265887f 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -279,7 +279,7 @@ MODULE_PARM_DESC(path, "customized firmware image search path with a higher prio | |||
279 | static noinline_for_stack long fw_file_size(struct file *file) | 279 | static noinline_for_stack long fw_file_size(struct file *file) |
280 | { | 280 | { |
281 | struct kstat st; | 281 | struct kstat st; |
282 | if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) | 282 | if (vfs_getattr(&file->f_path, &st)) |
283 | return -1; | 283 | return -1; |
284 | if (!S_ISREG(st.mode)) | 284 | if (!S_ISREG(st.mode)) |
285 | return -1; | 285 | return -1; |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 9a13e889837e..8f12dc78a848 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -6547,7 +6547,7 @@ static ssize_t dac960_user_command_proc_write(struct file *file, | |||
6547 | const char __user *Buffer, | 6547 | const char __user *Buffer, |
6548 | size_t Count, loff_t *pos) | 6548 | size_t Count, loff_t *pos) |
6549 | { | 6549 | { |
6550 | DAC960_Controller_T *Controller = (DAC960_Controller_T *) PDE(file->f_path.dentry->d_inode)->data; | 6550 | DAC960_Controller_T *Controller = (DAC960_Controller_T *) PDE(file_inode(file))->data; |
6551 | unsigned char CommandBuffer[80]; | 6551 | unsigned char CommandBuffer[80]; |
6552 | int Length; | 6552 | int Length; |
6553 | if (Count > sizeof(CommandBuffer)-1) return -EINVAL; | 6553 | if (Count > sizeof(CommandBuffer)-1) return -EINVAL; |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index ae1251270624..8031a8cdd698 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1139,7 +1139,7 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info) | |||
1139 | 1139 | ||
1140 | if (lo->lo_state != Lo_bound) | 1140 | if (lo->lo_state != Lo_bound) |
1141 | return -ENXIO; | 1141 | return -ENXIO; |
1142 | error = vfs_getattr(file->f_path.mnt, file->f_path.dentry, &stat); | 1142 | error = vfs_getattr(&file->f_path, &stat); |
1143 | if (error) | 1143 | if (error) |
1144 | return error; | 1144 | return error; |
1145 | memset(info, 0, sizeof(*info)); | 1145 | memset(info, 0, sizeof(*info)); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 043ddcca4abf..ade146bf65e5 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -625,7 +625,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, | |||
625 | return -EBUSY; | 625 | return -EBUSY; |
626 | file = fget(arg); | 626 | file = fget(arg); |
627 | if (file) { | 627 | if (file) { |
628 | struct inode *inode = file->f_path.dentry->d_inode; | 628 | struct inode *inode = file_inode(file); |
629 | if (S_ISSOCK(inode->i_mode)) { | 629 | if (S_ISSOCK(inode->i_mode)) { |
630 | nbd->file = file; | 630 | nbd->file = file; |
631 | nbd->sock = SOCKET_I(inode); | 631 | nbd->sock = SOCKET_I(inode); |
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index 052797b32bd3..01a5ca7425d7 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c | |||
@@ -181,7 +181,7 @@ static int dsp56k_upload(u_char __user *bin, int len) | |||
181 | static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count, | 181 | static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count, |
182 | loff_t *ppos) | 182 | loff_t *ppos) |
183 | { | 183 | { |
184 | struct inode *inode = file->f_path.dentry->d_inode; | 184 | struct inode *inode = file_inode(file); |
185 | int dev = iminor(inode) & 0x0f; | 185 | int dev = iminor(inode) & 0x0f; |
186 | 186 | ||
187 | switch(dev) | 187 | switch(dev) |
@@ -244,7 +244,7 @@ static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count, | |||
244 | static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t count, | 244 | static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t count, |
245 | loff_t *ppos) | 245 | loff_t *ppos) |
246 | { | 246 | { |
247 | struct inode *inode = file->f_path.dentry->d_inode; | 247 | struct inode *inode = file_inode(file); |
248 | int dev = iminor(inode) & 0x0f; | 248 | int dev = iminor(inode) & 0x0f; |
249 | 249 | ||
250 | switch(dev) | 250 | switch(dev) |
@@ -306,7 +306,7 @@ static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t co | |||
306 | static long dsp56k_ioctl(struct file *file, unsigned int cmd, | 306 | static long dsp56k_ioctl(struct file *file, unsigned int cmd, |
307 | unsigned long arg) | 307 | unsigned long arg) |
308 | { | 308 | { |
309 | int dev = iminor(file->f_path.dentry->d_inode) & 0x0f; | 309 | int dev = iminor(file_inode(file)) & 0x0f; |
310 | void __user *argp = (void __user *)arg; | 310 | void __user *argp = (void __user *)arg; |
311 | 311 | ||
312 | switch(dev) | 312 | switch(dev) |
@@ -408,7 +408,7 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, | |||
408 | #if 0 | 408 | #if 0 |
409 | static unsigned int dsp56k_poll(struct file *file, poll_table *wait) | 409 | static unsigned int dsp56k_poll(struct file *file, poll_table *wait) |
410 | { | 410 | { |
411 | int dev = iminor(file->f_path.dentry->d_inode) & 0x0f; | 411 | int dev = iminor(file_inode(file)) & 0x0f; |
412 | 412 | ||
413 | switch(dev) | 413 | switch(dev) |
414 | { | 414 | { |
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 85156dd0caee..65a8d96c0e93 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c | |||
@@ -125,7 +125,7 @@ static char dtlk_write_tts(char); | |||
125 | static ssize_t dtlk_read(struct file *file, char __user *buf, | 125 | static ssize_t dtlk_read(struct file *file, char __user *buf, |
126 | size_t count, loff_t * ppos) | 126 | size_t count, loff_t * ppos) |
127 | { | 127 | { |
128 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 128 | unsigned int minor = iminor(file_inode(file)); |
129 | char ch; | 129 | char ch; |
130 | int i = 0, retries; | 130 | int i = 0, retries; |
131 | 131 | ||
@@ -177,7 +177,7 @@ static ssize_t dtlk_write(struct file *file, const char __user *buf, | |||
177 | } | 177 | } |
178 | #endif | 178 | #endif |
179 | 179 | ||
180 | if (iminor(file->f_path.dentry->d_inode) != DTLK_MINOR) | 180 | if (iminor(file_inode(file)) != DTLK_MINOR) |
181 | return -EINVAL; | 181 | return -EINVAL; |
182 | 182 | ||
183 | while (1) { | 183 | while (1) { |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index a741e418b456..dafd9ac6428f 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -294,7 +294,7 @@ static int lp_wait_ready(int minor, int nonblock) | |||
294 | static ssize_t lp_write(struct file * file, const char __user * buf, | 294 | static ssize_t lp_write(struct file * file, const char __user * buf, |
295 | size_t count, loff_t *ppos) | 295 | size_t count, loff_t *ppos) |
296 | { | 296 | { |
297 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 297 | unsigned int minor = iminor(file_inode(file)); |
298 | struct parport *port = lp_table[minor].dev->port; | 298 | struct parport *port = lp_table[minor].dev->port; |
299 | char *kbuf = lp_table[minor].lp_buffer; | 299 | char *kbuf = lp_table[minor].lp_buffer; |
300 | ssize_t retv = 0; | 300 | ssize_t retv = 0; |
@@ -413,7 +413,7 @@ static ssize_t lp_read(struct file * file, char __user * buf, | |||
413 | size_t count, loff_t *ppos) | 413 | size_t count, loff_t *ppos) |
414 | { | 414 | { |
415 | DEFINE_WAIT(wait); | 415 | DEFINE_WAIT(wait); |
416 | unsigned int minor=iminor(file->f_path.dentry->d_inode); | 416 | unsigned int minor=iminor(file_inode(file)); |
417 | struct parport *port = lp_table[minor].dev->port; | 417 | struct parport *port = lp_table[minor].dev->port; |
418 | ssize_t retval = 0; | 418 | ssize_t retval = 0; |
419 | char *kbuf = lp_table[minor].lp_buffer; | 419 | char *kbuf = lp_table[minor].lp_buffer; |
@@ -679,7 +679,7 @@ static long lp_ioctl(struct file *file, unsigned int cmd, | |||
679 | struct timeval par_timeout; | 679 | struct timeval par_timeout; |
680 | int ret; | 680 | int ret; |
681 | 681 | ||
682 | minor = iminor(file->f_path.dentry->d_inode); | 682 | minor = iminor(file_inode(file)); |
683 | mutex_lock(&lp_mutex); | 683 | mutex_lock(&lp_mutex); |
684 | switch (cmd) { | 684 | switch (cmd) { |
685 | case LPSETTIMEOUT: | 685 | case LPSETTIMEOUT: |
@@ -707,7 +707,7 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd, | |||
707 | struct timeval par_timeout; | 707 | struct timeval par_timeout; |
708 | int ret; | 708 | int ret; |
709 | 709 | ||
710 | minor = iminor(file->f_path.dentry->d_inode); | 710 | minor = iminor(file_inode(file)); |
711 | mutex_lock(&lp_mutex); | 711 | mutex_lock(&lp_mutex); |
712 | switch (cmd) { | 712 | switch (cmd) { |
713 | case LPSETTIMEOUT: | 713 | case LPSETTIMEOUT: |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 6f6e92a3102d..2c644afbcdd4 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -708,7 +708,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) | |||
708 | { | 708 | { |
709 | loff_t ret; | 709 | loff_t ret; |
710 | 710 | ||
711 | mutex_lock(&file->f_path.dentry->d_inode->i_mutex); | 711 | mutex_lock(&file_inode(file)->i_mutex); |
712 | switch (orig) { | 712 | switch (orig) { |
713 | case SEEK_CUR: | 713 | case SEEK_CUR: |
714 | offset += file->f_pos; | 714 | offset += file->f_pos; |
@@ -725,7 +725,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) | |||
725 | default: | 725 | default: |
726 | ret = -EINVAL; | 726 | ret = -EINVAL; |
727 | } | 727 | } |
728 | mutex_unlock(&file->f_path.dentry->d_inode->i_mutex); | 728 | mutex_unlock(&file_inode(file)->i_mutex); |
729 | return ret; | 729 | return ret; |
730 | } | 730 | } |
731 | 731 | ||
diff --git a/drivers/char/nsc_gpio.c b/drivers/char/nsc_gpio.c index 808d44e9a32a..b07b119ae57f 100644 --- a/drivers/char/nsc_gpio.c +++ b/drivers/char/nsc_gpio.c | |||
@@ -41,7 +41,7 @@ void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index) | |||
41 | ssize_t nsc_gpio_write(struct file *file, const char __user *data, | 41 | ssize_t nsc_gpio_write(struct file *file, const char __user *data, |
42 | size_t len, loff_t *ppos) | 42 | size_t len, loff_t *ppos) |
43 | { | 43 | { |
44 | unsigned m = iminor(file->f_path.dentry->d_inode); | 44 | unsigned m = iminor(file_inode(file)); |
45 | struct nsc_gpio_ops *amp = file->private_data; | 45 | struct nsc_gpio_ops *amp = file->private_data; |
46 | struct device *dev = amp->dev; | 46 | struct device *dev = amp->dev; |
47 | size_t i; | 47 | size_t i; |
@@ -104,7 +104,7 @@ ssize_t nsc_gpio_write(struct file *file, const char __user *data, | |||
104 | ssize_t nsc_gpio_read(struct file *file, char __user * buf, | 104 | ssize_t nsc_gpio_read(struct file *file, char __user * buf, |
105 | size_t len, loff_t * ppos) | 105 | size_t len, loff_t * ppos) |
106 | { | 106 | { |
107 | unsigned m = iminor(file->f_path.dentry->d_inode); | 107 | unsigned m = iminor(file_inode(file)); |
108 | int value; | 108 | int value; |
109 | struct nsc_gpio_ops *amp = file->private_data; | 109 | struct nsc_gpio_ops *amp = file->private_data; |
110 | 110 | ||
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index a7584860e9a7..c115217c79ae 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -1400,7 +1400,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
1400 | { | 1400 | { |
1401 | struct cm4000_dev *dev = filp->private_data; | 1401 | struct cm4000_dev *dev = filp->private_data; |
1402 | unsigned int iobase = dev->p_dev->resource[0]->start; | 1402 | unsigned int iobase = dev->p_dev->resource[0]->start; |
1403 | struct inode *inode = filp->f_path.dentry->d_inode; | 1403 | struct inode *inode = file_inode(filp); |
1404 | struct pcmcia_device *link; | 1404 | struct pcmcia_device *link; |
1405 | int size; | 1405 | int size; |
1406 | int rc; | 1406 | int rc; |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 1cd49241e60e..ae0b42b66e55 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -107,7 +107,7 @@ static inline void pp_enable_irq (struct pp_struct *pp) | |||
107 | static ssize_t pp_read (struct file * file, char __user * buf, size_t count, | 107 | static ssize_t pp_read (struct file * file, char __user * buf, size_t count, |
108 | loff_t * ppos) | 108 | loff_t * ppos) |
109 | { | 109 | { |
110 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 110 | unsigned int minor = iminor(file_inode(file)); |
111 | struct pp_struct *pp = file->private_data; | 111 | struct pp_struct *pp = file->private_data; |
112 | char * kbuffer; | 112 | char * kbuffer; |
113 | ssize_t bytes_read = 0; | 113 | ssize_t bytes_read = 0; |
@@ -189,7 +189,7 @@ static ssize_t pp_read (struct file * file, char __user * buf, size_t count, | |||
189 | static ssize_t pp_write (struct file * file, const char __user * buf, | 189 | static ssize_t pp_write (struct file * file, const char __user * buf, |
190 | size_t count, loff_t * ppos) | 190 | size_t count, loff_t * ppos) |
191 | { | 191 | { |
192 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 192 | unsigned int minor = iminor(file_inode(file)); |
193 | struct pp_struct *pp = file->private_data; | 193 | struct pp_struct *pp = file->private_data; |
194 | char * kbuffer; | 194 | char * kbuffer; |
195 | ssize_t bytes_written = 0; | 195 | ssize_t bytes_written = 0; |
@@ -324,7 +324,7 @@ static enum ieee1284_phase init_phase (int mode) | |||
324 | 324 | ||
325 | static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 325 | static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
326 | { | 326 | { |
327 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 327 | unsigned int minor = iminor(file_inode(file)); |
328 | struct pp_struct *pp = file->private_data; | 328 | struct pp_struct *pp = file->private_data; |
329 | struct parport * port; | 329 | struct parport * port; |
330 | void __user *argp = (void __user *)arg; | 330 | void __user *argp = (void __user *)arg; |
diff --git a/drivers/char/ps3flash.c b/drivers/char/ps3flash.c index 588063ac9517..8cafa9ccd43f 100644 --- a/drivers/char/ps3flash.c +++ b/drivers/char/ps3flash.c | |||
@@ -312,7 +312,7 @@ static int ps3flash_flush(struct file *file, fl_owner_t id) | |||
312 | 312 | ||
313 | static int ps3flash_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 313 | static int ps3flash_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
314 | { | 314 | { |
315 | struct inode *inode = file->f_path.dentry->d_inode; | 315 | struct inode *inode = file_inode(file); |
316 | int err; | 316 | int err; |
317 | mutex_lock(&inode->i_mutex); | 317 | mutex_lock(&inode->i_mutex); |
318 | err = ps3flash_writeback(ps3flash_dev); | 318 | err = ps3flash_writeback(ps3flash_dev); |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 54a3a6d09819..f3223aac4df1 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -80,7 +80,7 @@ static int raw_open(struct inode *inode, struct file *filp) | |||
80 | filp->f_flags |= O_DIRECT; | 80 | filp->f_flags |= O_DIRECT; |
81 | filp->f_mapping = bdev->bd_inode->i_mapping; | 81 | filp->f_mapping = bdev->bd_inode->i_mapping; |
82 | if (++raw_devices[minor].inuse == 1) | 82 | if (++raw_devices[minor].inuse == 1) |
83 | filp->f_path.dentry->d_inode->i_mapping = | 83 | file_inode(filp)->i_mapping = |
84 | bdev->bd_inode->i_mapping; | 84 | bdev->bd_inode->i_mapping; |
85 | filp->private_data = bdev; | 85 | filp->private_data = bdev; |
86 | mutex_unlock(&raw_mutex); | 86 | mutex_unlock(&raw_mutex); |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 6386a98e43c1..bf2349dbbf7f 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -938,7 +938,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf, | |||
938 | } | 938 | } |
939 | 939 | ||
940 | if (ret > 0) { | 940 | if (ret > 0) { |
941 | struct inode *inode = file->f_path.dentry->d_inode; | 941 | struct inode *inode = file_inode(file); |
942 | inode->i_atime = current_fs_time(inode->i_sb); | 942 | inode->i_atime = current_fs_time(inode->i_sb); |
943 | } | 943 | } |
944 | 944 | ||
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index 34c63f85104d..47b9fdfcf083 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
@@ -164,7 +164,7 @@ static ssize_t tanbac_tb0219_read(struct file *file, char __user *buf, size_t le | |||
164 | unsigned int minor; | 164 | unsigned int minor; |
165 | char value; | 165 | char value; |
166 | 166 | ||
167 | minor = iminor(file->f_path.dentry->d_inode); | 167 | minor = iminor(file_inode(file)); |
168 | switch (minor) { | 168 | switch (minor) { |
169 | case 0: | 169 | case 0: |
170 | value = get_led(); | 170 | value = get_led(); |
@@ -200,7 +200,7 @@ static ssize_t tanbac_tb0219_write(struct file *file, const char __user *data, | |||
200 | int retval = 0; | 200 | int retval = 0; |
201 | char c; | 201 | char c; |
202 | 202 | ||
203 | minor = iminor(file->f_path.dentry->d_inode); | 203 | minor = iminor(file_inode(file)); |
204 | switch (minor) { | 204 | switch (minor) { |
205 | case 0: | 205 | case 0: |
206 | type = TYPE_LED; | 206 | type = TYPE_LED; |
diff --git a/drivers/gpu/drm/gma500/gtt.c b/drivers/gpu/drm/gma500/gtt.c index 04a371aceb34..054e26e769ec 100644 --- a/drivers/gpu/drm/gma500/gtt.c +++ b/drivers/gpu/drm/gma500/gtt.c | |||
@@ -202,7 +202,7 @@ static int psb_gtt_attach_pages(struct gtt_range *gt) | |||
202 | WARN_ON(gt->pages); | 202 | WARN_ON(gt->pages); |
203 | 203 | ||
204 | /* This is the shared memory object that backs the GEM resource */ | 204 | /* This is the shared memory object that backs the GEM resource */ |
205 | inode = gt->gem.filp->f_path.dentry->d_inode; | 205 | inode = file_inode(gt->gem.filp); |
206 | mapping = inode->i_mapping; | 206 | mapping = inode->i_mapping; |
207 | 207 | ||
208 | gt->pages = kmalloc(pages * sizeof(struct page *), GFP_KERNEL); | 208 | gt->pages = kmalloc(pages * sizeof(struct page *), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 8413ffced815..0e207e6e0df8 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1618,7 +1618,7 @@ i915_gem_object_truncate(struct drm_i915_gem_object *obj) | |||
1618 | * To do this we must instruct the shmfs to drop all of its | 1618 | * To do this we must instruct the shmfs to drop all of its |
1619 | * backing pages, *now*. | 1619 | * backing pages, *now*. |
1620 | */ | 1620 | */ |
1621 | inode = obj->base.filp->f_path.dentry->d_inode; | 1621 | inode = file_inode(obj->base.filp); |
1622 | shmem_truncate_range(inode, 0, (loff_t)-1); | 1622 | shmem_truncate_range(inode, 0, (loff_t)-1); |
1623 | 1623 | ||
1624 | obj->madv = __I915_MADV_PURGED; | 1624 | obj->madv = __I915_MADV_PURGED; |
@@ -1783,7 +1783,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) | |||
1783 | * | 1783 | * |
1784 | * Fail silently without starting the shrinker | 1784 | * Fail silently without starting the shrinker |
1785 | */ | 1785 | */ |
1786 | mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping; | 1786 | mapping = file_inode(obj->base.filp)->i_mapping; |
1787 | gfp = mapping_gfp_mask(mapping); | 1787 | gfp = mapping_gfp_mask(mapping); |
1788 | gfp |= __GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD; | 1788 | gfp |= __GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD; |
1789 | gfp &= ~(__GFP_IO | __GFP_WAIT); | 1789 | gfp &= ~(__GFP_IO | __GFP_WAIT); |
@@ -3747,7 +3747,7 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev, | |||
3747 | mask |= __GFP_DMA32; | 3747 | mask |= __GFP_DMA32; |
3748 | } | 3748 | } |
3749 | 3749 | ||
3750 | mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping; | 3750 | mapping = file_inode(obj->base.filp)->i_mapping; |
3751 | mapping_set_gfp_mask(mapping, mask); | 3751 | mapping_set_gfp_mask(mapping, mask); |
3752 | 3752 | ||
3753 | i915_gem_object_init(obj, &i915_gem_object_ops); | 3753 | i915_gem_object_init(obj, &i915_gem_object_ops); |
@@ -4232,7 +4232,7 @@ void i915_gem_free_all_phys_object(struct drm_device *dev) | |||
4232 | void i915_gem_detach_phys_object(struct drm_device *dev, | 4232 | void i915_gem_detach_phys_object(struct drm_device *dev, |
4233 | struct drm_i915_gem_object *obj) | 4233 | struct drm_i915_gem_object *obj) |
4234 | { | 4234 | { |
4235 | struct address_space *mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping; | 4235 | struct address_space *mapping = file_inode(obj->base.filp)->i_mapping; |
4236 | char *vaddr; | 4236 | char *vaddr; |
4237 | int i; | 4237 | int i; |
4238 | int page_count; | 4238 | int page_count; |
@@ -4268,7 +4268,7 @@ i915_gem_attach_phys_object(struct drm_device *dev, | |||
4268 | int id, | 4268 | int id, |
4269 | int align) | 4269 | int align) |
4270 | { | 4270 | { |
4271 | struct address_space *mapping = obj->base.filp->f_path.dentry->d_inode->i_mapping; | 4271 | struct address_space *mapping = file_inode(obj->base.filp)->i_mapping; |
4272 | drm_i915_private_t *dev_priv = dev->dev_private; | 4272 | drm_i915_private_t *dev_priv = dev->dev_private; |
4273 | int ret = 0; | 4273 | int ret = 0; |
4274 | int page_count; | 4274 | int page_count; |
diff --git a/drivers/gpu/drm/omapdrm/omap_gem_helpers.c b/drivers/gpu/drm/omapdrm/omap_gem_helpers.c index e4a66a35fc6a..f9eb679eb79b 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem_helpers.c +++ b/drivers/gpu/drm/omapdrm/omap_gem_helpers.c | |||
@@ -40,7 +40,7 @@ struct page **_drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask) | |||
40 | int i, npages; | 40 | int i, npages; |
41 | 41 | ||
42 | /* This is the shared memory object that backs the GEM resource */ | 42 | /* This is the shared memory object that backs the GEM resource */ |
43 | inode = obj->filp->f_path.dentry->d_inode; | 43 | inode = file_inode(obj->filp); |
44 | mapping = inode->i_mapping; | 44 | mapping = inode->i_mapping; |
45 | 45 | ||
46 | npages = obj->size >> PAGE_SHIFT; | 46 | npages = obj->size >> PAGE_SHIFT; |
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 7d759a430294..5e93a52d4f2c 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c | |||
@@ -296,7 +296,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm) | |||
296 | swap_storage = ttm->swap_storage; | 296 | swap_storage = ttm->swap_storage; |
297 | BUG_ON(swap_storage == NULL); | 297 | BUG_ON(swap_storage == NULL); |
298 | 298 | ||
299 | swap_space = swap_storage->f_path.dentry->d_inode->i_mapping; | 299 | swap_space = file_inode(swap_storage)->i_mapping; |
300 | 300 | ||
301 | for (i = 0; i < ttm->num_pages; ++i) { | 301 | for (i = 0; i < ttm->num_pages; ++i) { |
302 | from_page = shmem_read_mapping_page(swap_space, i); | 302 | from_page = shmem_read_mapping_page(swap_space, i); |
@@ -345,7 +345,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) | |||
345 | } else | 345 | } else |
346 | swap_storage = persistent_swap_storage; | 346 | swap_storage = persistent_swap_storage; |
347 | 347 | ||
348 | swap_space = swap_storage->f_path.dentry->d_inode->i_mapping; | 348 | swap_space = file_inode(swap_storage)->i_mapping; |
349 | 349 | ||
350 | for (i = 0; i < ttm->num_pages; ++i) { | 350 | for (i = 0; i < ttm->num_pages; ++i) { |
351 | from_page = ttm->pages[i]; | 351 | from_page = ttm->pages[i]; |
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index afd212c99216..3816270ba49b 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c | |||
@@ -137,7 +137,7 @@ static int udl_gem_get_pages(struct udl_gem_object *obj, gfp_t gfpmask) | |||
137 | if (obj->pages == NULL) | 137 | if (obj->pages == NULL) |
138 | return -ENOMEM; | 138 | return -ENOMEM; |
139 | 139 | ||
140 | inode = obj->base.filp->f_path.dentry->d_inode; | 140 | inode = file_inode(obj->base.filp); |
141 | mapping = inode->i_mapping; | 141 | mapping = inode->i_mapping; |
142 | gfpmask |= mapping_gfp_mask(mapping); | 142 | gfpmask |= mapping_gfp_mask(mapping); |
143 | 143 | ||
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c index b685b04dbf9d..d7437ef5c695 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c | |||
@@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(roccat_disconnect); | |||
378 | 378 | ||
379 | static long roccat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 379 | static long roccat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
380 | { | 380 | { |
381 | struct inode *inode = file->f_path.dentry->d_inode; | 381 | struct inode *inode = file_inode(file); |
382 | struct roccat_device *device; | 382 | struct roccat_device *device; |
383 | unsigned int minor = iminor(inode); | 383 | unsigned int minor = iminor(inode); |
384 | long retval = 0; | 384 | long retval = 0; |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index f3bbbce8353b..a7451632ceb4 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -108,7 +108,7 @@ out: | |||
108 | * This function is to be called with the minors_lock mutex held */ | 108 | * This function is to be called with the minors_lock mutex held */ |
109 | static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) | 109 | static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) |
110 | { | 110 | { |
111 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 111 | unsigned int minor = iminor(file_inode(file)); |
112 | struct hid_device *dev; | 112 | struct hid_device *dev; |
113 | __u8 *buf; | 113 | __u8 *buf; |
114 | int ret = 0; | 114 | int ret = 0; |
@@ -176,7 +176,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t | |||
176 | * mutex held. */ | 176 | * mutex held. */ |
177 | static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) | 177 | static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) |
178 | { | 178 | { |
179 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 179 | unsigned int minor = iminor(file_inode(file)); |
180 | struct hid_device *dev; | 180 | struct hid_device *dev; |
181 | __u8 *buf; | 181 | __u8 *buf; |
182 | int ret = 0, len; | 182 | int ret = 0, len; |
@@ -340,7 +340,7 @@ unlock: | |||
340 | static long hidraw_ioctl(struct file *file, unsigned int cmd, | 340 | static long hidraw_ioctl(struct file *file, unsigned int cmd, |
341 | unsigned long arg) | 341 | unsigned long arg) |
342 | { | 342 | { |
343 | struct inode *inode = file->f_path.dentry->d_inode; | 343 | struct inode *inode = file_inode(file); |
344 | unsigned int minor = iminor(inode); | 344 | unsigned int minor = iminor(inode); |
345 | long ret = 0; | 345 | long ret = 0; |
346 | struct hidraw *dev; | 346 | struct hidraw *dev; |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 5ec2261574ec..c3ccdea3d180 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -148,7 +148,7 @@ static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count, | |||
148 | return -ENOMEM; | 148 | return -ENOMEM; |
149 | 149 | ||
150 | pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n", | 150 | pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n", |
151 | iminor(file->f_path.dentry->d_inode), count); | 151 | iminor(file_inode(file)), count); |
152 | 152 | ||
153 | ret = i2c_master_recv(client, tmp, count); | 153 | ret = i2c_master_recv(client, tmp, count); |
154 | if (ret >= 0) | 154 | if (ret >= 0) |
@@ -172,7 +172,7 @@ static ssize_t i2cdev_write(struct file *file, const char __user *buf, | |||
172 | return PTR_ERR(tmp); | 172 | return PTR_ERR(tmp); |
173 | 173 | ||
174 | pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n", | 174 | pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n", |
175 | iminor(file->f_path.dentry->d_inode), count); | 175 | iminor(file_inode(file)), count); |
176 | 176 | ||
177 | ret = i2c_master_send(client, tmp, count); | 177 | ret = i2c_master_send(client, tmp, count); |
178 | kfree(tmp); | 178 | kfree(tmp); |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index a3133d7b2a0c..2abcc4790f12 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -333,7 +333,7 @@ static int ide_settings_proc_open(struct inode *inode, struct file *file) | |||
333 | static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer, | 333 | static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer, |
334 | size_t count, loff_t *pos) | 334 | size_t count, loff_t *pos) |
335 | { | 335 | { |
336 | ide_drive_t *drive = (ide_drive_t *) PDE(file->f_path.dentry->d_inode)->data; | 336 | ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data; |
337 | char name[MAX_LEN + 1]; | 337 | char name[MAX_LEN + 1]; |
338 | int for_real = 0, mul_factor, div_factor; | 338 | int for_real = 0, mul_factor, div_factor; |
339 | unsigned long n; | 339 | unsigned long n; |
@@ -558,7 +558,7 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) | |||
558 | static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer, | 558 | static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer, |
559 | size_t count, loff_t *pos) | 559 | size_t count, loff_t *pos) |
560 | { | 560 | { |
561 | ide_drive_t *drive = (ide_drive_t *) PDE(file->f_path.dentry->d_inode)->data; | 561 | ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data; |
562 | char name[32]; | 562 | char name[32]; |
563 | 563 | ||
564 | if (!capable(CAP_SYS_ADMIN)) | 564 | if (!capable(CAP_SYS_ADMIN)) |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 3983a0552775..e71d834c922a 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -731,7 +731,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, | |||
731 | goto err_tree_mutex_unlock; | 731 | goto err_tree_mutex_unlock; |
732 | } | 732 | } |
733 | 733 | ||
734 | inode = f.file->f_path.dentry->d_inode; | 734 | inode = file_inode(f.file); |
735 | xrcd = find_xrcd(file->device, inode); | 735 | xrcd = find_xrcd(file->device, inode); |
736 | if (!xrcd && !(cmd.oflags & O_CREAT)) { | 736 | if (!xrcd && !(cmd.oflags & O_CREAT)) { |
737 | /* no file descriptor. Need CREATE flag */ | 737 | /* no file descriptor. Need CREATE flag */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index 3eb7e454849b..aed8afee56da 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -1864,9 +1864,9 @@ static int ipath_assign_port(struct file *fp, | |||
1864 | goto done_chk_sdma; | 1864 | goto done_chk_sdma; |
1865 | } | 1865 | } |
1866 | 1866 | ||
1867 | i_minor = iminor(fp->f_path.dentry->d_inode) - IPATH_USER_MINOR_BASE; | 1867 | i_minor = iminor(file_inode(fp)) - IPATH_USER_MINOR_BASE; |
1868 | ipath_cdbg(VERBOSE, "open on dev %lx (minor %d)\n", | 1868 | ipath_cdbg(VERBOSE, "open on dev %lx (minor %d)\n", |
1869 | (long)fp->f_path.dentry->d_inode->i_rdev, i_minor); | 1869 | (long)file_inode(fp)->i_rdev, i_minor); |
1870 | 1870 | ||
1871 | if (i_minor) | 1871 | if (i_minor) |
1872 | ret = find_free_port(i_minor - 1, fp, uinfo); | 1872 | ret = find_free_port(i_minor - 1, fp, uinfo); |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index a4de9d58e9b4..a479375a8fd8 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
@@ -113,7 +113,7 @@ static ssize_t atomic_counters_read(struct file *file, char __user *buf, | |||
113 | struct infinipath_counters counters; | 113 | struct infinipath_counters counters; |
114 | struct ipath_devdata *dd; | 114 | struct ipath_devdata *dd; |
115 | 115 | ||
116 | dd = file->f_path.dentry->d_inode->i_private; | 116 | dd = file_inode(file)->i_private; |
117 | dd->ipath_f_read_counters(dd, &counters); | 117 | dd->ipath_f_read_counters(dd, &counters); |
118 | 118 | ||
119 | return simple_read_from_buffer(buf, count, ppos, &counters, | 119 | return simple_read_from_buffer(buf, count, ppos, &counters, |
@@ -154,7 +154,7 @@ static ssize_t flash_read(struct file *file, char __user *buf, | |||
154 | goto bail; | 154 | goto bail; |
155 | } | 155 | } |
156 | 156 | ||
157 | dd = file->f_path.dentry->d_inode->i_private; | 157 | dd = file_inode(file)->i_private; |
158 | if (ipath_eeprom_read(dd, pos, tmp, count)) { | 158 | if (ipath_eeprom_read(dd, pos, tmp, count)) { |
159 | ipath_dev_err(dd, "failed to read from flash\n"); | 159 | ipath_dev_err(dd, "failed to read from flash\n"); |
160 | ret = -ENXIO; | 160 | ret = -ENXIO; |
@@ -207,7 +207,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
207 | goto bail_tmp; | 207 | goto bail_tmp; |
208 | } | 208 | } |
209 | 209 | ||
210 | dd = file->f_path.dentry->d_inode->i_private; | 210 | dd = file_inode(file)->i_private; |
211 | if (ipath_eeprom_write(dd, pos, tmp, count)) { | 211 | if (ipath_eeprom_write(dd, pos, tmp, count)) { |
212 | ret = -ENXIO; | 212 | ret = -ENXIO; |
213 | ipath_dev_err(dd, "failed to write to flash\n"); | 213 | ipath_dev_err(dd, "failed to write to flash\n"); |
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c index 959a5c4ff812..4f7aa301b3b1 100644 --- a/drivers/infiniband/hw/qib/qib_file_ops.c +++ b/drivers/infiniband/hw/qib/qib_file_ops.c | |||
@@ -1524,7 +1524,7 @@ static int qib_assign_ctxt(struct file *fp, const struct qib_user_info *uinfo) | |||
1524 | } | 1524 | } |
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | i_minor = iminor(fp->f_dentry->d_inode) - QIB_USER_MINOR_BASE; | 1527 | i_minor = iminor(file_inode(fp)) - QIB_USER_MINOR_BASE; |
1528 | if (i_minor) | 1528 | if (i_minor) |
1529 | ret = find_free_ctxt(i_minor - 1, fp, uinfo); | 1529 | ret = find_free_ctxt(i_minor - 1, fp, uinfo); |
1530 | else | 1530 | else |
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index 65a2a23f6f8a..644bd6f6467c 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | static struct super_block *qib_super; | 46 | static struct super_block *qib_super; |
47 | 47 | ||
48 | #define private2dd(file) ((file)->f_dentry->d_inode->i_private) | 48 | #define private2dd(file) (file_inode(file)->i_private) |
49 | 49 | ||
50 | static int qibfs_mknod(struct inode *dir, struct dentry *dentry, | 50 | static int qibfs_mknod(struct inode *dir, struct dentry *dentry, |
51 | umode_t mode, const struct file_operations *fops, | 51 | umode_t mode, const struct file_operations *fops, |
@@ -171,7 +171,7 @@ static const struct file_operations cntr_ops[] = { | |||
171 | }; | 171 | }; |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Could use file->f_dentry->d_inode->i_ino to figure out which file, | 174 | * Could use file_inode(file)->i_ino to figure out which file, |
175 | * instead of separate routine for each, but for now, this works... | 175 | * instead of separate routine for each, but for now, this works... |
176 | */ | 176 | */ |
177 | 177 | ||
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index eb0109f98946..b34e5fd7fd9e 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c | |||
@@ -968,7 +968,6 @@ static ssize_t smmu_debugfs_stats_write(struct file *file, | |||
968 | { | 968 | { |
969 | struct smmu_debugfs_info *info; | 969 | struct smmu_debugfs_info *info; |
970 | struct smmu_device *smmu; | 970 | struct smmu_device *smmu; |
971 | struct dentry *dent; | ||
972 | int i; | 971 | int i; |
973 | enum { | 972 | enum { |
974 | _OFF = 0, | 973 | _OFF = 0, |
@@ -996,8 +995,7 @@ static ssize_t smmu_debugfs_stats_write(struct file *file, | |||
996 | if (i == ARRAY_SIZE(command)) | 995 | if (i == ARRAY_SIZE(command)) |
997 | return -EINVAL; | 996 | return -EINVAL; |
998 | 997 | ||
999 | dent = file->f_dentry; | 998 | info = file_inode(file)->i_private; |
1000 | info = dent->d_inode->i_private; | ||
1001 | smmu = info->smmu; | 999 | smmu = info->smmu; |
1002 | 1000 | ||
1003 | offs = SMMU_CACHE_CONFIG(info->cache); | 1001 | offs = SMMU_CACHE_CONFIG(info->cache); |
@@ -1032,15 +1030,11 @@ static ssize_t smmu_debugfs_stats_write(struct file *file, | |||
1032 | 1030 | ||
1033 | static int smmu_debugfs_stats_show(struct seq_file *s, void *v) | 1031 | static int smmu_debugfs_stats_show(struct seq_file *s, void *v) |
1034 | { | 1032 | { |
1035 | struct smmu_debugfs_info *info; | 1033 | struct smmu_debugfs_info *info = s->private; |
1036 | struct smmu_device *smmu; | 1034 | struct smmu_device *smmu = info->smmu; |
1037 | struct dentry *dent; | ||
1038 | int i; | 1035 | int i; |
1039 | const char * const stats[] = { "hit", "miss", }; | 1036 | const char * const stats[] = { "hit", "miss", }; |
1040 | 1037 | ||
1041 | dent = d_find_alias(s->private); | ||
1042 | info = dent->d_inode->i_private; | ||
1043 | smmu = info->smmu; | ||
1044 | 1038 | ||
1045 | for (i = 0; i < ARRAY_SIZE(stats); i++) { | 1039 | for (i = 0; i < ARRAY_SIZE(stats); i++) { |
1046 | u32 val; | 1040 | u32 val; |
@@ -1054,14 +1048,12 @@ static int smmu_debugfs_stats_show(struct seq_file *s, void *v) | |||
1054 | stats[i], val, offs); | 1048 | stats[i], val, offs); |
1055 | } | 1049 | } |
1056 | seq_printf(s, "\n"); | 1050 | seq_printf(s, "\n"); |
1057 | dput(dent); | ||
1058 | |||
1059 | return 0; | 1051 | return 0; |
1060 | } | 1052 | } |
1061 | 1053 | ||
1062 | static int smmu_debugfs_stats_open(struct inode *inode, struct file *file) | 1054 | static int smmu_debugfs_stats_open(struct inode *inode, struct file *file) |
1063 | { | 1055 | { |
1064 | return single_open(file, smmu_debugfs_stats_show, inode); | 1056 | return single_open(file, smmu_debugfs_stats_show, inode->i_private); |
1065 | } | 1057 | } |
1066 | 1058 | ||
1067 | static const struct file_operations smmu_debugfs_stats_fops = { | 1059 | static const struct file_operations smmu_debugfs_stats_fops = { |
diff --git a/drivers/isdn/hardware/eicon/divasproc.c b/drivers/isdn/hardware/eicon/divasproc.c index af4fd3d036c1..3a4165c61196 100644 --- a/drivers/isdn/hardware/eicon/divasproc.c +++ b/drivers/isdn/hardware/eicon/divasproc.c | |||
@@ -145,7 +145,7 @@ void remove_divas_proc(void) | |||
145 | static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer, | 145 | static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer, |
146 | size_t count, loff_t *pos) | 146 | size_t count, loff_t *pos) |
147 | { | 147 | { |
148 | diva_os_xdi_adapter_t *a = PDE(file->f_path.dentry->d_inode)->data; | 148 | diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data; |
149 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; | 149 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; |
150 | 150 | ||
151 | if ((count == 1) || (count == 2)) { | 151 | if ((count == 1) || (count == 2)) { |
@@ -172,7 +172,7 @@ static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer, | |||
172 | static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer, | 172 | static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer, |
173 | size_t count, loff_t *pos) | 173 | size_t count, loff_t *pos) |
174 | { | 174 | { |
175 | diva_os_xdi_adapter_t *a = PDE(file->f_path.dentry->d_inode)->data; | 175 | diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data; |
176 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; | 176 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; |
177 | 177 | ||
178 | if ((count == 1) || (count == 2)) { | 178 | if ((count == 1) || (count == 2)) { |
@@ -251,7 +251,7 @@ static const struct file_operations grp_opt_proc_fops = { | |||
251 | static ssize_t info_proc_write(struct file *file, const char __user *buffer, | 251 | static ssize_t info_proc_write(struct file *file, const char __user *buffer, |
252 | size_t count, loff_t *pos) | 252 | size_t count, loff_t *pos) |
253 | { | 253 | { |
254 | diva_os_xdi_adapter_t *a = PDE(file->f_path.dentry->d_inode)->data; | 254 | diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data; |
255 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; | 255 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; |
256 | char c[4]; | 256 | char c[4]; |
257 | 257 | ||
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 88e4f0ee073c..9a3ce93665c5 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -173,7 +173,7 @@ hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t *off) | |||
173 | { | 173 | { |
174 | struct log_data *inf; | 174 | struct log_data *inf; |
175 | int len; | 175 | int len; |
176 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 176 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
177 | struct procdata *pd = NULL; | 177 | struct procdata *pd = NULL; |
178 | hysdn_card *card; | 178 | hysdn_card *card; |
179 | 179 | ||
@@ -319,7 +319,7 @@ static unsigned int | |||
319 | hysdn_log_poll(struct file *file, poll_table *wait) | 319 | hysdn_log_poll(struct file *file, poll_table *wait) |
320 | { | 320 | { |
321 | unsigned int mask = 0; | 321 | unsigned int mask = 0; |
322 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 322 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
323 | hysdn_card *card; | 323 | hysdn_card *card; |
324 | struct procdata *pd = NULL; | 324 | struct procdata *pd = NULL; |
325 | 325 | ||
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index b87d9e577be2..9bb12ba3191f 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -1058,7 +1058,7 @@ isdn_info_update(void) | |||
1058 | static ssize_t | 1058 | static ssize_t |
1059 | isdn_read(struct file *file, char __user *buf, size_t count, loff_t *off) | 1059 | isdn_read(struct file *file, char __user *buf, size_t count, loff_t *off) |
1060 | { | 1060 | { |
1061 | uint minor = iminor(file->f_path.dentry->d_inode); | 1061 | uint minor = iminor(file_inode(file)); |
1062 | int len = 0; | 1062 | int len = 0; |
1063 | int drvidx; | 1063 | int drvidx; |
1064 | int chidx; | 1064 | int chidx; |
@@ -1165,7 +1165,7 @@ out: | |||
1165 | static ssize_t | 1165 | static ssize_t |
1166 | isdn_write(struct file *file, const char __user *buf, size_t count, loff_t *off) | 1166 | isdn_write(struct file *file, const char __user *buf, size_t count, loff_t *off) |
1167 | { | 1167 | { |
1168 | uint minor = iminor(file->f_path.dentry->d_inode); | 1168 | uint minor = iminor(file_inode(file)); |
1169 | int drvidx; | 1169 | int drvidx; |
1170 | int chidx; | 1170 | int chidx; |
1171 | int retval; | 1171 | int retval; |
@@ -1228,7 +1228,7 @@ static unsigned int | |||
1228 | isdn_poll(struct file *file, poll_table *wait) | 1228 | isdn_poll(struct file *file, poll_table *wait) |
1229 | { | 1229 | { |
1230 | unsigned int mask = 0; | 1230 | unsigned int mask = 0; |
1231 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 1231 | unsigned int minor = iminor(file_inode(file)); |
1232 | int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); | 1232 | int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); |
1233 | 1233 | ||
1234 | mutex_lock(&isdn_mutex); | 1234 | mutex_lock(&isdn_mutex); |
@@ -1269,7 +1269,7 @@ out: | |||
1269 | static int | 1269 | static int |
1270 | isdn_ioctl(struct file *file, uint cmd, ulong arg) | 1270 | isdn_ioctl(struct file *file, uint cmd, ulong arg) |
1271 | { | 1271 | { |
1272 | uint minor = iminor(file->f_path.dentry->d_inode); | 1272 | uint minor = iminor(file_inode(file)); |
1273 | isdn_ctrl c; | 1273 | isdn_ctrl c; |
1274 | int drvidx; | 1274 | int drvidx; |
1275 | int ret; | 1275 | int ret; |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 61d78fa03b1a..38ceac5053a0 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -668,7 +668,7 @@ isdn_ppp_poll(struct file *file, poll_table *wait) | |||
668 | 668 | ||
669 | if (is->debug & 0x2) | 669 | if (is->debug & 0x2) |
670 | printk(KERN_DEBUG "isdn_ppp_poll: minor: %d\n", | 670 | printk(KERN_DEBUG "isdn_ppp_poll: minor: %d\n", |
671 | iminor(file->f_path.dentry->d_inode)); | 671 | iminor(file_inode(file))); |
672 | 672 | ||
673 | /* just registers wait_queue hook. This doesn't really wait. */ | 673 | /* just registers wait_queue hook. This doesn't really wait. */ |
674 | poll_wait(file, &is->wq, wait); | 674 | poll_wait(file, &is->wq, wait); |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 7155945f8eb8..4fd9d6aeff6a 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -337,7 +337,7 @@ static int read_page(struct file *file, unsigned long index, | |||
337 | struct page *page) | 337 | struct page *page) |
338 | { | 338 | { |
339 | int ret = 0; | 339 | int ret = 0; |
340 | struct inode *inode = file->f_path.dentry->d_inode; | 340 | struct inode *inode = file_inode(file); |
341 | struct buffer_head *bh; | 341 | struct buffer_head *bh; |
342 | sector_t block; | 342 | sector_t block; |
343 | 343 | ||
@@ -755,7 +755,7 @@ static void bitmap_file_unmap(struct bitmap_storage *store) | |||
755 | free_buffers(sb_page); | 755 | free_buffers(sb_page); |
756 | 756 | ||
757 | if (file) { | 757 | if (file) { |
758 | struct inode *inode = file->f_path.dentry->d_inode; | 758 | struct inode *inode = file_inode(file); |
759 | invalidate_mapping_pages(inode->i_mapping, 0, -1); | 759 | invalidate_mapping_pages(inode->i_mapping, 0, -1); |
760 | fput(file); | 760 | fput(file); |
761 | } | 761 | } |
diff --git a/drivers/media/pci/zoran/zoran_procfs.c b/drivers/media/pci/zoran/zoran_procfs.c index f1423b777db1..e084b0a21b1b 100644 --- a/drivers/media/pci/zoran/zoran_procfs.c +++ b/drivers/media/pci/zoran/zoran_procfs.c | |||
@@ -137,7 +137,7 @@ static int zoran_open(struct inode *inode, struct file *file) | |||
137 | static ssize_t zoran_write(struct file *file, const char __user *buffer, | 137 | static ssize_t zoran_write(struct file *file, const char __user *buffer, |
138 | size_t count, loff_t *ppos) | 138 | size_t count, loff_t *ppos) |
139 | { | 139 | { |
140 | struct zoran *zr = PDE(file->f_path.dentry->d_inode)->data; | 140 | struct zoran *zr = PDE(file_inode(file))->data; |
141 | char *string, *sp; | 141 | char *string, *sp; |
142 | char *line, *ldelim, *varname, *svar, *tdelim; | 142 | char *line, *ldelim, *varname, *svar, *tdelim; |
143 | 143 | ||
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index ca12d3289bfe..5247d94fea29 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c | |||
@@ -531,7 +531,7 @@ EXPORT_SYMBOL(lirc_dev_fop_close); | |||
531 | 531 | ||
532 | unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) | 532 | unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) |
533 | { | 533 | { |
534 | struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; | 534 | struct irctl *ir = irctls[iminor(file_inode(file))]; |
535 | unsigned int ret; | 535 | unsigned int ret; |
536 | 536 | ||
537 | if (!ir) { | 537 | if (!ir) { |
@@ -565,7 +565,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
565 | { | 565 | { |
566 | __u32 mode; | 566 | __u32 mode; |
567 | int result = 0; | 567 | int result = 0; |
568 | struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; | 568 | struct irctl *ir = irctls[iminor(file_inode(file))]; |
569 | 569 | ||
570 | if (!ir) { | 570 | if (!ir) { |
571 | printk(KERN_ERR "lirc_dev: %s: no irctl found!\n", __func__); | 571 | printk(KERN_ERR "lirc_dev: %s: no irctl found!\n", __func__); |
@@ -650,7 +650,7 @@ ssize_t lirc_dev_fop_read(struct file *file, | |||
650 | size_t length, | 650 | size_t length, |
651 | loff_t *ppos) | 651 | loff_t *ppos) |
652 | { | 652 | { |
653 | struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; | 653 | struct irctl *ir = irctls[iminor(file_inode(file))]; |
654 | unsigned char *buf; | 654 | unsigned char *buf; |
655 | int ret = 0, written = 0; | 655 | int ret = 0, written = 0; |
656 | DECLARE_WAITQUEUE(wait, current); | 656 | DECLARE_WAITQUEUE(wait, current); |
@@ -752,16 +752,7 @@ EXPORT_SYMBOL(lirc_dev_fop_read); | |||
752 | 752 | ||
753 | void *lirc_get_pdata(struct file *file) | 753 | void *lirc_get_pdata(struct file *file) |
754 | { | 754 | { |
755 | void *data = NULL; | 755 | return irctls[iminor(file_inode(file))]->d.data; |
756 | |||
757 | if (file && file->f_dentry && file->f_dentry->d_inode && | ||
758 | file->f_dentry->d_inode->i_rdev) { | ||
759 | struct irctl *ir; | ||
760 | ir = irctls[iminor(file->f_dentry->d_inode)]; | ||
761 | data = ir->d.data; | ||
762 | } | ||
763 | |||
764 | return data; | ||
765 | } | 756 | } |
766 | EXPORT_SYMBOL(lirc_get_pdata); | 757 | EXPORT_SYMBOL(lirc_get_pdata); |
767 | 758 | ||
@@ -769,7 +760,7 @@ EXPORT_SYMBOL(lirc_get_pdata); | |||
769 | ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer, | 760 | ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer, |
770 | size_t length, loff_t *ppos) | 761 | size_t length, loff_t *ppos) |
771 | { | 762 | { |
772 | struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; | 763 | struct irctl *ir = irctls[iminor(file_inode(file))]; |
773 | 764 | ||
774 | if (!ir) { | 765 | if (!ir) { |
775 | printk(KERN_ERR "%s: called with invalid irctl\n", __func__); | 766 | printk(KERN_ERR "%s: called with invalid irctl\n", __func__); |
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 51b3a7713dcd..de1e9ab7db99 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c | |||
@@ -222,7 +222,7 @@ static struct class video_class = { | |||
222 | 222 | ||
223 | struct video_device *video_devdata(struct file *file) | 223 | struct video_device *video_devdata(struct file *file) |
224 | { | 224 | { |
225 | return video_device[iminor(file->f_path.dentry->d_inode)]; | 225 | return video_device[iminor(file_inode(file))]; |
226 | } | 226 | } |
227 | EXPORT_SYMBOL(video_devdata); | 227 | EXPORT_SYMBOL(video_devdata); |
228 | 228 | ||
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 818b65c85d12..8f30d385bfa3 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -1408,40 +1408,32 @@ static void clear_memalloc(int memalloc) | |||
1408 | current->flags &= ~PF_MEMALLOC; | 1408 | current->flags &= ~PF_MEMALLOC; |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | static ssize_t read_file(struct nandsim *ns, struct file *file, void *buf, size_t count, loff_t *pos) | 1411 | static ssize_t read_file(struct nandsim *ns, struct file *file, void *buf, size_t count, loff_t pos) |
1412 | { | 1412 | { |
1413 | mm_segment_t old_fs; | ||
1414 | ssize_t tx; | 1413 | ssize_t tx; |
1415 | int err, memalloc; | 1414 | int err, memalloc; |
1416 | 1415 | ||
1417 | err = get_pages(ns, file, count, *pos); | 1416 | err = get_pages(ns, file, count, pos); |
1418 | if (err) | 1417 | if (err) |
1419 | return err; | 1418 | return err; |
1420 | old_fs = get_fs(); | ||
1421 | set_fs(get_ds()); | ||
1422 | memalloc = set_memalloc(); | 1419 | memalloc = set_memalloc(); |
1423 | tx = vfs_read(file, (char __user *)buf, count, pos); | 1420 | tx = kernel_read(file, pos, buf, count); |
1424 | clear_memalloc(memalloc); | 1421 | clear_memalloc(memalloc); |
1425 | set_fs(old_fs); | ||
1426 | put_pages(ns); | 1422 | put_pages(ns); |
1427 | return tx; | 1423 | return tx; |
1428 | } | 1424 | } |
1429 | 1425 | ||
1430 | static ssize_t write_file(struct nandsim *ns, struct file *file, void *buf, size_t count, loff_t *pos) | 1426 | static ssize_t write_file(struct nandsim *ns, struct file *file, void *buf, size_t count, loff_t pos) |
1431 | { | 1427 | { |
1432 | mm_segment_t old_fs; | ||
1433 | ssize_t tx; | 1428 | ssize_t tx; |
1434 | int err, memalloc; | 1429 | int err, memalloc; |
1435 | 1430 | ||
1436 | err = get_pages(ns, file, count, *pos); | 1431 | err = get_pages(ns, file, count, pos); |
1437 | if (err) | 1432 | if (err) |
1438 | return err; | 1433 | return err; |
1439 | old_fs = get_fs(); | ||
1440 | set_fs(get_ds()); | ||
1441 | memalloc = set_memalloc(); | 1434 | memalloc = set_memalloc(); |
1442 | tx = vfs_write(file, (char __user *)buf, count, pos); | 1435 | tx = kernel_write(file, buf, count, pos); |
1443 | clear_memalloc(memalloc); | 1436 | clear_memalloc(memalloc); |
1444 | set_fs(old_fs); | ||
1445 | put_pages(ns); | 1437 | put_pages(ns); |
1446 | return tx; | 1438 | return tx; |
1447 | } | 1439 | } |
@@ -1511,7 +1503,7 @@ static void read_page(struct nandsim *ns, int num) | |||
1511 | if (do_read_error(ns, num)) | 1503 | if (do_read_error(ns, num)) |
1512 | return; | 1504 | return; |
1513 | pos = (loff_t)ns->regs.row * ns->geom.pgszoob + ns->regs.column + ns->regs.off; | 1505 | pos = (loff_t)ns->regs.row * ns->geom.pgszoob + ns->regs.column + ns->regs.off; |
1514 | tx = read_file(ns, ns->cfile, ns->buf.byte, num, &pos); | 1506 | tx = read_file(ns, ns->cfile, ns->buf.byte, num, pos); |
1515 | if (tx != num) { | 1507 | if (tx != num) { |
1516 | NS_ERR("read_page: read error for page %d ret %ld\n", ns->regs.row, (long)tx); | 1508 | NS_ERR("read_page: read error for page %d ret %ld\n", ns->regs.row, (long)tx); |
1517 | return; | 1509 | return; |
@@ -1573,7 +1565,7 @@ static int prog_page(struct nandsim *ns, int num) | |||
1573 | u_char *pg_off; | 1565 | u_char *pg_off; |
1574 | 1566 | ||
1575 | if (ns->cfile) { | 1567 | if (ns->cfile) { |
1576 | loff_t off, pos; | 1568 | loff_t off; |
1577 | ssize_t tx; | 1569 | ssize_t tx; |
1578 | int all; | 1570 | int all; |
1579 | 1571 | ||
@@ -1585,8 +1577,7 @@ static int prog_page(struct nandsim *ns, int num) | |||
1585 | memset(ns->file_buf, 0xff, ns->geom.pgszoob); | 1577 | memset(ns->file_buf, 0xff, ns->geom.pgszoob); |
1586 | } else { | 1578 | } else { |
1587 | all = 0; | 1579 | all = 0; |
1588 | pos = off; | 1580 | tx = read_file(ns, ns->cfile, pg_off, num, off); |
1589 | tx = read_file(ns, ns->cfile, pg_off, num, &pos); | ||
1590 | if (tx != num) { | 1581 | if (tx != num) { |
1591 | NS_ERR("prog_page: read error for page %d ret %ld\n", ns->regs.row, (long)tx); | 1582 | NS_ERR("prog_page: read error for page %d ret %ld\n", ns->regs.row, (long)tx); |
1592 | return -1; | 1583 | return -1; |
@@ -1595,16 +1586,15 @@ static int prog_page(struct nandsim *ns, int num) | |||
1595 | for (i = 0; i < num; i++) | 1586 | for (i = 0; i < num; i++) |
1596 | pg_off[i] &= ns->buf.byte[i]; | 1587 | pg_off[i] &= ns->buf.byte[i]; |
1597 | if (all) { | 1588 | if (all) { |
1598 | pos = (loff_t)ns->regs.row * ns->geom.pgszoob; | 1589 | loff_t pos = (loff_t)ns->regs.row * ns->geom.pgszoob; |
1599 | tx = write_file(ns, ns->cfile, ns->file_buf, ns->geom.pgszoob, &pos); | 1590 | tx = write_file(ns, ns->cfile, ns->file_buf, ns->geom.pgszoob, pos); |
1600 | if (tx != ns->geom.pgszoob) { | 1591 | if (tx != ns->geom.pgszoob) { |
1601 | NS_ERR("prog_page: write error for page %d ret %ld\n", ns->regs.row, (long)tx); | 1592 | NS_ERR("prog_page: write error for page %d ret %ld\n", ns->regs.row, (long)tx); |
1602 | return -1; | 1593 | return -1; |
1603 | } | 1594 | } |
1604 | ns->pages_written[ns->regs.row] = 1; | 1595 | ns->pages_written[ns->regs.row] = 1; |
1605 | } else { | 1596 | } else { |
1606 | pos = off; | 1597 | tx = write_file(ns, ns->cfile, pg_off, num, off); |
1607 | tx = write_file(ns, ns->cfile, pg_off, num, &pos); | ||
1608 | if (tx != num) { | 1598 | if (tx != num) { |
1609 | NS_ERR("prog_page: write error for page %d ret %ld\n", ns->regs.row, (long)tx); | 1599 | NS_ERR("prog_page: write error for page %d ret %ld\n", ns->regs.row, (long)tx); |
1610 | return -1; | 1600 | return -1; |
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index dfcc65b33e99..4f02848bb2bc 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -194,7 +194,7 @@ static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end, | |||
194 | { | 194 | { |
195 | struct ubi_volume_desc *desc = file->private_data; | 195 | struct ubi_volume_desc *desc = file->private_data; |
196 | struct ubi_device *ubi = desc->vol->ubi; | 196 | struct ubi_device *ubi = desc->vol->ubi; |
197 | struct inode *inode = file->f_path.dentry->d_inode; | 197 | struct inode *inode = file_inode(file); |
198 | int err; | 198 | int err; |
199 | mutex_lock(&inode->i_mutex); | 199 | mutex_lock(&inode->i_mutex); |
200 | err = ubi_sync(ubi->ubi_num); | 200 | err = ubi_sync(ubi->ubi_num); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c6c05bfef0e0..e707e31abd81 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -2347,7 +2347,7 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count, | |||
2347 | loff_t *ppos) | 2347 | loff_t *ppos) |
2348 | { | 2348 | { |
2349 | loff_t pos = *ppos; | 2349 | loff_t pos = *ppos; |
2350 | loff_t avail = file->f_path.dentry->d_inode->i_size; | 2350 | loff_t avail = file_inode(file)->i_size; |
2351 | unsigned int mem = (uintptr_t)file->private_data & 3; | 2351 | unsigned int mem = (uintptr_t)file->private_data & 3; |
2352 | struct adapter *adap = file->private_data - mem; | 2352 | struct adapter *adap = file->private_data - mem; |
2353 | 2353 | ||
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 0179cefae438..84734a805092 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -938,14 +938,14 @@ static int cosa_open(struct inode *inode, struct file *file) | |||
938 | int ret = 0; | 938 | int ret = 0; |
939 | 939 | ||
940 | mutex_lock(&cosa_chardev_mutex); | 940 | mutex_lock(&cosa_chardev_mutex); |
941 | if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS) | 941 | if ((n=iminor(file_inode(file))>>CARD_MINOR_BITS) |
942 | >= nr_cards) { | 942 | >= nr_cards) { |
943 | ret = -ENODEV; | 943 | ret = -ENODEV; |
944 | goto out; | 944 | goto out; |
945 | } | 945 | } |
946 | cosa = cosa_cards+n; | 946 | cosa = cosa_cards+n; |
947 | 947 | ||
948 | if ((n=iminor(file->f_path.dentry->d_inode) | 948 | if ((n=iminor(file_inode(file)) |
949 | & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels) { | 949 | & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels) { |
950 | ret = -ENODEV; | 950 | ret = -ENODEV; |
951 | goto out; | 951 | goto out; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index e7cf37f550d1..3109c0db66e1 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2778,7 +2778,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer, | |||
2778 | nr = nr * 10 + c; | 2778 | nr = nr * 10 + c; |
2779 | p++; | 2779 | p++; |
2780 | } while (--len); | 2780 | } while (--len); |
2781 | *(int *)PDE(file->f_path.dentry->d_inode)->data = nr; | 2781 | *(int *)PDE(file_inode(file))->data = nr; |
2782 | return count; | 2782 | return count; |
2783 | } | 2783 | } |
2784 | 2784 | ||
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 849357c1045c..445ffda715ad 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
@@ -139,17 +139,22 @@ static int __oprofilefs_create_file(struct super_block *sb, | |||
139 | struct dentry *dentry; | 139 | struct dentry *dentry; |
140 | struct inode *inode; | 140 | struct inode *inode; |
141 | 141 | ||
142 | mutex_lock(&root->d_inode->i_mutex); | ||
142 | dentry = d_alloc_name(root, name); | 143 | dentry = d_alloc_name(root, name); |
143 | if (!dentry) | 144 | if (!dentry) { |
145 | mutex_unlock(&root->d_inode->i_mutex); | ||
144 | return -ENOMEM; | 146 | return -ENOMEM; |
147 | } | ||
145 | inode = oprofilefs_get_inode(sb, S_IFREG | perm); | 148 | inode = oprofilefs_get_inode(sb, S_IFREG | perm); |
146 | if (!inode) { | 149 | if (!inode) { |
147 | dput(dentry); | 150 | dput(dentry); |
151 | mutex_unlock(&root->d_inode->i_mutex); | ||
148 | return -ENOMEM; | 152 | return -ENOMEM; |
149 | } | 153 | } |
150 | inode->i_fop = fops; | 154 | inode->i_fop = fops; |
155 | inode->i_private = priv; | ||
151 | d_add(dentry, inode); | 156 | d_add(dentry, inode); |
152 | dentry->d_inode->i_private = priv; | 157 | mutex_unlock(&root->d_inode->i_mutex); |
153 | return 0; | 158 | return 0; |
154 | } | 159 | } |
155 | 160 | ||
@@ -212,17 +217,22 @@ struct dentry *oprofilefs_mkdir(struct super_block *sb, | |||
212 | struct dentry *dentry; | 217 | struct dentry *dentry; |
213 | struct inode *inode; | 218 | struct inode *inode; |
214 | 219 | ||
220 | mutex_lock(&root->d_inode->i_mutex); | ||
215 | dentry = d_alloc_name(root, name); | 221 | dentry = d_alloc_name(root, name); |
216 | if (!dentry) | 222 | if (!dentry) { |
223 | mutex_unlock(&root->d_inode->i_mutex); | ||
217 | return NULL; | 224 | return NULL; |
225 | } | ||
218 | inode = oprofilefs_get_inode(sb, S_IFDIR | 0755); | 226 | inode = oprofilefs_get_inode(sb, S_IFDIR | 0755); |
219 | if (!inode) { | 227 | if (!inode) { |
220 | dput(dentry); | 228 | dput(dentry); |
229 | mutex_unlock(&root->d_inode->i_mutex); | ||
221 | return NULL; | 230 | return NULL; |
222 | } | 231 | } |
223 | inode->i_op = &simple_dir_inode_operations; | 232 | inode->i_op = &simple_dir_inode_operations; |
224 | inode->i_fop = &simple_dir_operations; | 233 | inode->i_fop = &simple_dir_operations; |
225 | d_add(dentry, inode); | 234 | d_add(dentry, inode); |
235 | mutex_unlock(&root->d_inode->i_mutex); | ||
226 | return dentry; | 236 | return dentry; |
227 | } | 237 | } |
228 | 238 | ||
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index f2f501e5b6a0..d4d800c54d86 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c | |||
@@ -179,7 +179,7 @@ static int led_proc_open(struct inode *inode, struct file *file) | |||
179 | static ssize_t led_proc_write(struct file *file, const char *buf, | 179 | static ssize_t led_proc_write(struct file *file, const char *buf, |
180 | size_t count, loff_t *pos) | 180 | size_t count, loff_t *pos) |
181 | { | 181 | { |
182 | void *data = PDE(file->f_path.dentry->d_inode)->data; | 182 | void *data = PDE(file_inode(file))->data; |
183 | char *cur, lbuf[32]; | 183 | char *cur, lbuf[32]; |
184 | int d; | 184 | int d; |
185 | 185 | ||
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 9b8505ccc56d..0b009470e6db 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -21,7 +21,7 @@ static loff_t | |||
21 | proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | 21 | proc_bus_pci_lseek(struct file *file, loff_t off, int whence) |
22 | { | 22 | { |
23 | loff_t new = -1; | 23 | loff_t new = -1; |
24 | struct inode *inode = file->f_path.dentry->d_inode; | 24 | struct inode *inode = file_inode(file); |
25 | 25 | ||
26 | mutex_lock(&inode->i_mutex); | 26 | mutex_lock(&inode->i_mutex); |
27 | switch (whence) { | 27 | switch (whence) { |
@@ -46,7 +46,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | |||
46 | static ssize_t | 46 | static ssize_t |
47 | proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 47 | proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) |
48 | { | 48 | { |
49 | const struct inode *ino = file->f_path.dentry->d_inode; | 49 | const struct inode *ino = file_inode(file); |
50 | const struct proc_dir_entry *dp = PDE(ino); | 50 | const struct proc_dir_entry *dp = PDE(ino); |
51 | struct pci_dev *dev = dp->data; | 51 | struct pci_dev *dev = dp->data; |
52 | unsigned int pos = *ppos; | 52 | unsigned int pos = *ppos; |
@@ -132,7 +132,7 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp | |||
132 | static ssize_t | 132 | static ssize_t |
133 | proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) | 133 | proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) |
134 | { | 134 | { |
135 | struct inode *ino = file->f_path.dentry->d_inode; | 135 | struct inode *ino = file_inode(file); |
136 | const struct proc_dir_entry *dp = PDE(ino); | 136 | const struct proc_dir_entry *dp = PDE(ino); |
137 | struct pci_dev *dev = dp->data; | 137 | struct pci_dev *dev = dp->data; |
138 | int pos = *ppos; | 138 | int pos = *ppos; |
@@ -212,7 +212,7 @@ struct pci_filp_private { | |||
212 | static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, | 212 | static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, |
213 | unsigned long arg) | 213 | unsigned long arg) |
214 | { | 214 | { |
215 | const struct proc_dir_entry *dp = PDE(file->f_dentry->d_inode); | 215 | const struct proc_dir_entry *dp = PDE(file_inode(file)); |
216 | struct pci_dev *dev = dp->data; | 216 | struct pci_dev *dev = dp->data; |
217 | #ifdef HAVE_PCI_MMAP | 217 | #ifdef HAVE_PCI_MMAP |
218 | struct pci_filp_private *fpriv = file->private_data; | 218 | struct pci_filp_private *fpriv = file->private_data; |
@@ -253,7 +253,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, | |||
253 | #ifdef HAVE_PCI_MMAP | 253 | #ifdef HAVE_PCI_MMAP |
254 | static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) | 254 | static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) |
255 | { | 255 | { |
256 | struct inode *inode = file->f_path.dentry->d_inode; | 256 | struct inode *inode = file_inode(file); |
257 | const struct proc_dir_entry *dp = PDE(inode); | 257 | const struct proc_dir_entry *dp = PDE(inode); |
258 | struct pci_dev *dev = dp->data; | 258 | struct pci_dev *dev = dp->data; |
259 | struct pci_filp_private *fpriv = file->private_data; | 259 | struct pci_filp_private *fpriv = file->private_data; |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index ceb41eff4230..8da21876a794 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -3566,7 +3566,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf, | |||
3566 | } | 3566 | } |
3567 | 3567 | ||
3568 | if (ret > 0) { | 3568 | if (ret > 0) { |
3569 | struct inode *inode = file->f_path.dentry->d_inode; | 3569 | struct inode *inode = file_inode(file); |
3570 | inode->i_atime = current_fs_time(inode->i_sb); | 3570 | inode->i_atime = current_fs_time(inode->i_sb); |
3571 | } | 3571 | } |
3572 | 3572 | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index ebcb461bb2b0..f4f8408f3b5b 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -852,7 +852,7 @@ static ssize_t dispatch_proc_write(struct file *file, | |||
852 | const char __user *userbuf, | 852 | const char __user *userbuf, |
853 | size_t count, loff_t *pos) | 853 | size_t count, loff_t *pos) |
854 | { | 854 | { |
855 | struct ibm_struct *ibm = PDE(file->f_path.dentry->d_inode)->data; | 855 | struct ibm_struct *ibm = PDE(file_inode(file))->data; |
856 | char *kernbuf; | 856 | char *kernbuf; |
857 | int ret; | 857 | int ret; |
858 | 858 | ||
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 904476b2fa8f..242abac62d8b 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -583,7 +583,7 @@ static int set_lcd_status(struct backlight_device *bd) | |||
583 | static ssize_t lcd_proc_write(struct file *file, const char __user *buf, | 583 | static ssize_t lcd_proc_write(struct file *file, const char __user *buf, |
584 | size_t count, loff_t *pos) | 584 | size_t count, loff_t *pos) |
585 | { | 585 | { |
586 | struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data; | 586 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; |
587 | char cmd[42]; | 587 | char cmd[42]; |
588 | size_t len; | 588 | size_t len; |
589 | int value; | 589 | int value; |
@@ -650,7 +650,7 @@ static int video_proc_open(struct inode *inode, struct file *file) | |||
650 | static ssize_t video_proc_write(struct file *file, const char __user *buf, | 650 | static ssize_t video_proc_write(struct file *file, const char __user *buf, |
651 | size_t count, loff_t *pos) | 651 | size_t count, loff_t *pos) |
652 | { | 652 | { |
653 | struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data; | 653 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; |
654 | char *cmd, *buffer; | 654 | char *cmd, *buffer; |
655 | int ret; | 655 | int ret; |
656 | int value; | 656 | int value; |
@@ -750,7 +750,7 @@ static int fan_proc_open(struct inode *inode, struct file *file) | |||
750 | static ssize_t fan_proc_write(struct file *file, const char __user *buf, | 750 | static ssize_t fan_proc_write(struct file *file, const char __user *buf, |
751 | size_t count, loff_t *pos) | 751 | size_t count, loff_t *pos) |
752 | { | 752 | { |
753 | struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data; | 753 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; |
754 | char cmd[42]; | 754 | char cmd[42]; |
755 | size_t len; | 755 | size_t len; |
756 | int value; | 756 | int value; |
@@ -822,7 +822,7 @@ static int keys_proc_open(struct inode *inode, struct file *file) | |||
822 | static ssize_t keys_proc_write(struct file *file, const char __user *buf, | 822 | static ssize_t keys_proc_write(struct file *file, const char __user *buf, |
823 | size_t count, loff_t *pos) | 823 | size_t count, loff_t *pos) |
824 | { | 824 | { |
825 | struct toshiba_acpi_dev *dev = PDE(file->f_path.dentry->d_inode)->data; | 825 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; |
826 | char cmd[42]; | 826 | char cmd[42]; |
827 | size_t len; | 827 | size_t len; |
828 | int value; | 828 | int value; |
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index 315b3112aca8..65f735ac6b3b 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c | |||
@@ -30,7 +30,7 @@ static struct proc_dir_entry *isapnp_proc_bus_dir = NULL; | |||
30 | static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) | 30 | static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) |
31 | { | 31 | { |
32 | loff_t new = -1; | 32 | loff_t new = -1; |
33 | struct inode *inode = file->f_path.dentry->d_inode; | 33 | struct inode *inode = file_inode(file); |
34 | 34 | ||
35 | mutex_lock(&inode->i_mutex); | 35 | mutex_lock(&inode->i_mutex); |
36 | switch (whence) { | 36 | switch (whence) { |
@@ -55,7 +55,7 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) | |||
55 | static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf, | 55 | static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf, |
56 | size_t nbytes, loff_t * ppos) | 56 | size_t nbytes, loff_t * ppos) |
57 | { | 57 | { |
58 | struct inode *ino = file->f_path.dentry->d_inode; | 58 | struct inode *ino = file_inode(file); |
59 | struct proc_dir_entry *dp = PDE(ino); | 59 | struct proc_dir_entry *dp = PDE(ino); |
60 | struct pnp_dev *dev = dp->data; | 60 | struct pnp_dev *dev = dp->data; |
61 | int pos = *ppos; | 61 | int pos = *ppos; |
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index bc89f392a629..63ddb0173456 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c | |||
@@ -244,7 +244,7 @@ static int pnpbios_proc_open(struct inode *inode, struct file *file) | |||
244 | static ssize_t pnpbios_proc_write(struct file *file, const char __user *buf, | 244 | static ssize_t pnpbios_proc_write(struct file *file, const char __user *buf, |
245 | size_t count, loff_t *pos) | 245 | size_t count, loff_t *pos) |
246 | { | 246 | { |
247 | void *data = PDE(file->f_path.dentry->d_inode)->data; | 247 | void *data = PDE(file_inode(file))->data; |
248 | struct pnp_bios_node *node; | 248 | struct pnp_bios_node *node; |
249 | int boot = (long)data >> 8; | 249 | int boot = (long)data >> 8; |
250 | u8 nodenum = (long)data; | 250 | u8 nodenum = (long)data; |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 230697aac94b..96e52bf75930 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -433,9 +433,9 @@ fs3270_open(struct inode *inode, struct file *filp) | |||
433 | struct idal_buffer *ib; | 433 | struct idal_buffer *ib; |
434 | int minor, rc = 0; | 434 | int minor, rc = 0; |
435 | 435 | ||
436 | if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR) | 436 | if (imajor(file_inode(filp)) != IBM_FS3270_MAJOR) |
437 | return -ENODEV; | 437 | return -ENODEV; |
438 | minor = iminor(filp->f_path.dentry->d_inode); | 438 | minor = iminor(file_inode(filp)); |
439 | /* Check for minor 0 multiplexer. */ | 439 | /* Check for minor 0 multiplexer. */ |
440 | if (minor == 0) { | 440 | if (minor == 0) { |
441 | struct tty_struct *tty = get_current_tty(); | 441 | struct tty_struct *tty = get_current_tty(); |
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 2d61db3fc62a..6dc60725de92 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c | |||
@@ -273,13 +273,13 @@ tapechar_open (struct inode *inode, struct file *filp) | |||
273 | int minor, rc; | 273 | int minor, rc; |
274 | 274 | ||
275 | DBF_EVENT(6, "TCHAR:open: %i:%i\n", | 275 | DBF_EVENT(6, "TCHAR:open: %i:%i\n", |
276 | imajor(filp->f_path.dentry->d_inode), | 276 | imajor(file_inode(filp)), |
277 | iminor(filp->f_path.dentry->d_inode)); | 277 | iminor(file_inode(filp))); |
278 | 278 | ||
279 | if (imajor(filp->f_path.dentry->d_inode) != tapechar_major) | 279 | if (imajor(file_inode(filp)) != tapechar_major) |
280 | return -ENODEV; | 280 | return -ENODEV; |
281 | 281 | ||
282 | minor = iminor(filp->f_path.dentry->d_inode); | 282 | minor = iminor(file_inode(filp)); |
283 | device = tape_find_device(minor / TAPE_MINORS_PER_DEV); | 283 | device = tape_find_device(minor / TAPE_MINORS_PER_DEV); |
284 | if (IS_ERR(device)) { | 284 | if (IS_ERR(device)) { |
285 | DBF_EVENT(3, "TCHAR:open: tape_find_device() failed\n"); | 285 | DBF_EVENT(3, "TCHAR:open: tape_find_device() failed\n"); |
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 483f72ba030d..c180e3135b3b 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
@@ -703,7 +703,7 @@ static int ur_open(struct inode *inode, struct file *file) | |||
703 | * We treat the minor number as the devno of the ur device | 703 | * We treat the minor number as the devno of the ur device |
704 | * to find in the driver tree. | 704 | * to find in the driver tree. |
705 | */ | 705 | */ |
706 | devno = MINOR(file->f_dentry->d_inode->i_rdev); | 706 | devno = MINOR(file_inode(file)->i_rdev); |
707 | 707 | ||
708 | urd = urdev_get_from_devno(devno); | 708 | urd = urdev_get_from_devno(devno); |
709 | if (!urd) { | 709 | if (!urd) { |
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index e6e0d31c02ac..749b72739c4a 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -128,7 +128,7 @@ static int qstat_show(struct seq_file *m, void *v) | |||
128 | static int qstat_seq_open(struct inode *inode, struct file *filp) | 128 | static int qstat_seq_open(struct inode *inode, struct file *filp) |
129 | { | 129 | { |
130 | return single_open(filp, qstat_show, | 130 | return single_open(filp, qstat_show, |
131 | filp->f_path.dentry->d_inode->i_private); | 131 | file_inode(filp)->i_private); |
132 | } | 132 | } |
133 | 133 | ||
134 | static const struct file_operations debugfs_fops = { | 134 | static const struct file_operations debugfs_fops = { |
@@ -221,7 +221,7 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf, | |||
221 | static int qperf_seq_open(struct inode *inode, struct file *filp) | 221 | static int qperf_seq_open(struct inode *inode, struct file *filp) |
222 | { | 222 | { |
223 | return single_open(filp, qperf_show, | 223 | return single_open(filp, qperf_show, |
224 | filp->f_path.dentry->d_inode->i_private); | 224 | file_inode(filp)->i_private); |
225 | } | 225 | } |
226 | 226 | ||
227 | static struct file_operations debugfs_perf_fops = { | 227 | static struct file_operations debugfs_perf_fops = { |
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index e85c803b30cd..fc1339cf91ac 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c | |||
@@ -107,7 +107,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
107 | int error = 0; | 107 | int error = 0; |
108 | u8 ireg = 0; | 108 | u8 ireg = 0; |
109 | 109 | ||
110 | if (D7S_MINOR != iminor(file->f_path.dentry->d_inode)) | 110 | if (D7S_MINOR != iminor(file_inode(file))) |
111 | return -ENODEV; | 111 | return -ENODEV; |
112 | 112 | ||
113 | mutex_lock(&d7s_mutex); | 113 | mutex_lock(&d7s_mutex); |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index d1f0120cdb98..5e1e12c0cf42 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -640,7 +640,7 @@ out: | |||
640 | /* This function handles ioctl for the character device */ | 640 | /* This function handles ioctl for the character device */ |
641 | static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 641 | static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
642 | { | 642 | { |
643 | struct inode *inode = file->f_path.dentry->d_inode; | 643 | struct inode *inode = file_inode(file); |
644 | long timeout; | 644 | long timeout; |
645 | unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; | 645 | unsigned long *cpu_addr, data_buffer_length_adjusted = 0, flags = 0; |
646 | dma_addr_t dma_handle; | 646 | dma_addr_t dma_handle; |
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index 52a2f0580d97..c845bdbeb6c0 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c | |||
@@ -757,7 +757,7 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long | |||
757 | dma_addr_t dma_handle; | 757 | dma_addr_t dma_handle; |
758 | int request_id = 0; | 758 | int request_id = 0; |
759 | TW_Ioctl_Driver_Command driver_command; | 759 | TW_Ioctl_Driver_Command driver_command; |
760 | struct inode *inode = file->f_dentry->d_inode; | 760 | struct inode *inode = file_inode(file); |
761 | TW_Ioctl_Buf_Apache *tw_ioctl; | 761 | TW_Ioctl_Buf_Apache *tw_ioctl; |
762 | TW_Command_Full *full_command_packet; | 762 | TW_Command_Full *full_command_packet; |
763 | TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)]; | 763 | TW_Device_Extension *tw_dev = twl_device_extension_list[iminor(inode)]; |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 62071d2fc1ce..56662ae03dea 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -889,7 +889,7 @@ static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long a | |||
889 | unsigned long flags; | 889 | unsigned long flags; |
890 | unsigned int data_buffer_length = 0; | 890 | unsigned int data_buffer_length = 0; |
891 | unsigned long data_buffer_length_adjusted = 0; | 891 | unsigned long data_buffer_length_adjusted = 0; |
892 | struct inode *inode = file->f_dentry->d_inode; | 892 | struct inode *inode = file_inode(file); |
893 | unsigned long *cpu_addr; | 893 | unsigned long *cpu_addr; |
894 | long timeout; | 894 | long timeout; |
895 | TW_New_Ioctl *tw_ioctl; | 895 | TW_New_Ioctl *tw_ioctl; |
diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c index b42cbbd3d92d..c323b2030afa 100644 --- a/drivers/scsi/csiostor/csio_init.c +++ b/drivers/scsi/csiostor/csio_init.c | |||
@@ -71,7 +71,7 @@ static ssize_t | |||
71 | csio_mem_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 71 | csio_mem_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
72 | { | 72 | { |
73 | loff_t pos = *ppos; | 73 | loff_t pos = *ppos; |
74 | loff_t avail = file->f_path.dentry->d_inode->i_size; | 74 | loff_t avail = file_inode(file)->i_size; |
75 | unsigned int mem = (uintptr_t)file->private_data & 3; | 75 | unsigned int mem = (uintptr_t)file->private_data & 3; |
76 | struct csio_hw *hw = file->private_data - mem; | 76 | struct csio_hw *hw = file->private_data - mem; |
77 | 77 | ||
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index b4f6c9a84e71..b6e2700ec1c6 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -2161,7 +2161,7 @@ static long adpt_unlocked_ioctl(struct file *file, uint cmd, ulong arg) | |||
2161 | struct inode *inode; | 2161 | struct inode *inode; |
2162 | long ret; | 2162 | long ret; |
2163 | 2163 | ||
2164 | inode = file->f_dentry->d_inode; | 2164 | inode = file_inode(file); |
2165 | 2165 | ||
2166 | mutex_lock(&adpt_mutex); | 2166 | mutex_lock(&adpt_mutex); |
2167 | ret = adpt_ioctl(inode, file, cmd, arg); | 2167 | ret = adpt_ioctl(inode, file, cmd, arg); |
@@ -2177,7 +2177,7 @@ static long compat_adpt_ioctl(struct file *file, | |||
2177 | struct inode *inode; | 2177 | struct inode *inode; |
2178 | long ret; | 2178 | long ret; |
2179 | 2179 | ||
2180 | inode = file->f_dentry->d_inode; | 2180 | inode = file_inode(file); |
2181 | 2181 | ||
2182 | mutex_lock(&adpt_mutex); | 2182 | mutex_lock(&adpt_mutex); |
2183 | 2183 | ||
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 98156a97c472..3e2b3717cb5c 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -977,7 +977,7 @@ static int check_tape(struct scsi_tape *STp, struct file *filp) | |||
977 | struct st_modedef *STm; | 977 | struct st_modedef *STm; |
978 | struct st_partstat *STps; | 978 | struct st_partstat *STps; |
979 | char *name = tape_name(STp); | 979 | char *name = tape_name(STp); |
980 | struct inode *inode = filp->f_path.dentry->d_inode; | 980 | struct inode *inode = file_inode(filp); |
981 | int mode = TAPE_MODE(inode); | 981 | int mode = TAPE_MODE(inode); |
982 | 982 | ||
983 | STp->ready = ST_READY; | 983 | STp->ready = ST_READY; |
diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index b5c2c4c15f92..d23eeeb95064 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c | |||
@@ -185,7 +185,7 @@ static int BcmFileDownload(struct bcm_mini_adapter *Adapter, const char *path, u | |||
185 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path); | 185 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path); |
186 | return -ENOENT; | 186 | return -ENOENT; |
187 | } | 187 | } |
188 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)flp->f_dentry->d_inode->i_size, loc); | 188 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)file_inode(flp)->i_size, loc); |
189 | do_gettimeofday(&tv); | 189 | do_gettimeofday(&tv); |
190 | 190 | ||
191 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "download start %lx", ((tv.tv_sec * 1000) + (tv.tv_usec / 1000))); | 191 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "download start %lx", ((tv.tv_sec * 1000) + (tv.tv_usec / 1000))); |
diff --git a/drivers/staging/ccg/f_mass_storage.c b/drivers/staging/ccg/f_mass_storage.c index 4f1142efa6d1..20bc2b454ac2 100644 --- a/drivers/staging/ccg/f_mass_storage.c +++ b/drivers/staging/ccg/f_mass_storage.c | |||
@@ -998,7 +998,7 @@ static int do_synchronize_cache(struct fsg_common *common) | |||
998 | static void invalidate_sub(struct fsg_lun *curlun) | 998 | static void invalidate_sub(struct fsg_lun *curlun) |
999 | { | 999 | { |
1000 | struct file *filp = curlun->filp; | 1000 | struct file *filp = curlun->filp; |
1001 | struct inode *inode = filp->f_path.dentry->d_inode; | 1001 | struct inode *inode = file_inode(filp); |
1002 | unsigned long rc; | 1002 | unsigned long rc; |
1003 | 1003 | ||
1004 | rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); | 1004 | rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); |
diff --git a/drivers/staging/ccg/rndis.c b/drivers/staging/ccg/rndis.c index e4192b887de9..d9297eebbf73 100644 --- a/drivers/staging/ccg/rndis.c +++ b/drivers/staging/ccg/rndis.c | |||
@@ -1065,7 +1065,7 @@ static int rndis_proc_show(struct seq_file *m, void *v) | |||
1065 | static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, | 1065 | static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, |
1066 | size_t count, loff_t *ppos) | 1066 | size_t count, loff_t *ppos) |
1067 | { | 1067 | { |
1068 | rndis_params *p = PDE(file->f_path.dentry->d_inode)->data; | 1068 | rndis_params *p = PDE(file_inode(file))->data; |
1069 | u32 speed = 0; | 1069 | u32 speed = 0; |
1070 | int i, fl_speed = 0; | 1070 | int i, fl_speed = 0; |
1071 | 1071 | ||
diff --git a/drivers/staging/ccg/storage_common.c b/drivers/staging/ccg/storage_common.c index 8d9bcd8207c8..abb01ac74cec 100644 --- a/drivers/staging/ccg/storage_common.c +++ b/drivers/staging/ccg/storage_common.c | |||
@@ -656,7 +656,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename) | |||
656 | if (!(filp->f_mode & FMODE_WRITE)) | 656 | if (!(filp->f_mode & FMODE_WRITE)) |
657 | ro = 1; | 657 | ro = 1; |
658 | 658 | ||
659 | inode = filp->f_path.dentry->d_inode; | 659 | inode = file_inode(filp); |
660 | if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) { | 660 | if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) { |
661 | LINFO(curlun, "invalid file type: %s\n", filename); | 661 | LINFO(curlun, "invalid file type: %s\n", filename); |
662 | goto out; | 662 | goto out; |
diff --git a/drivers/staging/dgrp/dgrp_specproc.c b/drivers/staging/dgrp/dgrp_specproc.c index 13c7ccf163c5..73f287f96604 100644 --- a/drivers/staging/dgrp/dgrp_specproc.c +++ b/drivers/staging/dgrp/dgrp_specproc.c | |||
@@ -357,7 +357,7 @@ static int dgrp_gen_proc_open(struct inode *inode, struct file *file) | |||
357 | struct dgrp_proc_entry *entry; | 357 | struct dgrp_proc_entry *entry; |
358 | int ret = 0; | 358 | int ret = 0; |
359 | 359 | ||
360 | de = (struct proc_dir_entry *) PDE(file->f_dentry->d_inode); | 360 | de = (struct proc_dir_entry *) PDE(file_inode(file)); |
361 | if (!de || !de->data) { | 361 | if (!de || !de->data) { |
362 | ret = -ENXIO; | 362 | ret = -ENXIO; |
363 | goto done; | 363 | goto done; |
@@ -387,7 +387,7 @@ static int dgrp_gen_proc_close(struct inode *inode, struct file *file) | |||
387 | struct proc_dir_entry *de; | 387 | struct proc_dir_entry *de; |
388 | struct dgrp_proc_entry *entry; | 388 | struct dgrp_proc_entry *entry; |
389 | 389 | ||
390 | de = (struct proc_dir_entry *) PDE(file->f_dentry->d_inode); | 390 | de = (struct proc_dir_entry *) PDE(file_inode(file)); |
391 | if (!de || !de->data) | 391 | if (!de || !de->data) |
392 | goto done; | 392 | goto done; |
393 | 393 | ||
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 75aa5bfcb8dd..539fa5785afe 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c | |||
@@ -411,7 +411,7 @@ struct socket *sockfd_to_socket(unsigned int sockfd) | |||
411 | return NULL; | 411 | return NULL; |
412 | } | 412 | } |
413 | 413 | ||
414 | inode = file->f_dentry->d_inode; | 414 | inode = file_inode(file); |
415 | 415 | ||
416 | if (!inode || !S_ISSOCK(inode->i_mode)) { | 416 | if (!inode || !S_ISSOCK(inode->i_mode)) { |
417 | fput(file); | 417 | fput(file); |
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 57474cff51f0..d074b1ecb41a 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c | |||
@@ -318,7 +318,7 @@ static ssize_t buffer_from_user(unsigned int minor, const char __user *buf, | |||
318 | static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, | 318 | static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, |
319 | loff_t *ppos) | 319 | loff_t *ppos) |
320 | { | 320 | { |
321 | unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); | 321 | unsigned int minor = MINOR(file_inode(file)->i_rdev); |
322 | ssize_t retval; | 322 | ssize_t retval; |
323 | size_t image_size; | 323 | size_t image_size; |
324 | size_t okcount; | 324 | size_t okcount; |
@@ -364,7 +364,7 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, | |||
364 | static ssize_t vme_user_write(struct file *file, const char __user *buf, | 364 | static ssize_t vme_user_write(struct file *file, const char __user *buf, |
365 | size_t count, loff_t *ppos) | 365 | size_t count, loff_t *ppos) |
366 | { | 366 | { |
367 | unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); | 367 | unsigned int minor = MINOR(file_inode(file)->i_rdev); |
368 | ssize_t retval; | 368 | ssize_t retval; |
369 | size_t image_size; | 369 | size_t image_size; |
370 | size_t okcount; | 370 | size_t okcount; |
@@ -410,7 +410,7 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf, | |||
410 | static loff_t vme_user_llseek(struct file *file, loff_t off, int whence) | 410 | static loff_t vme_user_llseek(struct file *file, loff_t off, int whence) |
411 | { | 411 | { |
412 | loff_t absolute = -1; | 412 | loff_t absolute = -1; |
413 | unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); | 413 | unsigned int minor = MINOR(file_inode(file)->i_rdev); |
414 | size_t image_size; | 414 | size_t image_size; |
415 | 415 | ||
416 | if (minor == CONTROL_MINOR) | 416 | if (minor == CONTROL_MINOR) |
@@ -583,7 +583,7 @@ vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
583 | int ret; | 583 | int ret; |
584 | 584 | ||
585 | mutex_lock(&vme_user_mutex); | 585 | mutex_lock(&vme_user_mutex); |
586 | ret = vme_user_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); | 586 | ret = vme_user_ioctl(file_inode(file), file, cmd, arg); |
587 | mutex_unlock(&vme_user_mutex); | 587 | mutex_unlock(&vme_user_mutex); |
588 | 588 | ||
589 | return ret; | 589 | return ret; |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 7d4ec02e29a9..ff1c5ee352cb 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/configfs.h> | 28 | #include <linux/configfs.h> |
29 | #include <linux/export.h> | 29 | #include <linux/export.h> |
30 | #include <linux/file.h> | ||
30 | #include <scsi/scsi.h> | 31 | #include <scsi/scsi.h> |
31 | #include <scsi/scsi_cmnd.h> | 32 | #include <scsi/scsi_cmnd.h> |
32 | #include <asm/unaligned.h> | 33 | #include <asm/unaligned.h> |
@@ -715,36 +716,18 @@ static int core_alua_write_tpg_metadata( | |||
715 | unsigned char *md_buf, | 716 | unsigned char *md_buf, |
716 | u32 md_buf_len) | 717 | u32 md_buf_len) |
717 | { | 718 | { |
718 | mm_segment_t old_fs; | 719 | struct file *file = filp_open(path, O_RDWR | O_CREAT | O_TRUNC, 0600); |
719 | struct file *file; | 720 | int ret; |
720 | struct iovec iov[1]; | ||
721 | int flags = O_RDWR | O_CREAT | O_TRUNC, ret; | ||
722 | |||
723 | memset(iov, 0, sizeof(struct iovec)); | ||
724 | 721 | ||
725 | file = filp_open(path, flags, 0600); | 722 | if (IS_ERR(file)) { |
726 | if (IS_ERR(file) || !file || !file->f_dentry) { | 723 | pr_err("filp_open(%s) for ALUA metadata failed\n", path); |
727 | pr_err("filp_open(%s) for ALUA metadata failed\n", | ||
728 | path); | ||
729 | return -ENODEV; | 724 | return -ENODEV; |
730 | } | 725 | } |
731 | 726 | ret = kernel_write(file, md_buf, md_buf_len, 0); | |
732 | iov[0].iov_base = &md_buf[0]; | 727 | if (ret < 0) |
733 | iov[0].iov_len = md_buf_len; | ||
734 | |||
735 | old_fs = get_fs(); | ||
736 | set_fs(get_ds()); | ||
737 | ret = vfs_writev(file, &iov[0], 1, &file->f_pos); | ||
738 | set_fs(old_fs); | ||
739 | |||
740 | if (ret < 0) { | ||
741 | pr_err("Error writing ALUA metadata file: %s\n", path); | 728 | pr_err("Error writing ALUA metadata file: %s\n", path); |
742 | filp_close(file, NULL); | 729 | fput(file); |
743 | return -EIO; | 730 | return ret ? -EIO : 0; |
744 | } | ||
745 | filp_close(file, NULL); | ||
746 | |||
747 | return 0; | ||
748 | } | 731 | } |
749 | 732 | ||
750 | /* | 733 | /* |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index ca36a38eb274..d226c10a985b 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -270,7 +270,7 @@ static int fd_do_rw(struct se_cmd *cmd, struct scatterlist *sgl, | |||
270 | * the expected virt_size for struct file w/o a backing struct | 270 | * the expected virt_size for struct file w/o a backing struct |
271 | * block_device. | 271 | * block_device. |
272 | */ | 272 | */ |
273 | if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) { | 273 | if (S_ISBLK(file_inode(fd)->i_mode)) { |
274 | if (ret < 0 || ret != cmd->data_length) { | 274 | if (ret < 0 || ret != cmd->data_length) { |
275 | pr_err("%s() returned %d, expecting %u for " | 275 | pr_err("%s() returned %d, expecting %u for " |
276 | "S_ISBLK\n", __func__, ret, | 276 | "S_ISBLK\n", __func__, ret, |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 8e0290b38e43..3240f2cc81ef 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/file.h> | ||
30 | #include <scsi/scsi.h> | 31 | #include <scsi/scsi.h> |
31 | #include <scsi/scsi_cmnd.h> | 32 | #include <scsi/scsi_cmnd.h> |
32 | #include <asm/unaligned.h> | 33 | #include <asm/unaligned.h> |
@@ -1957,13 +1958,10 @@ static int __core_scsi3_write_aptpl_to_file( | |||
1957 | { | 1958 | { |
1958 | struct t10_wwn *wwn = &dev->t10_wwn; | 1959 | struct t10_wwn *wwn = &dev->t10_wwn; |
1959 | struct file *file; | 1960 | struct file *file; |
1960 | struct iovec iov[1]; | ||
1961 | mm_segment_t old_fs; | ||
1962 | int flags = O_RDWR | O_CREAT | O_TRUNC; | 1961 | int flags = O_RDWR | O_CREAT | O_TRUNC; |
1963 | char path[512]; | 1962 | char path[512]; |
1964 | int ret; | 1963 | int ret; |
1965 | 1964 | ||
1966 | memset(iov, 0, sizeof(struct iovec)); | ||
1967 | memset(path, 0, 512); | 1965 | memset(path, 0, 512); |
1968 | 1966 | ||
1969 | if (strlen(&wwn->unit_serial[0]) >= 512) { | 1967 | if (strlen(&wwn->unit_serial[0]) >= 512) { |
@@ -1974,31 +1972,22 @@ static int __core_scsi3_write_aptpl_to_file( | |||
1974 | 1972 | ||
1975 | snprintf(path, 512, "/var/target/pr/aptpl_%s", &wwn->unit_serial[0]); | 1973 | snprintf(path, 512, "/var/target/pr/aptpl_%s", &wwn->unit_serial[0]); |
1976 | file = filp_open(path, flags, 0600); | 1974 | file = filp_open(path, flags, 0600); |
1977 | if (IS_ERR(file) || !file || !file->f_dentry) { | 1975 | if (IS_ERR(file)) { |
1978 | pr_err("filp_open(%s) for APTPL metadata" | 1976 | pr_err("filp_open(%s) for APTPL metadata" |
1979 | " failed\n", path); | 1977 | " failed\n", path); |
1980 | return IS_ERR(file) ? PTR_ERR(file) : -ENOENT; | 1978 | return PTR_ERR(file); |
1981 | } | 1979 | } |
1982 | 1980 | ||
1983 | iov[0].iov_base = &buf[0]; | ||
1984 | if (!pr_aptpl_buf_len) | 1981 | if (!pr_aptpl_buf_len) |
1985 | iov[0].iov_len = (strlen(&buf[0]) + 1); /* Add extra for NULL */ | 1982 | pr_aptpl_buf_len = (strlen(&buf[0]) + 1); /* Add extra for NULL */ |
1986 | else | ||
1987 | iov[0].iov_len = pr_aptpl_buf_len; | ||
1988 | 1983 | ||
1989 | old_fs = get_fs(); | 1984 | ret = kernel_write(file, buf, pr_aptpl_buf_len, 0); |
1990 | set_fs(get_ds()); | ||
1991 | ret = vfs_writev(file, &iov[0], 1, &file->f_pos); | ||
1992 | set_fs(old_fs); | ||
1993 | 1985 | ||
1994 | if (ret < 0) { | 1986 | if (ret < 0) |
1995 | pr_debug("Error writing APTPL metadata file: %s\n", path); | 1987 | pr_debug("Error writing APTPL metadata file: %s\n", path); |
1996 | filp_close(file, NULL); | 1988 | fput(file); |
1997 | return -EIO; | ||
1998 | } | ||
1999 | filp_close(file, NULL); | ||
2000 | 1989 | ||
2001 | return 0; | 1990 | return ret ? -EIO : 0; |
2002 | } | 1991 | } |
2003 | 1992 | ||
2004 | static int | 1993 | static int |
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index fa7268a93c06..e4ca345873c3 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c | |||
@@ -101,7 +101,7 @@ vcs_poll_data_get(struct file *file) | |||
101 | poll = kzalloc(sizeof(*poll), GFP_KERNEL); | 101 | poll = kzalloc(sizeof(*poll), GFP_KERNEL); |
102 | if (!poll) | 102 | if (!poll) |
103 | return NULL; | 103 | return NULL; |
104 | poll->cons_num = iminor(file->f_path.dentry->d_inode) & 127; | 104 | poll->cons_num = iminor(file_inode(file)) & 127; |
105 | init_waitqueue_head(&poll->waitq); | 105 | init_waitqueue_head(&poll->waitq); |
106 | poll->notifier.notifier_call = vcs_notifier; | 106 | poll->notifier.notifier_call = vcs_notifier; |
107 | if (register_vt_notifier(&poll->notifier) != 0) { | 107 | if (register_vt_notifier(&poll->notifier) != 0) { |
@@ -182,7 +182,7 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) | |||
182 | int size; | 182 | int size; |
183 | 183 | ||
184 | console_lock(); | 184 | console_lock(); |
185 | size = vcs_size(file->f_path.dentry->d_inode); | 185 | size = vcs_size(file_inode(file)); |
186 | console_unlock(); | 186 | console_unlock(); |
187 | if (size < 0) | 187 | if (size < 0) |
188 | return size; | 188 | return size; |
@@ -208,7 +208,7 @@ static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) | |||
208 | static ssize_t | 208 | static ssize_t |
209 | vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 209 | vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
210 | { | 210 | { |
211 | struct inode *inode = file->f_path.dentry->d_inode; | 211 | struct inode *inode = file_inode(file); |
212 | unsigned int currcons = iminor(inode); | 212 | unsigned int currcons = iminor(inode); |
213 | struct vc_data *vc; | 213 | struct vc_data *vc; |
214 | struct vcs_poll_data *poll; | 214 | struct vcs_poll_data *poll; |
@@ -386,7 +386,7 @@ unlock_out: | |||
386 | static ssize_t | 386 | static ssize_t |
387 | vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 387 | vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
388 | { | 388 | { |
389 | struct inode *inode = file->f_path.dentry->d_inode; | 389 | struct inode *inode = file_inode(file); |
390 | unsigned int currcons = iminor(inode); | 390 | unsigned int currcons = iminor(inode); |
391 | struct vc_data *vc; | 391 | struct vc_data *vc; |
392 | long pos; | 392 | long pos; |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index e33224e23770..2a3bbdf7eb94 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -665,7 +665,7 @@ static loff_t usb_device_lseek(struct file *file, loff_t offset, int orig) | |||
665 | { | 665 | { |
666 | loff_t ret; | 666 | loff_t ret; |
667 | 667 | ||
668 | mutex_lock(&file->f_dentry->d_inode->i_mutex); | 668 | mutex_lock(&file_inode(file)->i_mutex); |
669 | 669 | ||
670 | switch (orig) { | 670 | switch (orig) { |
671 | case 0: | 671 | case 0: |
@@ -681,7 +681,7 @@ static loff_t usb_device_lseek(struct file *file, loff_t offset, int orig) | |||
681 | ret = -EINVAL; | 681 | ret = -EINVAL; |
682 | } | 682 | } |
683 | 683 | ||
684 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); | 684 | mutex_unlock(&file_inode(file)->i_mutex); |
685 | return ret; | 685 | return ret; |
686 | } | 686 | } |
687 | 687 | ||
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 4a863fdbdccd..8823e98989fe 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -161,7 +161,7 @@ static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) | |||
161 | { | 161 | { |
162 | loff_t ret; | 162 | loff_t ret; |
163 | 163 | ||
164 | mutex_lock(&file->f_dentry->d_inode->i_mutex); | 164 | mutex_lock(&file_inode(file)->i_mutex); |
165 | 165 | ||
166 | switch (orig) { | 166 | switch (orig) { |
167 | case 0: | 167 | case 0: |
@@ -177,7 +177,7 @@ static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) | |||
177 | ret = -EINVAL; | 177 | ret = -EINVAL; |
178 | } | 178 | } |
179 | 179 | ||
180 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); | 180 | mutex_unlock(&file_inode(file)->i_mutex); |
181 | return ret; | 181 | return ret; |
182 | } | 182 | } |
183 | 183 | ||
@@ -1971,7 +1971,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, | |||
1971 | void __user *p) | 1971 | void __user *p) |
1972 | { | 1972 | { |
1973 | struct dev_state *ps = file->private_data; | 1973 | struct dev_state *ps = file->private_data; |
1974 | struct inode *inode = file->f_path.dentry->d_inode; | 1974 | struct inode *inode = file_inode(file); |
1975 | struct usb_device *dev = ps->dev; | 1975 | struct usb_device *dev = ps->dev; |
1976 | int ret = -ENOTTY; | 1976 | int ret = -ENOTTY; |
1977 | 1977 | ||
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index bc19496bcec0..b66130c97269 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -93,7 +93,7 @@ static ssize_t queue_dbg_read(struct file *file, char __user *buf, | |||
93 | if (!access_ok(VERIFY_WRITE, buf, nbytes)) | 93 | if (!access_ok(VERIFY_WRITE, buf, nbytes)) |
94 | return -EFAULT; | 94 | return -EFAULT; |
95 | 95 | ||
96 | mutex_lock(&file->f_dentry->d_inode->i_mutex); | 96 | mutex_lock(&file_inode(file)->i_mutex); |
97 | list_for_each_entry_safe(req, tmp_req, queue, queue) { | 97 | list_for_each_entry_safe(req, tmp_req, queue, queue) { |
98 | len = snprintf(tmpbuf, sizeof(tmpbuf), | 98 | len = snprintf(tmpbuf, sizeof(tmpbuf), |
99 | "%8p %08x %c%c%c %5d %c%c%c\n", | 99 | "%8p %08x %c%c%c %5d %c%c%c\n", |
@@ -120,7 +120,7 @@ static ssize_t queue_dbg_read(struct file *file, char __user *buf, | |||
120 | nbytes -= len; | 120 | nbytes -= len; |
121 | buf += len; | 121 | buf += len; |
122 | } | 122 | } |
123 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); | 123 | mutex_unlock(&file_inode(file)->i_mutex); |
124 | 124 | ||
125 | return actual; | 125 | return actual; |
126 | } | 126 | } |
@@ -168,13 +168,13 @@ out: | |||
168 | static ssize_t regs_dbg_read(struct file *file, char __user *buf, | 168 | static ssize_t regs_dbg_read(struct file *file, char __user *buf, |
169 | size_t nbytes, loff_t *ppos) | 169 | size_t nbytes, loff_t *ppos) |
170 | { | 170 | { |
171 | struct inode *inode = file->f_dentry->d_inode; | 171 | struct inode *inode = file_inode(file); |
172 | int ret; | 172 | int ret; |
173 | 173 | ||
174 | mutex_lock(&inode->i_mutex); | 174 | mutex_lock(&inode->i_mutex); |
175 | ret = simple_read_from_buffer(buf, nbytes, ppos, | 175 | ret = simple_read_from_buffer(buf, nbytes, ppos, |
176 | file->private_data, | 176 | file->private_data, |
177 | file->f_dentry->d_inode->i_size); | 177 | file_inode(file)->i_size); |
178 | mutex_unlock(&inode->i_mutex); | 178 | mutex_unlock(&inode->i_mutex); |
179 | 179 | ||
180 | return ret; | 180 | return ret; |
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index fc5c16ca5e0a..97666e8b1b95 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -978,7 +978,7 @@ static int do_synchronize_cache(struct fsg_common *common) | |||
978 | static void invalidate_sub(struct fsg_lun *curlun) | 978 | static void invalidate_sub(struct fsg_lun *curlun) |
979 | { | 979 | { |
980 | struct file *filp = curlun->filp; | 980 | struct file *filp = curlun->filp; |
981 | struct inode *inode = filp->f_path.dentry->d_inode; | 981 | struct inode *inode = file_inode(filp); |
982 | unsigned long rc; | 982 | unsigned long rc; |
983 | 983 | ||
984 | rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); | 984 | rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 35bcc83d1e04..bf7a56b6d48a 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -688,7 +688,7 @@ static int | |||
688 | printer_fsync(struct file *fd, loff_t start, loff_t end, int datasync) | 688 | printer_fsync(struct file *fd, loff_t start, loff_t end, int datasync) |
689 | { | 689 | { |
690 | struct printer_dev *dev = fd->private_data; | 690 | struct printer_dev *dev = fd->private_data; |
691 | struct inode *inode = fd->f_path.dentry->d_inode; | 691 | struct inode *inode = file_inode(fd); |
692 | unsigned long flags; | 692 | unsigned long flags; |
693 | int tx_list_empty; | 693 | int tx_list_empty; |
694 | 694 | ||
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index e4192b887de9..d9297eebbf73 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -1065,7 +1065,7 @@ static int rndis_proc_show(struct seq_file *m, void *v) | |||
1065 | static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, | 1065 | static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, |
1066 | size_t count, loff_t *ppos) | 1066 | size_t count, loff_t *ppos) |
1067 | { | 1067 | { |
1068 | rndis_params *p = PDE(file->f_path.dentry->d_inode)->data; | 1068 | rndis_params *p = PDE(file_inode(file))->data; |
1069 | u32 speed = 0; | 1069 | u32 speed = 0; |
1070 | int i, fl_speed = 0; | 1070 | int i, fl_speed = 0; |
1071 | 1071 | ||
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index 4ecbf8496f48..dbce3a9074e6 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c | |||
@@ -440,7 +440,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename) | |||
440 | if (!(filp->f_mode & FMODE_WRITE)) | 440 | if (!(filp->f_mode & FMODE_WRITE)) |
441 | ro = 1; | 441 | ro = 1; |
442 | 442 | ||
443 | inode = filp->f_path.dentry->d_inode; | 443 | inode = file_inode(filp); |
444 | if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) { | 444 | if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) { |
445 | LINFO(curlun, "invalid file type: %s\n", filename); | 445 | LINFO(curlun, "invalid file type: %s\n", filename); |
446 | goto out; | 446 | goto out; |
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 88cad6b8b479..900aa4ecd617 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c | |||
@@ -69,7 +69,7 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
69 | int fb_deferred_io_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 69 | int fb_deferred_io_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
70 | { | 70 | { |
71 | struct fb_info *info = file->private_data; | 71 | struct fb_info *info = file->private_data; |
72 | struct inode *inode = file->f_path.dentry->d_inode; | 72 | struct inode *inode = file_inode(file); |
73 | int err = filemap_write_and_wait_range(inode->i_mapping, start, end); | 73 | int err = filemap_write_and_wait_range(inode->i_mapping, start, end); |
74 | if (err) | 74 | if (err) |
75 | return err; | 75 | return err; |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index dc61c12ecf8c..7c254084b6a0 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -727,7 +727,7 @@ static const struct file_operations fb_proc_fops = { | |||
727 | */ | 727 | */ |
728 | static struct fb_info *file_fb_info(struct file *file) | 728 | static struct fb_info *file_fb_info(struct file *file) |
729 | { | 729 | { |
730 | struct inode *inode = file->f_path.dentry->d_inode; | 730 | struct inode *inode = file_inode(file); |
731 | int fbidx = iminor(inode); | 731 | int fbidx = iminor(inode); |
732 | struct fb_info *info = registered_fb[fbidx]; | 732 | struct fb_info *info = registered_fb[fbidx]; |
733 | 733 | ||
diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index f2566c19e71c..113c7876c855 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c | |||
@@ -261,7 +261,7 @@ int get_img(struct mdp_img *img, struct fb_info *info, | |||
261 | if (f.file == NULL) | 261 | if (f.file == NULL) |
262 | return -1; | 262 | return -1; |
263 | 263 | ||
264 | if (MAJOR(f.file->f_dentry->d_inode->i_rdev) == FB_MAJOR) { | 264 | if (MAJOR(file_inode(f.file)->i_rdev) == FB_MAJOR) { |
265 | *start = info->fix.smem_start; | 265 | *start = info->fix.smem_start; |
266 | *len = info->fix.smem_len; | 266 | *len = info->fix.smem_len; |
267 | } else | 267 | } else |
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 11d55ce5ca81..70387582843f 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
@@ -411,7 +411,7 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
411 | .identity = DRIVER_NAME, | 411 | .identity = DRIVER_NAME, |
412 | }; | 412 | }; |
413 | void __user *argp = (void __user *)arg; | 413 | void __user *argp = (void __user *)arg; |
414 | struct inode *inode = file->f_path.dentry->d_inode; | 414 | struct inode *inode = file_inode(file); |
415 | int index = iminor(inode) - WD0_MINOR; | 415 | int index = iminor(inode) - WD0_MINOR; |
416 | struct cpwd *p = cpwd_device; | 416 | struct cpwd *p = cpwd_device; |
417 | int setopt = 0; | 417 | int setopt = 0; |
@@ -499,7 +499,7 @@ static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, | |||
499 | static ssize_t cpwd_write(struct file *file, const char __user *buf, | 499 | static ssize_t cpwd_write(struct file *file, const char __user *buf, |
500 | size_t count, loff_t *ppos) | 500 | size_t count, loff_t *ppos) |
501 | { | 501 | { |
502 | struct inode *inode = file->f_path.dentry->d_inode; | 502 | struct inode *inode = file_inode(file); |
503 | struct cpwd *p = cpwd_device; | 503 | struct cpwd *p = cpwd_device; |
504 | int index = iminor(inode); | 504 | int index = iminor(inode); |
505 | 505 | ||
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index 459b9ac45cf5..ec0abb6df3c3 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c | |||
@@ -24,47 +24,6 @@ | |||
24 | MODULE_DESCRIPTION("Xen filesystem"); | 24 | MODULE_DESCRIPTION("Xen filesystem"); |
25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
26 | 26 | ||
27 | static struct inode *xenfs_make_inode(struct super_block *sb, int mode) | ||
28 | { | ||
29 | struct inode *ret = new_inode(sb); | ||
30 | |||
31 | if (ret) { | ||
32 | ret->i_mode = mode; | ||
33 | ret->i_uid = GLOBAL_ROOT_UID; | ||
34 | ret->i_gid = GLOBAL_ROOT_GID; | ||
35 | ret->i_blocks = 0; | ||
36 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; | ||
37 | } | ||
38 | return ret; | ||
39 | } | ||
40 | |||
41 | static struct dentry *xenfs_create_file(struct super_block *sb, | ||
42 | struct dentry *parent, | ||
43 | const char *name, | ||
44 | const struct file_operations *fops, | ||
45 | void *data, | ||
46 | int mode) | ||
47 | { | ||
48 | struct dentry *dentry; | ||
49 | struct inode *inode; | ||
50 | |||
51 | dentry = d_alloc_name(parent, name); | ||
52 | if (!dentry) | ||
53 | return NULL; | ||
54 | |||
55 | inode = xenfs_make_inode(sb, S_IFREG | mode); | ||
56 | if (!inode) { | ||
57 | dput(dentry); | ||
58 | return NULL; | ||
59 | } | ||
60 | |||
61 | inode->i_fop = fops; | ||
62 | inode->i_private = data; | ||
63 | |||
64 | d_add(dentry, inode); | ||
65 | return dentry; | ||
66 | } | ||
67 | |||
68 | static ssize_t capabilities_read(struct file *file, char __user *buf, | 27 | static ssize_t capabilities_read(struct file *file, char __user *buf, |
69 | size_t size, loff_t *off) | 28 | size_t size, loff_t *off) |
70 | { | 29 | { |
@@ -84,26 +43,23 @@ static const struct file_operations capabilities_file_ops = { | |||
84 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | 43 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) |
85 | { | 44 | { |
86 | static struct tree_descr xenfs_files[] = { | 45 | static struct tree_descr xenfs_files[] = { |
87 | [1] = {}, | 46 | [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR }, |
88 | { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR }, | ||
89 | { "capabilities", &capabilities_file_ops, S_IRUGO }, | 47 | { "capabilities", &capabilities_file_ops, S_IRUGO }, |
90 | { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR }, | 48 | { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR }, |
91 | {""}, | 49 | {""}, |
92 | }; | 50 | }; |
93 | int rc; | ||
94 | 51 | ||
95 | rc = simple_fill_super(sb, XENFS_SUPER_MAGIC, xenfs_files); | 52 | static struct tree_descr xenfs_init_files[] = { |
96 | if (rc < 0) | 53 | [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR }, |
97 | return rc; | 54 | { "capabilities", &capabilities_file_ops, S_IRUGO }, |
98 | 55 | { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR }, | |
99 | if (xen_initial_domain()) { | 56 | { "xsd_kva", &xsd_kva_file_ops, S_IRUSR|S_IWUSR}, |
100 | xenfs_create_file(sb, sb->s_root, "xsd_kva", | 57 | { "xsd_port", &xsd_port_file_ops, S_IRUSR|S_IWUSR}, |
101 | &xsd_kva_file_ops, NULL, S_IRUSR|S_IWUSR); | 58 | {""}, |
102 | xenfs_create_file(sb, sb->s_root, "xsd_port", | 59 | }; |
103 | &xsd_port_file_ops, NULL, S_IRUSR|S_IWUSR); | ||
104 | } | ||
105 | 60 | ||
106 | return rc; | 61 | return simple_fill_super(sb, XENFS_SUPER_MAGIC, |
62 | xen_initial_domain() ? xenfs_init_files : xenfs_files); | ||
107 | } | 63 | } |
108 | 64 | ||
109 | static struct dentry *xenfs_mount(struct file_system_type *fs_type, | 65 | static struct dentry *xenfs_mount(struct file_system_type *fs_type, |
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index 988880dcee75..73b33837e12c 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
@@ -22,7 +22,7 @@ static loff_t | |||
22 | proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) | 22 | proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) |
23 | { | 23 | { |
24 | loff_t new = -1; | 24 | loff_t new = -1; |
25 | struct inode *inode = file->f_path.dentry->d_inode; | 25 | struct inode *inode = file_inode(file); |
26 | 26 | ||
27 | mutex_lock(&inode->i_mutex); | 27 | mutex_lock(&inode->i_mutex); |
28 | switch (whence) { | 28 | switch (whence) { |
@@ -47,7 +47,7 @@ proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) | |||
47 | static ssize_t | 47 | static ssize_t |
48 | proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 48 | proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) |
49 | { | 49 | { |
50 | struct inode *ino = file->f_path.dentry->d_inode; | 50 | struct inode *ino = file_inode(file); |
51 | struct proc_dir_entry *dp = PDE(ino); | 51 | struct proc_dir_entry *dp = PDE(ino); |
52 | struct zorro_dev *z = dp->data; | 52 | struct zorro_dev *z = dp->data; |
53 | struct ConfigDev cd; | 53 | struct ConfigDev cd; |
diff --git a/fs/9p/acl.c b/fs/9p/acl.c index 15b679166201..7af425f53bee 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "acl.h" | 23 | #include "acl.h" |
24 | #include "v9fs.h" | 24 | #include "v9fs.h" |
25 | #include "v9fs_vfs.h" | 25 | #include "v9fs_vfs.h" |
26 | #include "fid.h" | ||
26 | 27 | ||
27 | static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name) | 28 | static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name) |
28 | { | 29 | { |
@@ -113,16 +114,12 @@ struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type) | |||
113 | 114 | ||
114 | } | 115 | } |
115 | 116 | ||
116 | static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl) | 117 | static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl) |
117 | { | 118 | { |
118 | int retval; | 119 | int retval; |
119 | char *name; | 120 | char *name; |
120 | size_t size; | 121 | size_t size; |
121 | void *buffer; | 122 | void *buffer; |
122 | struct inode *inode = dentry->d_inode; | ||
123 | |||
124 | set_cached_acl(inode, type, acl); | ||
125 | |||
126 | if (!acl) | 123 | if (!acl) |
127 | return 0; | 124 | return 0; |
128 | 125 | ||
@@ -144,17 +141,16 @@ static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl) | |||
144 | default: | 141 | default: |
145 | BUG(); | 142 | BUG(); |
146 | } | 143 | } |
147 | retval = v9fs_xattr_set(dentry, name, buffer, size, 0); | 144 | retval = v9fs_fid_xattr_set(fid, name, buffer, size, 0); |
148 | err_free_out: | 145 | err_free_out: |
149 | kfree(buffer); | 146 | kfree(buffer); |
150 | return retval; | 147 | return retval; |
151 | } | 148 | } |
152 | 149 | ||
153 | int v9fs_acl_chmod(struct dentry *dentry) | 150 | int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid) |
154 | { | 151 | { |
155 | int retval = 0; | 152 | int retval = 0; |
156 | struct posix_acl *acl; | 153 | struct posix_acl *acl; |
157 | struct inode *inode = dentry->d_inode; | ||
158 | 154 | ||
159 | if (S_ISLNK(inode->i_mode)) | 155 | if (S_ISLNK(inode->i_mode)) |
160 | return -EOPNOTSUPP; | 156 | return -EOPNOTSUPP; |
@@ -163,25 +159,30 @@ int v9fs_acl_chmod(struct dentry *dentry) | |||
163 | retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); | 159 | retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); |
164 | if (retval) | 160 | if (retval) |
165 | return retval; | 161 | return retval; |
166 | retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, acl); | 162 | set_cached_acl(inode, ACL_TYPE_ACCESS, acl); |
163 | retval = v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl); | ||
167 | posix_acl_release(acl); | 164 | posix_acl_release(acl); |
168 | } | 165 | } |
169 | return retval; | 166 | return retval; |
170 | } | 167 | } |
171 | 168 | ||
172 | int v9fs_set_create_acl(struct dentry *dentry, | 169 | int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid, |
173 | struct posix_acl **dpacl, struct posix_acl **pacl) | 170 | struct posix_acl *dacl, struct posix_acl *acl) |
174 | { | 171 | { |
175 | if (dentry) { | 172 | set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl); |
176 | v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, *dpacl); | 173 | set_cached_acl(inode, ACL_TYPE_ACCESS, acl); |
177 | v9fs_set_acl(dentry, ACL_TYPE_ACCESS, *pacl); | 174 | v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl); |
178 | } | 175 | v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl); |
179 | posix_acl_release(*dpacl); | ||
180 | posix_acl_release(*pacl); | ||
181 | *dpacl = *pacl = NULL; | ||
182 | return 0; | 176 | return 0; |
183 | } | 177 | } |
184 | 178 | ||
179 | void v9fs_put_acl(struct posix_acl *dacl, | ||
180 | struct posix_acl *acl) | ||
181 | { | ||
182 | posix_acl_release(dacl); | ||
183 | posix_acl_release(acl); | ||
184 | } | ||
185 | |||
185 | int v9fs_acl_mode(struct inode *dir, umode_t *modep, | 186 | int v9fs_acl_mode(struct inode *dir, umode_t *modep, |
186 | struct posix_acl **dpacl, struct posix_acl **pacl) | 187 | struct posix_acl **dpacl, struct posix_acl **pacl) |
187 | { | 188 | { |
diff --git a/fs/9p/acl.h b/fs/9p/acl.h index 559556411965..e4f7e882272b 100644 --- a/fs/9p/acl.h +++ b/fs/9p/acl.h | |||
@@ -17,27 +17,33 @@ | |||
17 | #ifdef CONFIG_9P_FS_POSIX_ACL | 17 | #ifdef CONFIG_9P_FS_POSIX_ACL |
18 | extern int v9fs_get_acl(struct inode *, struct p9_fid *); | 18 | extern int v9fs_get_acl(struct inode *, struct p9_fid *); |
19 | extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type); | 19 | extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type); |
20 | extern int v9fs_acl_chmod(struct dentry *); | 20 | extern int v9fs_acl_chmod(struct inode *, struct p9_fid *); |
21 | extern int v9fs_set_create_acl(struct dentry *, | 21 | extern int v9fs_set_create_acl(struct inode *, struct p9_fid *, |
22 | struct posix_acl **, struct posix_acl **); | 22 | struct posix_acl *, struct posix_acl *); |
23 | extern int v9fs_acl_mode(struct inode *dir, umode_t *modep, | 23 | extern int v9fs_acl_mode(struct inode *dir, umode_t *modep, |
24 | struct posix_acl **dpacl, struct posix_acl **pacl); | 24 | struct posix_acl **dpacl, struct posix_acl **pacl); |
25 | extern void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl); | ||
25 | #else | 26 | #else |
26 | #define v9fs_iop_get_acl NULL | 27 | #define v9fs_iop_get_acl NULL |
27 | static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) | 28 | static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) |
28 | { | 29 | { |
29 | return 0; | 30 | return 0; |
30 | } | 31 | } |
31 | static inline int v9fs_acl_chmod(struct dentry *dentry) | 32 | static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid) |
32 | { | 33 | { |
33 | return 0; | 34 | return 0; |
34 | } | 35 | } |
35 | static inline int v9fs_set_create_acl(struct dentry *dentry, | 36 | static inline int v9fs_set_create_acl(struct inode *inode, |
36 | struct posix_acl **dpacl, | 37 | struct p9_fid *fid, |
37 | struct posix_acl **pacl) | 38 | struct posix_acl *dacl, |
39 | struct posix_acl *acl) | ||
38 | { | 40 | { |
39 | return 0; | 41 | return 0; |
40 | } | 42 | } |
43 | static inline void v9fs_put_acl(struct posix_acl *dacl, | ||
44 | struct posix_acl *acl) | ||
45 | { | ||
46 | } | ||
41 | static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep, | 47 | static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep, |
42 | struct posix_acl **dpacl, | 48 | struct posix_acl **dpacl, |
43 | struct posix_acl **pacl) | 49 | struct posix_acl **pacl) |
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 64600b5d0522..9ad68628522c 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -137,6 +137,7 @@ out_valid: | |||
137 | 137 | ||
138 | const struct dentry_operations v9fs_cached_dentry_operations = { | 138 | const struct dentry_operations v9fs_cached_dentry_operations = { |
139 | .d_revalidate = v9fs_lookup_revalidate, | 139 | .d_revalidate = v9fs_lookup_revalidate, |
140 | .d_weak_revalidate = v9fs_lookup_revalidate, | ||
140 | .d_delete = v9fs_cached_dentry_delete, | 141 | .d_delete = v9fs_cached_dentry_delete, |
141 | .d_release = v9fs_dentry_release, | 142 | .d_release = v9fs_dentry_release, |
142 | }; | 143 | }; |
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index c921ac92ea4c..d384a8b77ee8 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -129,7 +129,7 @@ out_error: | |||
129 | static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) | 129 | static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) |
130 | { | 130 | { |
131 | int res = 0; | 131 | int res = 0; |
132 | struct inode *inode = filp->f_path.dentry->d_inode; | 132 | struct inode *inode = file_inode(filp); |
133 | 133 | ||
134 | p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); | 134 | p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); |
135 | 135 | ||
@@ -298,7 +298,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) | |||
298 | 298 | ||
299 | static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) | 299 | static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) |
300 | { | 300 | { |
301 | struct inode *inode = filp->f_path.dentry->d_inode; | 301 | struct inode *inode = file_inode(filp); |
302 | int ret = -ENOLCK; | 302 | int ret = -ENOLCK; |
303 | 303 | ||
304 | p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", | 304 | p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", |
@@ -334,7 +334,7 @@ out_err: | |||
334 | static int v9fs_file_flock_dotl(struct file *filp, int cmd, | 334 | static int v9fs_file_flock_dotl(struct file *filp, int cmd, |
335 | struct file_lock *fl) | 335 | struct file_lock *fl) |
336 | { | 336 | { |
337 | struct inode *inode = filp->f_path.dentry->d_inode; | 337 | struct inode *inode = file_inode(filp); |
338 | int ret = -ENOLCK; | 338 | int ret = -ENOLCK; |
339 | 339 | ||
340 | p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", | 340 | p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", |
@@ -525,7 +525,7 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
525 | if (!count) | 525 | if (!count) |
526 | goto out; | 526 | goto out; |
527 | 527 | ||
528 | retval = v9fs_file_write_internal(filp->f_path.dentry->d_inode, | 528 | retval = v9fs_file_write_internal(file_inode(filp), |
529 | filp->private_data, | 529 | filp->private_data, |
530 | data, count, &origin, 1); | 530 | data, count, &origin, 1); |
531 | /* update offset on successful write */ | 531 | /* update offset on successful write */ |
@@ -600,7 +600,7 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
600 | struct v9fs_inode *v9inode; | 600 | struct v9fs_inode *v9inode; |
601 | struct page *page = vmf->page; | 601 | struct page *page = vmf->page; |
602 | struct file *filp = vma->vm_file; | 602 | struct file *filp = vma->vm_file; |
603 | struct inode *inode = filp->f_path.dentry->d_inode; | 603 | struct inode *inode = file_inode(filp); |
604 | 604 | ||
605 | 605 | ||
606 | p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n", | 606 | p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n", |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 07f409288d1b..61e4fa70a6fa 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -330,14 +330,14 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, | |||
330 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 330 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
331 | goto error; | 331 | goto error; |
332 | } | 332 | } |
333 | /* Now set the ACL based on the default value */ | ||
334 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
335 | |||
333 | err = v9fs_fid_add(dentry, fid); | 336 | err = v9fs_fid_add(dentry, fid); |
334 | if (err < 0) | 337 | if (err < 0) |
335 | goto error; | 338 | goto error; |
336 | d_instantiate(dentry, inode); | 339 | d_instantiate(dentry, inode); |
337 | 340 | ||
338 | /* Now set the ACL based on the default value */ | ||
339 | v9fs_set_create_acl(dentry, &dacl, &pacl); | ||
340 | |||
341 | v9inode = V9FS_I(inode); | 341 | v9inode = V9FS_I(inode); |
342 | mutex_lock(&v9inode->v_mutex); | 342 | mutex_lock(&v9inode->v_mutex); |
343 | if (v9ses->cache && !v9inode->writeback_fid && | 343 | if (v9ses->cache && !v9inode->writeback_fid && |
@@ -369,6 +369,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, | |||
369 | #endif | 369 | #endif |
370 | *opened |= FILE_CREATED; | 370 | *opened |= FILE_CREATED; |
371 | out: | 371 | out: |
372 | v9fs_put_acl(dacl, pacl); | ||
372 | dput(res); | 373 | dput(res); |
373 | return err; | 374 | return err; |
374 | 375 | ||
@@ -378,7 +379,6 @@ error: | |||
378 | err_clunk_old_fid: | 379 | err_clunk_old_fid: |
379 | if (ofid) | 380 | if (ofid) |
380 | p9_client_clunk(ofid); | 381 | p9_client_clunk(ofid); |
381 | v9fs_set_create_acl(NULL, &dacl, &pacl); | ||
382 | goto out; | 382 | goto out; |
383 | } | 383 | } |
384 | 384 | ||
@@ -435,17 +435,17 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
435 | if (err < 0) | 435 | if (err < 0) |
436 | goto error; | 436 | goto error; |
437 | 437 | ||
438 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
439 | if (IS_ERR(fid)) { | ||
440 | err = PTR_ERR(fid); | ||
441 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
442 | err); | ||
443 | fid = NULL; | ||
444 | goto error; | ||
445 | } | ||
446 | |||
438 | /* instantiate inode and assign the unopened fid to the dentry */ | 447 | /* instantiate inode and assign the unopened fid to the dentry */ |
439 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | 448 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
440 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
441 | if (IS_ERR(fid)) { | ||
442 | err = PTR_ERR(fid); | ||
443 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
444 | err); | ||
445 | fid = NULL; | ||
446 | goto error; | ||
447 | } | ||
448 | |||
449 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); | 449 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
450 | if (IS_ERR(inode)) { | 450 | if (IS_ERR(inode)) { |
451 | err = PTR_ERR(inode); | 451 | err = PTR_ERR(inode); |
@@ -456,6 +456,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
456 | err = v9fs_fid_add(dentry, fid); | 456 | err = v9fs_fid_add(dentry, fid); |
457 | if (err < 0) | 457 | if (err < 0) |
458 | goto error; | 458 | goto error; |
459 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
459 | d_instantiate(dentry, inode); | 460 | d_instantiate(dentry, inode); |
460 | fid = NULL; | 461 | fid = NULL; |
461 | } else { | 462 | } else { |
@@ -469,16 +470,15 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, | |||
469 | err = PTR_ERR(inode); | 470 | err = PTR_ERR(inode); |
470 | goto error; | 471 | goto error; |
471 | } | 472 | } |
473 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
472 | d_instantiate(dentry, inode); | 474 | d_instantiate(dentry, inode); |
473 | } | 475 | } |
474 | /* Now set the ACL based on the default value */ | ||
475 | v9fs_set_create_acl(dentry, &dacl, &pacl); | ||
476 | inc_nlink(dir); | 476 | inc_nlink(dir); |
477 | v9fs_invalidate_inode_attr(dir); | 477 | v9fs_invalidate_inode_attr(dir); |
478 | error: | 478 | error: |
479 | if (fid) | 479 | if (fid) |
480 | p9_client_clunk(fid); | 480 | p9_client_clunk(fid); |
481 | v9fs_set_create_acl(NULL, &dacl, &pacl); | 481 | v9fs_put_acl(dacl, pacl); |
482 | return err; | 482 | return err; |
483 | } | 483 | } |
484 | 484 | ||
@@ -572,10 +572,11 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
572 | struct v9fs_session_info *v9ses; | 572 | struct v9fs_session_info *v9ses; |
573 | struct p9_fid *fid; | 573 | struct p9_fid *fid; |
574 | struct p9_iattr_dotl p9attr; | 574 | struct p9_iattr_dotl p9attr; |
575 | struct inode *inode = dentry->d_inode; | ||
575 | 576 | ||
576 | p9_debug(P9_DEBUG_VFS, "\n"); | 577 | p9_debug(P9_DEBUG_VFS, "\n"); |
577 | 578 | ||
578 | retval = inode_change_ok(dentry->d_inode, iattr); | 579 | retval = inode_change_ok(inode, iattr); |
579 | if (retval) | 580 | if (retval) |
580 | return retval; | 581 | return retval; |
581 | 582 | ||
@@ -596,23 +597,23 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
596 | return PTR_ERR(fid); | 597 | return PTR_ERR(fid); |
597 | 598 | ||
598 | /* Write all dirty data */ | 599 | /* Write all dirty data */ |
599 | if (S_ISREG(dentry->d_inode->i_mode)) | 600 | if (S_ISREG(inode->i_mode)) |
600 | filemap_write_and_wait(dentry->d_inode->i_mapping); | 601 | filemap_write_and_wait(inode->i_mapping); |
601 | 602 | ||
602 | retval = p9_client_setattr(fid, &p9attr); | 603 | retval = p9_client_setattr(fid, &p9attr); |
603 | if (retval < 0) | 604 | if (retval < 0) |
604 | return retval; | 605 | return retval; |
605 | 606 | ||
606 | if ((iattr->ia_valid & ATTR_SIZE) && | 607 | if ((iattr->ia_valid & ATTR_SIZE) && |
607 | iattr->ia_size != i_size_read(dentry->d_inode)) | 608 | iattr->ia_size != i_size_read(inode)) |
608 | truncate_setsize(dentry->d_inode, iattr->ia_size); | 609 | truncate_setsize(inode, iattr->ia_size); |
609 | 610 | ||
610 | v9fs_invalidate_inode_attr(dentry->d_inode); | 611 | v9fs_invalidate_inode_attr(inode); |
611 | setattr_copy(dentry->d_inode, iattr); | 612 | setattr_copy(inode, iattr); |
612 | mark_inode_dirty(dentry->d_inode); | 613 | mark_inode_dirty(inode); |
613 | if (iattr->ia_valid & ATTR_MODE) { | 614 | if (iattr->ia_valid & ATTR_MODE) { |
614 | /* We also want to update ACL when we update mode bits */ | 615 | /* We also want to update ACL when we update mode bits */ |
615 | retval = v9fs_acl_chmod(dentry); | 616 | retval = v9fs_acl_chmod(inode, fid); |
616 | if (retval < 0) | 617 | if (retval < 0) |
617 | return retval; | 618 | return retval; |
618 | } | 619 | } |
@@ -880,17 +881,17 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, | |||
880 | goto error; | 881 | goto error; |
881 | 882 | ||
882 | v9fs_invalidate_inode_attr(dir); | 883 | v9fs_invalidate_inode_attr(dir); |
884 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
885 | if (IS_ERR(fid)) { | ||
886 | err = PTR_ERR(fid); | ||
887 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
888 | err); | ||
889 | fid = NULL; | ||
890 | goto error; | ||
891 | } | ||
892 | |||
883 | /* instantiate inode and assign the unopened fid to the dentry */ | 893 | /* instantiate inode and assign the unopened fid to the dentry */ |
884 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | 894 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
885 | fid = p9_client_walk(dfid, 1, &name, 1); | ||
886 | if (IS_ERR(fid)) { | ||
887 | err = PTR_ERR(fid); | ||
888 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", | ||
889 | err); | ||
890 | fid = NULL; | ||
891 | goto error; | ||
892 | } | ||
893 | |||
894 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); | 895 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
895 | if (IS_ERR(inode)) { | 896 | if (IS_ERR(inode)) { |
896 | err = PTR_ERR(inode); | 897 | err = PTR_ERR(inode); |
@@ -898,6 +899,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, | |||
898 | err); | 899 | err); |
899 | goto error; | 900 | goto error; |
900 | } | 901 | } |
902 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
901 | err = v9fs_fid_add(dentry, fid); | 903 | err = v9fs_fid_add(dentry, fid); |
902 | if (err < 0) | 904 | if (err < 0) |
903 | goto error; | 905 | goto error; |
@@ -913,14 +915,13 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, | |||
913 | err = PTR_ERR(inode); | 915 | err = PTR_ERR(inode); |
914 | goto error; | 916 | goto error; |
915 | } | 917 | } |
918 | v9fs_set_create_acl(inode, fid, dacl, pacl); | ||
916 | d_instantiate(dentry, inode); | 919 | d_instantiate(dentry, inode); |
917 | } | 920 | } |
918 | /* Now set the ACL based on the default value */ | ||
919 | v9fs_set_create_acl(dentry, &dacl, &pacl); | ||
920 | error: | 921 | error: |
921 | if (fid) | 922 | if (fid) |
922 | p9_client_clunk(fid); | 923 | p9_client_clunk(fid); |
923 | v9fs_set_create_acl(NULL, &dacl, &pacl); | 924 | v9fs_put_acl(dacl, pacl); |
924 | return err; | 925 | return err; |
925 | } | 926 | } |
926 | 927 | ||
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 137d50396898..91dad63e5a2d 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -363,5 +363,5 @@ struct file_system_type v9fs_fs_type = { | |||
363 | .mount = v9fs_mount, | 363 | .mount = v9fs_mount, |
364 | .kill_sb = v9fs_kill_super, | 364 | .kill_sb = v9fs_kill_super, |
365 | .owner = THIS_MODULE, | 365 | .owner = THIS_MODULE, |
366 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT, | 366 | .fs_flags = FS_RENAME_DOES_D_MOVE, |
367 | }; | 367 | }; |
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c index 29653b70a9c3..c45e016b190f 100644 --- a/fs/9p/xattr.c +++ b/fs/9p/xattr.c | |||
@@ -111,19 +111,26 @@ ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name, | |||
111 | int v9fs_xattr_set(struct dentry *dentry, const char *name, | 111 | int v9fs_xattr_set(struct dentry *dentry, const char *name, |
112 | const void *value, size_t value_len, int flags) | 112 | const void *value, size_t value_len, int flags) |
113 | { | 113 | { |
114 | struct p9_fid *fid = v9fs_fid_lookup(dentry); | ||
115 | if (IS_ERR(fid)) | ||
116 | return PTR_ERR(fid); | ||
117 | return v9fs_fid_xattr_set(fid, name, value, value_len, flags); | ||
118 | } | ||
119 | |||
120 | int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, | ||
121 | const void *value, size_t value_len, int flags) | ||
122 | { | ||
114 | u64 offset = 0; | 123 | u64 offset = 0; |
115 | int retval, msize, write_count; | 124 | int retval, msize, write_count; |
116 | struct p9_fid *fid = NULL; | ||
117 | 125 | ||
118 | p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n", | 126 | p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n", |
119 | name, value_len, flags); | 127 | name, value_len, flags); |
120 | 128 | ||
121 | fid = v9fs_fid_clone(dentry); | 129 | /* Clone it */ |
122 | if (IS_ERR(fid)) { | 130 | fid = p9_client_walk(fid, 0, NULL, 1); |
123 | retval = PTR_ERR(fid); | 131 | if (IS_ERR(fid)) |
124 | fid = NULL; | 132 | return PTR_ERR(fid); |
125 | goto error; | 133 | |
126 | } | ||
127 | /* | 134 | /* |
128 | * On success fid points to xattr | 135 | * On success fid points to xattr |
129 | */ | 136 | */ |
@@ -131,7 +138,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name, | |||
131 | if (retval < 0) { | 138 | if (retval < 0) { |
132 | p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n", | 139 | p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n", |
133 | retval); | 140 | retval); |
134 | goto error; | 141 | p9_client_clunk(fid); |
142 | return retval; | ||
135 | } | 143 | } |
136 | msize = fid->clnt->msize; | 144 | msize = fid->clnt->msize; |
137 | while (value_len) { | 145 | while (value_len) { |
@@ -144,17 +152,12 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name, | |||
144 | if (write_count < 0) { | 152 | if (write_count < 0) { |
145 | /* error in xattr write */ | 153 | /* error in xattr write */ |
146 | retval = write_count; | 154 | retval = write_count; |
147 | goto error; | 155 | break; |
148 | } | 156 | } |
149 | offset += write_count; | 157 | offset += write_count; |
150 | value_len -= write_count; | 158 | value_len -= write_count; |
151 | } | 159 | } |
152 | /* Total read xattr bytes */ | 160 | return p9_client_clunk(fid); |
153 | retval = offset; | ||
154 | error: | ||
155 | if (fid) | ||
156 | retval = p9_client_clunk(fid); | ||
157 | return retval; | ||
158 | } | 161 | } |
159 | 162 | ||
160 | ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | 163 | ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) |
diff --git a/fs/9p/xattr.h b/fs/9p/xattr.h index eaa837c53bd5..eec348a3df71 100644 --- a/fs/9p/xattr.h +++ b/fs/9p/xattr.h | |||
@@ -27,6 +27,8 @@ extern ssize_t v9fs_fid_xattr_get(struct p9_fid *, const char *, | |||
27 | void *, size_t); | 27 | void *, size_t); |
28 | extern ssize_t v9fs_xattr_get(struct dentry *, const char *, | 28 | extern ssize_t v9fs_xattr_get(struct dentry *, const char *, |
29 | void *, size_t); | 29 | void *, size_t); |
30 | extern int v9fs_fid_xattr_set(struct p9_fid *, const char *, | ||
31 | const void *, size_t, int); | ||
30 | extern int v9fs_xattr_set(struct dentry *, const char *, | 32 | extern int v9fs_xattr_set(struct dentry *, const char *, |
31 | const void *, size_t, int); | 33 | const void *, size_t, int); |
32 | extern ssize_t v9fs_listxattr(struct dentry *, char *, size_t); | 34 | extern ssize_t v9fs_listxattr(struct dentry *, char *, size_t); |
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index b3be2e7c5643..9cf874ce8336 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c | |||
@@ -19,7 +19,7 @@ static DEFINE_RWLOCK(adfs_dir_lock); | |||
19 | static int | 19 | static int |
20 | adfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 20 | adfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
21 | { | 21 | { |
22 | struct inode *inode = filp->f_path.dentry->d_inode; | 22 | struct inode *inode = file_inode(filp); |
23 | struct super_block *sb = inode->i_sb; | 23 | struct super_block *sb = inode->i_sb; |
24 | struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir; | 24 | struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir; |
25 | struct object_info obj; | 25 | struct object_info obj; |
diff --git a/fs/affs/dir.c b/fs/affs/dir.c index 8ca8f3a55599..fd11a6d608ee 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c | |||
@@ -42,7 +42,7 @@ const struct inode_operations affs_dir_inode_operations = { | |||
42 | static int | 42 | static int |
43 | affs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 43 | affs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
44 | { | 44 | { |
45 | struct inode *inode = filp->f_path.dentry->d_inode; | 45 | struct inode *inode = file_inode(filp); |
46 | struct super_block *sb = inode->i_sb; | 46 | struct super_block *sb = inode->i_sb; |
47 | struct buffer_head *dir_bh; | 47 | struct buffer_head *dir_bh; |
48 | struct buffer_head *fh_bh; | 48 | struct buffer_head *fh_bh; |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index db477906ba4f..7a465ed04444 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -393,12 +393,12 @@ static int afs_readdir(struct file *file, void *cookie, filldir_t filldir) | |||
393 | int ret; | 393 | int ret; |
394 | 394 | ||
395 | _enter("{%Ld,{%lu}}", | 395 | _enter("{%Ld,{%lu}}", |
396 | file->f_pos, file->f_path.dentry->d_inode->i_ino); | 396 | file->f_pos, file_inode(file)->i_ino); |
397 | 397 | ||
398 | ASSERT(file->private_data != NULL); | 398 | ASSERT(file->private_data != NULL); |
399 | 399 | ||
400 | fpos = file->f_pos; | 400 | fpos = file->f_pos; |
401 | ret = afs_dir_iterate(file->f_path.dentry->d_inode, &fpos, | 401 | ret = afs_dir_iterate(file_inode(file), &fpos, |
402 | cookie, filldir, file->private_data); | 402 | cookie, filldir, file->private_data); |
403 | file->f_pos = fpos; | 403 | file->f_pos = fpos; |
404 | 404 | ||
diff --git a/fs/afs/flock.c b/fs/afs/flock.c index 757d664575dd..2497bf306c70 100644 --- a/fs/afs/flock.c +++ b/fs/afs/flock.c | |||
@@ -514,7 +514,7 @@ error: | |||
514 | */ | 514 | */ |
515 | int afs_lock(struct file *file, int cmd, struct file_lock *fl) | 515 | int afs_lock(struct file *file, int cmd, struct file_lock *fl) |
516 | { | 516 | { |
517 | struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode); | 517 | struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); |
518 | 518 | ||
519 | _enter("{%x:%u},%d,{t=%x,fl=%x,r=%Ld:%Ld}", | 519 | _enter("{%x:%u},%d,{t=%x,fl=%x,r=%Ld:%Ld}", |
520 | vnode->fid.vid, vnode->fid.vnode, cmd, | 520 | vnode->fid.vid, vnode->fid.vnode, cmd, |
@@ -537,7 +537,7 @@ int afs_lock(struct file *file, int cmd, struct file_lock *fl) | |||
537 | */ | 537 | */ |
538 | int afs_flock(struct file *file, int cmd, struct file_lock *fl) | 538 | int afs_flock(struct file *file, int cmd, struct file_lock *fl) |
539 | { | 539 | { |
540 | struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode); | 540 | struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); |
541 | 541 | ||
542 | _enter("{%x:%u},%d,{t=%x,fl=%x}", | 542 | _enter("{%x:%u},%d,{t=%x,fl=%x}", |
543 | vnode->fid.vid, vnode->fid.vnode, cmd, | 543 | vnode->fid.vid, vnode->fid.vnode, cmd, |
diff --git a/fs/afs/write.c b/fs/afs/write.c index 9aa52d93c73c..7e03eadb40c0 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -120,7 +120,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, | |||
120 | struct page **pagep, void **fsdata) | 120 | struct page **pagep, void **fsdata) |
121 | { | 121 | { |
122 | struct afs_writeback *candidate, *wb; | 122 | struct afs_writeback *candidate, *wb; |
123 | struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode); | 123 | struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); |
124 | struct page *page; | 124 | struct page *page; |
125 | struct key *key = file->private_data; | 125 | struct key *key = file->private_data; |
126 | unsigned from = pos & (PAGE_CACHE_SIZE - 1); | 126 | unsigned from = pos & (PAGE_CACHE_SIZE - 1); |
@@ -245,7 +245,7 @@ int afs_write_end(struct file *file, struct address_space *mapping, | |||
245 | loff_t pos, unsigned len, unsigned copied, | 245 | loff_t pos, unsigned len, unsigned copied, |
246 | struct page *page, void *fsdata) | 246 | struct page *page, void *fsdata) |
247 | { | 247 | { |
248 | struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode); | 248 | struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); |
249 | loff_t i_size, maybe_i_size; | 249 | loff_t i_size, maybe_i_size; |
250 | 250 | ||
251 | _enter("{%x:%u},{%lx}", | 251 | _enter("{%x:%u},{%lx}", |
@@ -627,8 +627,7 @@ void afs_pages_written_back(struct afs_vnode *vnode, struct afs_call *call) | |||
627 | ssize_t afs_file_write(struct kiocb *iocb, const struct iovec *iov, | 627 | ssize_t afs_file_write(struct kiocb *iocb, const struct iovec *iov, |
628 | unsigned long nr_segs, loff_t pos) | 628 | unsigned long nr_segs, loff_t pos) |
629 | { | 629 | { |
630 | struct dentry *dentry = iocb->ki_filp->f_path.dentry; | 630 | struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp)); |
631 | struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); | ||
632 | ssize_t result; | 631 | ssize_t result; |
633 | size_t count = iov_length(iov, nr_segs); | 632 | size_t count = iov_length(iov, nr_segs); |
634 | 633 | ||
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 28d39fb84ae3..47a65df8c871 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
@@ -131,7 +131,6 @@ struct file *anon_inode_getfile(const char *name, | |||
131 | struct qstr this; | 131 | struct qstr this; |
132 | struct path path; | 132 | struct path path; |
133 | struct file *file; | 133 | struct file *file; |
134 | int error; | ||
135 | 134 | ||
136 | if (IS_ERR(anon_inode_inode)) | 135 | if (IS_ERR(anon_inode_inode)) |
137 | return ERR_PTR(-ENODEV); | 136 | return ERR_PTR(-ENODEV); |
@@ -143,7 +142,7 @@ struct file *anon_inode_getfile(const char *name, | |||
143 | * Link the inode to a directory entry by creating a unique name | 142 | * Link the inode to a directory entry by creating a unique name |
144 | * using the inode sequence number. | 143 | * using the inode sequence number. |
145 | */ | 144 | */ |
146 | error = -ENOMEM; | 145 | file = ERR_PTR(-ENOMEM); |
147 | this.name = name; | 146 | this.name = name; |
148 | this.len = strlen(name); | 147 | this.len = strlen(name); |
149 | this.hash = 0; | 148 | this.hash = 0; |
@@ -160,15 +159,12 @@ struct file *anon_inode_getfile(const char *name, | |||
160 | 159 | ||
161 | d_instantiate(path.dentry, anon_inode_inode); | 160 | d_instantiate(path.dentry, anon_inode_inode); |
162 | 161 | ||
163 | error = -ENFILE; | ||
164 | file = alloc_file(&path, OPEN_FMODE(flags), fops); | 162 | file = alloc_file(&path, OPEN_FMODE(flags), fops); |
165 | if (!file) | 163 | if (IS_ERR(file)) |
166 | goto err_dput; | 164 | goto err_dput; |
167 | file->f_mapping = anon_inode_inode->i_mapping; | 165 | file->f_mapping = anon_inode_inode->i_mapping; |
168 | 166 | ||
169 | file->f_pos = 0; | ||
170 | file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); | 167 | file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); |
171 | file->f_version = 0; | ||
172 | file->private_data = priv; | 168 | file->private_data = priv; |
173 | 169 | ||
174 | return file; | 170 | return file; |
@@ -177,7 +173,7 @@ err_dput: | |||
177 | path_put(&path); | 173 | path_put(&path); |
178 | err_module: | 174 | err_module: |
179 | module_put(fops->owner); | 175 | module_put(fops->owner); |
180 | return ERR_PTR(error); | 176 | return file; |
181 | } | 177 | } |
182 | EXPORT_SYMBOL_GPL(anon_inode_getfile); | 178 | EXPORT_SYMBOL_GPL(anon_inode_getfile); |
183 | 179 | ||
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index b785e7707959..3f1128b37e46 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -273,7 +273,7 @@ static inline int autofs_prepare_pipe(struct file *pipe) | |||
273 | { | 273 | { |
274 | if (!pipe->f_op || !pipe->f_op->write) | 274 | if (!pipe->f_op || !pipe->f_op->write) |
275 | return -EINVAL; | 275 | return -EINVAL; |
276 | if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode)) | 276 | if (!S_ISFIFO(file_inode(pipe)->i_mode)) |
277 | return -EINVAL; | 277 | return -EINVAL; |
278 | /* We want a packet pipe */ | 278 | /* We want a packet pipe */ |
279 | pipe->f_flags |= O_DIRECT; | 279 | pipe->f_flags |= O_DIRECT; |
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index 9f68a37bb2b2..743c7c2c949d 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -159,7 +159,7 @@ static struct autofs_sb_info *autofs_dev_ioctl_sbi(struct file *f) | |||
159 | struct inode *inode; | 159 | struct inode *inode; |
160 | 160 | ||
161 | if (f) { | 161 | if (f) { |
162 | inode = f->f_path.dentry->d_inode; | 162 | inode = file_inode(f); |
163 | sbi = autofs4_sbi(inode->i_sb); | 163 | sbi = autofs4_sbi(inode->i_sb); |
164 | } | 164 | } |
165 | return sbi; | 165 | return sbi; |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index c93447604da8..230bd2aad4f4 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -587,7 +587,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry) | |||
587 | 587 | ||
588 | /* This allows root to remove symlinks */ | 588 | /* This allows root to remove symlinks */ |
589 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) | 589 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) |
590 | return -EACCES; | 590 | return -EPERM; |
591 | 591 | ||
592 | if (atomic_dec_and_test(&ino->count)) { | 592 | if (atomic_dec_and_test(&ino->count)) { |
593 | p_ino = autofs4_dentry_ino(dentry->d_parent); | 593 | p_ino = autofs4_dentry_ino(dentry->d_parent); |
@@ -874,7 +874,7 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp, | |||
874 | static long autofs4_root_ioctl(struct file *filp, | 874 | static long autofs4_root_ioctl(struct file *filp, |
875 | unsigned int cmd, unsigned long arg) | 875 | unsigned int cmd, unsigned long arg) |
876 | { | 876 | { |
877 | struct inode *inode = filp->f_dentry->d_inode; | 877 | struct inode *inode = file_inode(filp); |
878 | return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); | 878 | return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); |
879 | } | 879 | } |
880 | 880 | ||
@@ -882,7 +882,7 @@ static long autofs4_root_ioctl(struct file *filp, | |||
882 | static long autofs4_root_compat_ioctl(struct file *filp, | 882 | static long autofs4_root_compat_ioctl(struct file *filp, |
883 | unsigned int cmd, unsigned long arg) | 883 | unsigned int cmd, unsigned long arg) |
884 | { | 884 | { |
885 | struct inode *inode = filp->f_path.dentry->d_inode; | 885 | struct inode *inode = file_inode(filp); |
886 | int ret; | 886 | int ret; |
887 | 887 | ||
888 | if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) | 888 | if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 2b3bda8d5e68..c8f4e25eb9e2 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -213,7 +213,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) | |||
213 | static int | 213 | static int |
214 | befs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 214 | befs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
215 | { | 215 | { |
216 | struct inode *inode = filp->f_path.dentry->d_inode; | 216 | struct inode *inode = file_inode(filp); |
217 | struct super_block *sb = inode->i_sb; | 217 | struct super_block *sb = inode->i_sb; |
218 | befs_data_stream *ds = &BEFS_I(inode)->i_data.ds; | 218 | befs_data_stream *ds = &BEFS_I(inode)->i_data.ds; |
219 | befs_off_t value; | 219 | befs_off_t value; |
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 2785ef91191a..3f422f6bb5ca 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
@@ -28,7 +28,7 @@ static struct buffer_head *bfs_find_entry(struct inode *dir, | |||
28 | 28 | ||
29 | static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir) | 29 | static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir) |
30 | { | 30 | { |
31 | struct inode *dir = f->f_path.dentry->d_inode; | 31 | struct inode *dir = file_inode(f); |
32 | struct buffer_head *bh; | 32 | struct buffer_head *bh; |
33 | struct bfs_dirent *de; | 33 | struct bfs_dirent *de; |
34 | struct bfs_sb_info *info = BFS_SB(dir->i_sb); | 34 | struct bfs_sb_info *info = BFS_SB(dir->i_sb); |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 6043567b95c2..bbc8f8827eac 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -214,7 +214,7 @@ static int load_aout_binary(struct linux_binprm * bprm) | |||
214 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && | 214 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && |
215 | N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || | 215 | N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || |
216 | N_TRSIZE(ex) || N_DRSIZE(ex) || | 216 | N_TRSIZE(ex) || N_DRSIZE(ex) || |
217 | i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { | 217 | i_size_read(file_inode(bprm->file)) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { |
218 | return -ENOEXEC; | 218 | return -ENOEXEC; |
219 | } | 219 | } |
220 | 220 | ||
@@ -367,7 +367,7 @@ static int load_aout_library(struct file *file) | |||
367 | int retval; | 367 | int retval; |
368 | struct exec ex; | 368 | struct exec ex; |
369 | 369 | ||
370 | inode = file->f_path.dentry->d_inode; | 370 | inode = file_inode(file); |
371 | 371 | ||
372 | retval = -ENOEXEC; | 372 | retval = -ENOEXEC; |
373 | error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); | 373 | error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index ff9dbc630efa..a5702d74d2bd 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1141,7 +1141,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, | |||
1141 | 1141 | ||
1142 | /* By default, dump shared memory if mapped from an anonymous file. */ | 1142 | /* By default, dump shared memory if mapped from an anonymous file. */ |
1143 | if (vma->vm_flags & VM_SHARED) { | 1143 | if (vma->vm_flags & VM_SHARED) { |
1144 | if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0 ? | 1144 | if (file_inode(vma->vm_file)->i_nlink == 0 ? |
1145 | FILTER(ANON_SHARED) : FILTER(MAPPED_SHARED)) | 1145 | FILTER(ANON_SHARED) : FILTER(MAPPED_SHARED)) |
1146 | goto whole; | 1146 | goto whole; |
1147 | return 0; | 1147 | return 0; |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index cb240dd3b402..9c13e023e2b7 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -909,7 +909,7 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params, | |||
909 | 909 | ||
910 | dynamic_error: | 910 | dynamic_error: |
911 | printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n", | 911 | printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n", |
912 | what, file->f_path.dentry->d_inode->i_ino); | 912 | what, file_inode(file)->i_ino); |
913 | return -ELIBBAD; | 913 | return -ELIBBAD; |
914 | } | 914 | } |
915 | 915 | ||
@@ -1219,7 +1219,7 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags) | |||
1219 | 1219 | ||
1220 | /* By default, dump shared memory if mapped from an anonymous file. */ | 1220 | /* By default, dump shared memory if mapped from an anonymous file. */ |
1221 | if (vma->vm_flags & VM_SHARED) { | 1221 | if (vma->vm_flags & VM_SHARED) { |
1222 | if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) { | 1222 | if (file_inode(vma->vm_file)->i_nlink == 0) { |
1223 | dump_ok = test_bit(MMF_DUMP_ANON_SHARED, &mm_flags); | 1223 | dump_ok = test_bit(MMF_DUMP_ANON_SHARED, &mm_flags); |
1224 | kdcore("%08lx: %08lx: %s (share)", vma->vm_start, | 1224 | kdcore("%08lx: %08lx: %s (share)", vma->vm_start, |
1225 | vma->vm_flags, dump_ok ? "yes" : "no"); | 1225 | vma->vm_flags, dump_ok ? "yes" : "no"); |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index b56371981d16..2036d21baaef 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -438,7 +438,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
438 | int ret; | 438 | int ret; |
439 | 439 | ||
440 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ | 440 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ |
441 | inode = bprm->file->f_path.dentry->d_inode; | 441 | inode = file_inode(bprm->file); |
442 | 442 | ||
443 | text_len = ntohl(hdr->data_start); | 443 | text_len = ntohl(hdr->data_start); |
444 | data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start); | 444 | data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start); |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 0c8869fdd14e..fecbbf3f8ff2 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -531,7 +531,7 @@ static void kill_node(Node *e) | |||
531 | static ssize_t | 531 | static ssize_t |
532 | bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) | 532 | bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) |
533 | { | 533 | { |
534 | Node *e = file->f_path.dentry->d_inode->i_private; | 534 | Node *e = file_inode(file)->i_private; |
535 | ssize_t res; | 535 | ssize_t res; |
536 | char *page; | 536 | char *page; |
537 | 537 | ||
@@ -550,7 +550,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer, | |||
550 | size_t count, loff_t *ppos) | 550 | size_t count, loff_t *ppos) |
551 | { | 551 | { |
552 | struct dentry *root; | 552 | struct dentry *root; |
553 | Node *e = file->f_path.dentry->d_inode->i_private; | 553 | Node *e = file_inode(file)->i_private; |
554 | int res = parse_command(buffer, count); | 554 | int res = parse_command(buffer, count); |
555 | 555 | ||
556 | switch (res) { | 556 | switch (res) { |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 78333a37f49d..53f5fae5cfbe 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -318,7 +318,7 @@ static int blkdev_write_end(struct file *file, struct address_space *mapping, | |||
318 | 318 | ||
319 | /* | 319 | /* |
320 | * private llseek: | 320 | * private llseek: |
321 | * for a block special file file->f_path.dentry->d_inode->i_size is zero | 321 | * for a block special file file_inode(file)->i_size is zero |
322 | * so we compute the size by hand (just as in block_read/write above) | 322 | * so we compute the size by hand (just as in block_read/write above) |
323 | */ | 323 | */ |
324 | static loff_t block_llseek(struct file *file, loff_t offset, int whence) | 324 | static loff_t block_llseek(struct file *file, loff_t offset, int whence) |
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 614f34a899c2..81ee29eeb7ca 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -22,10 +22,10 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len, | |||
22 | 22 | ||
23 | if (parent && (len < BTRFS_FID_SIZE_CONNECTABLE)) { | 23 | if (parent && (len < BTRFS_FID_SIZE_CONNECTABLE)) { |
24 | *max_len = BTRFS_FID_SIZE_CONNECTABLE; | 24 | *max_len = BTRFS_FID_SIZE_CONNECTABLE; |
25 | return 255; | 25 | return FILEID_INVALID; |
26 | } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) { | 26 | } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) { |
27 | *max_len = BTRFS_FID_SIZE_NON_CONNECTABLE; | 27 | *max_len = BTRFS_FID_SIZE_NON_CONNECTABLE; |
28 | return 255; | 28 | return FILEID_INVALID; |
29 | } | 29 | } |
30 | 30 | ||
31 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; | 31 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index aeb84469d2c4..4b241fe9d2fe 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1225,7 +1225,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, | |||
1225 | struct extent_state *cached_state = NULL; | 1225 | struct extent_state *cached_state = NULL; |
1226 | int i; | 1226 | int i; |
1227 | unsigned long index = pos >> PAGE_CACHE_SHIFT; | 1227 | unsigned long index = pos >> PAGE_CACHE_SHIFT; |
1228 | struct inode *inode = fdentry(file)->d_inode; | 1228 | struct inode *inode = file_inode(file); |
1229 | gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping); | 1229 | gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping); |
1230 | int err = 0; | 1230 | int err = 0; |
1231 | int faili = 0; | 1231 | int faili = 0; |
@@ -1312,7 +1312,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, | |||
1312 | struct iov_iter *i, | 1312 | struct iov_iter *i, |
1313 | loff_t pos) | 1313 | loff_t pos) |
1314 | { | 1314 | { |
1315 | struct inode *inode = fdentry(file)->d_inode; | 1315 | struct inode *inode = file_inode(file); |
1316 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1316 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1317 | struct page **pages = NULL; | 1317 | struct page **pages = NULL; |
1318 | unsigned long first_index; | 1318 | unsigned long first_index; |
@@ -1500,7 +1500,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1500 | unsigned long nr_segs, loff_t pos) | 1500 | unsigned long nr_segs, loff_t pos) |
1501 | { | 1501 | { |
1502 | struct file *file = iocb->ki_filp; | 1502 | struct file *file = iocb->ki_filp; |
1503 | struct inode *inode = fdentry(file)->d_inode; | 1503 | struct inode *inode = file_inode(file); |
1504 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1504 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1505 | loff_t *ppos = &iocb->ki_pos; | 1505 | loff_t *ppos = &iocb->ki_pos; |
1506 | u64 start_pos; | 1506 | u64 start_pos; |
@@ -2102,7 +2102,7 @@ out: | |||
2102 | static long btrfs_fallocate(struct file *file, int mode, | 2102 | static long btrfs_fallocate(struct file *file, int mode, |
2103 | loff_t offset, loff_t len) | 2103 | loff_t offset, loff_t len) |
2104 | { | 2104 | { |
2105 | struct inode *inode = file->f_path.dentry->d_inode; | 2105 | struct inode *inode = file_inode(file); |
2106 | struct extent_state *cached_state = NULL; | 2106 | struct extent_state *cached_state = NULL; |
2107 | u64 cur_offset; | 2107 | u64 cur_offset; |
2108 | u64 last_byte; | 2108 | u64 last_byte; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index cc93b23ca352..55c07b650378 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4391,7 +4391,7 @@ unsigned char btrfs_filetype_table[] = { | |||
4391 | static int btrfs_real_readdir(struct file *filp, void *dirent, | 4391 | static int btrfs_real_readdir(struct file *filp, void *dirent, |
4392 | filldir_t filldir) | 4392 | filldir_t filldir) |
4393 | { | 4393 | { |
4394 | struct inode *inode = filp->f_dentry->d_inode; | 4394 | struct inode *inode = file_inode(filp); |
4395 | struct btrfs_root *root = BTRFS_I(inode)->root; | 4395 | struct btrfs_root *root = BTRFS_I(inode)->root; |
4396 | struct btrfs_item *item; | 4396 | struct btrfs_item *item; |
4397 | struct btrfs_dir_item *di; | 4397 | struct btrfs_dir_item *di; |
@@ -6791,7 +6791,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset) | |||
6791 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 6791 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
6792 | { | 6792 | { |
6793 | struct page *page = vmf->page; | 6793 | struct page *page = vmf->page; |
6794 | struct inode *inode = fdentry(vma->vm_file)->d_inode; | 6794 | struct inode *inode = file_inode(vma->vm_file); |
6795 | struct btrfs_root *root = BTRFS_I(inode)->root; | 6795 | struct btrfs_root *root = BTRFS_I(inode)->root; |
6796 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; | 6796 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
6797 | struct btrfs_ordered_extent *ordered; | 6797 | struct btrfs_ordered_extent *ordered; |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 338f2597bf7f..c3f09f71bedd 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -152,7 +152,7 @@ void btrfs_inherit_iflags(struct inode *inode, struct inode *dir) | |||
152 | 152 | ||
153 | static int btrfs_ioctl_getflags(struct file *file, void __user *arg) | 153 | static int btrfs_ioctl_getflags(struct file *file, void __user *arg) |
154 | { | 154 | { |
155 | struct btrfs_inode *ip = BTRFS_I(file->f_path.dentry->d_inode); | 155 | struct btrfs_inode *ip = BTRFS_I(file_inode(file)); |
156 | unsigned int flags = btrfs_flags_to_ioctl(ip->flags); | 156 | unsigned int flags = btrfs_flags_to_ioctl(ip->flags); |
157 | 157 | ||
158 | if (copy_to_user(arg, &flags, sizeof(flags))) | 158 | if (copy_to_user(arg, &flags, sizeof(flags))) |
@@ -177,7 +177,7 @@ static int check_flags(unsigned int flags) | |||
177 | 177 | ||
178 | static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | 178 | static int btrfs_ioctl_setflags(struct file *file, void __user *arg) |
179 | { | 179 | { |
180 | struct inode *inode = file->f_path.dentry->d_inode; | 180 | struct inode *inode = file_inode(file); |
181 | struct btrfs_inode *ip = BTRFS_I(inode); | 181 | struct btrfs_inode *ip = BTRFS_I(inode); |
182 | struct btrfs_root *root = ip->root; | 182 | struct btrfs_root *root = ip->root; |
183 | struct btrfs_trans_handle *trans; | 183 | struct btrfs_trans_handle *trans; |
@@ -310,7 +310,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
310 | 310 | ||
311 | static int btrfs_ioctl_getversion(struct file *file, int __user *arg) | 311 | static int btrfs_ioctl_getversion(struct file *file, int __user *arg) |
312 | { | 312 | { |
313 | struct inode *inode = file->f_path.dentry->d_inode; | 313 | struct inode *inode = file_inode(file); |
314 | 314 | ||
315 | return put_user(inode->i_generation, arg); | 315 | return put_user(inode->i_generation, arg); |
316 | } | 316 | } |
@@ -1320,7 +1320,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, | |||
1320 | u64 new_size; | 1320 | u64 new_size; |
1321 | u64 old_size; | 1321 | u64 old_size; |
1322 | u64 devid = 1; | 1322 | u64 devid = 1; |
1323 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 1323 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
1324 | struct btrfs_ioctl_vol_args *vol_args; | 1324 | struct btrfs_ioctl_vol_args *vol_args; |
1325 | struct btrfs_trans_handle *trans; | 1325 | struct btrfs_trans_handle *trans; |
1326 | struct btrfs_device *device = NULL; | 1326 | struct btrfs_device *device = NULL; |
@@ -1489,8 +1489,8 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file, | |||
1489 | goto out_drop_write; | 1489 | goto out_drop_write; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | src_inode = src.file->f_path.dentry->d_inode; | 1492 | src_inode = file_inode(src.file); |
1493 | if (src_inode->i_sb != file->f_path.dentry->d_inode->i_sb) { | 1493 | if (src_inode->i_sb != file_inode(file)->i_sb) { |
1494 | printk(KERN_INFO "btrfs: Snapshot src from " | 1494 | printk(KERN_INFO "btrfs: Snapshot src from " |
1495 | "another FS\n"); | 1495 | "another FS\n"); |
1496 | ret = -EINVAL; | 1496 | ret = -EINVAL; |
@@ -1582,7 +1582,7 @@ out: | |||
1582 | static noinline int btrfs_ioctl_subvol_getflags(struct file *file, | 1582 | static noinline int btrfs_ioctl_subvol_getflags(struct file *file, |
1583 | void __user *arg) | 1583 | void __user *arg) |
1584 | { | 1584 | { |
1585 | struct inode *inode = fdentry(file)->d_inode; | 1585 | struct inode *inode = file_inode(file); |
1586 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1586 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1587 | int ret = 0; | 1587 | int ret = 0; |
1588 | u64 flags = 0; | 1588 | u64 flags = 0; |
@@ -1604,7 +1604,7 @@ static noinline int btrfs_ioctl_subvol_getflags(struct file *file, | |||
1604 | static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | 1604 | static noinline int btrfs_ioctl_subvol_setflags(struct file *file, |
1605 | void __user *arg) | 1605 | void __user *arg) |
1606 | { | 1606 | { |
1607 | struct inode *inode = fdentry(file)->d_inode; | 1607 | struct inode *inode = file_inode(file); |
1608 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1608 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1609 | struct btrfs_trans_handle *trans; | 1609 | struct btrfs_trans_handle *trans; |
1610 | u64 root_flags; | 1610 | u64 root_flags; |
@@ -1898,7 +1898,7 @@ static noinline int btrfs_ioctl_tree_search(struct file *file, | |||
1898 | if (IS_ERR(args)) | 1898 | if (IS_ERR(args)) |
1899 | return PTR_ERR(args); | 1899 | return PTR_ERR(args); |
1900 | 1900 | ||
1901 | inode = fdentry(file)->d_inode; | 1901 | inode = file_inode(file); |
1902 | ret = search_ioctl(inode, args); | 1902 | ret = search_ioctl(inode, args); |
1903 | if (ret == 0 && copy_to_user(argp, args, sizeof(*args))) | 1903 | if (ret == 0 && copy_to_user(argp, args, sizeof(*args))) |
1904 | ret = -EFAULT; | 1904 | ret = -EFAULT; |
@@ -2008,7 +2008,7 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file, | |||
2008 | if (IS_ERR(args)) | 2008 | if (IS_ERR(args)) |
2009 | return PTR_ERR(args); | 2009 | return PTR_ERR(args); |
2010 | 2010 | ||
2011 | inode = fdentry(file)->d_inode; | 2011 | inode = file_inode(file); |
2012 | 2012 | ||
2013 | if (args->treeid == 0) | 2013 | if (args->treeid == 0) |
2014 | args->treeid = BTRFS_I(inode)->root->root_key.objectid; | 2014 | args->treeid = BTRFS_I(inode)->root->root_key.objectid; |
@@ -2184,7 +2184,7 @@ out: | |||
2184 | 2184 | ||
2185 | static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | 2185 | static int btrfs_ioctl_defrag(struct file *file, void __user *argp) |
2186 | { | 2186 | { |
2187 | struct inode *inode = fdentry(file)->d_inode; | 2187 | struct inode *inode = file_inode(file); |
2188 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2188 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2189 | struct btrfs_ioctl_defrag_range_args *range; | 2189 | struct btrfs_ioctl_defrag_range_args *range; |
2190 | int ret; | 2190 | int ret; |
@@ -2244,7 +2244,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | |||
2244 | /* the rest are all set to zero by kzalloc */ | 2244 | /* the rest are all set to zero by kzalloc */ |
2245 | range->len = (u64)-1; | 2245 | range->len = (u64)-1; |
2246 | } | 2246 | } |
2247 | ret = btrfs_defrag_file(fdentry(file)->d_inode, file, | 2247 | ret = btrfs_defrag_file(file_inode(file), file, |
2248 | range, 0, 0); | 2248 | range, 0, 0); |
2249 | if (ret > 0) | 2249 | if (ret > 0) |
2250 | ret = 0; | 2250 | ret = 0; |
@@ -2292,7 +2292,7 @@ out: | |||
2292 | 2292 | ||
2293 | static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) | 2293 | static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) |
2294 | { | 2294 | { |
2295 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 2295 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
2296 | struct btrfs_ioctl_vol_args *vol_args; | 2296 | struct btrfs_ioctl_vol_args *vol_args; |
2297 | int ret; | 2297 | int ret; |
2298 | 2298 | ||
@@ -2415,7 +2415,7 @@ out: | |||
2415 | static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | 2415 | static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, |
2416 | u64 off, u64 olen, u64 destoff) | 2416 | u64 off, u64 olen, u64 destoff) |
2417 | { | 2417 | { |
2418 | struct inode *inode = fdentry(file)->d_inode; | 2418 | struct inode *inode = file_inode(file); |
2419 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2419 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2420 | struct fd src_file; | 2420 | struct fd src_file; |
2421 | struct inode *src; | 2421 | struct inode *src; |
@@ -2461,7 +2461,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2461 | if (src_file.file->f_path.mnt != file->f_path.mnt) | 2461 | if (src_file.file->f_path.mnt != file->f_path.mnt) |
2462 | goto out_fput; | 2462 | goto out_fput; |
2463 | 2463 | ||
2464 | src = src_file.file->f_dentry->d_inode; | 2464 | src = file_inode(src_file.file); |
2465 | 2465 | ||
2466 | ret = -EINVAL; | 2466 | ret = -EINVAL; |
2467 | if (src == inode) | 2467 | if (src == inode) |
@@ -2823,7 +2823,7 @@ static long btrfs_ioctl_clone_range(struct file *file, void __user *argp) | |||
2823 | */ | 2823 | */ |
2824 | static long btrfs_ioctl_trans_start(struct file *file) | 2824 | static long btrfs_ioctl_trans_start(struct file *file) |
2825 | { | 2825 | { |
2826 | struct inode *inode = fdentry(file)->d_inode; | 2826 | struct inode *inode = file_inode(file); |
2827 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2827 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2828 | struct btrfs_trans_handle *trans; | 2828 | struct btrfs_trans_handle *trans; |
2829 | int ret; | 2829 | int ret; |
@@ -2863,7 +2863,7 @@ out: | |||
2863 | 2863 | ||
2864 | static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) | 2864 | static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) |
2865 | { | 2865 | { |
2866 | struct inode *inode = fdentry(file)->d_inode; | 2866 | struct inode *inode = file_inode(file); |
2867 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2867 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2868 | struct btrfs_root *new_root; | 2868 | struct btrfs_root *new_root; |
2869 | struct btrfs_dir_item *di; | 2869 | struct btrfs_dir_item *di; |
@@ -3087,7 +3087,7 @@ out: | |||
3087 | */ | 3087 | */ |
3088 | long btrfs_ioctl_trans_end(struct file *file) | 3088 | long btrfs_ioctl_trans_end(struct file *file) |
3089 | { | 3089 | { |
3090 | struct inode *inode = fdentry(file)->d_inode; | 3090 | struct inode *inode = file_inode(file); |
3091 | struct btrfs_root *root = BTRFS_I(inode)->root; | 3091 | struct btrfs_root *root = BTRFS_I(inode)->root; |
3092 | struct btrfs_trans_handle *trans; | 3092 | struct btrfs_trans_handle *trans; |
3093 | 3093 | ||
@@ -3149,7 +3149,7 @@ static noinline long btrfs_ioctl_wait_sync(struct btrfs_root *root, | |||
3149 | 3149 | ||
3150 | static long btrfs_ioctl_scrub(struct file *file, void __user *arg) | 3150 | static long btrfs_ioctl_scrub(struct file *file, void __user *arg) |
3151 | { | 3151 | { |
3152 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 3152 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
3153 | struct btrfs_ioctl_scrub_args *sa; | 3153 | struct btrfs_ioctl_scrub_args *sa; |
3154 | int ret; | 3154 | int ret; |
3155 | 3155 | ||
@@ -3440,7 +3440,7 @@ void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock, | |||
3440 | 3440 | ||
3441 | static long btrfs_ioctl_balance(struct file *file, void __user *arg) | 3441 | static long btrfs_ioctl_balance(struct file *file, void __user *arg) |
3442 | { | 3442 | { |
3443 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 3443 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
3444 | struct btrfs_fs_info *fs_info = root->fs_info; | 3444 | struct btrfs_fs_info *fs_info = root->fs_info; |
3445 | struct btrfs_ioctl_balance_args *bargs; | 3445 | struct btrfs_ioctl_balance_args *bargs; |
3446 | struct btrfs_balance_control *bctl; | 3446 | struct btrfs_balance_control *bctl; |
@@ -3630,7 +3630,7 @@ out: | |||
3630 | 3630 | ||
3631 | static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg) | 3631 | static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg) |
3632 | { | 3632 | { |
3633 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 3633 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
3634 | struct btrfs_ioctl_quota_ctl_args *sa; | 3634 | struct btrfs_ioctl_quota_ctl_args *sa; |
3635 | struct btrfs_trans_handle *trans = NULL; | 3635 | struct btrfs_trans_handle *trans = NULL; |
3636 | int ret; | 3636 | int ret; |
@@ -3689,7 +3689,7 @@ drop_write: | |||
3689 | 3689 | ||
3690 | static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg) | 3690 | static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg) |
3691 | { | 3691 | { |
3692 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 3692 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
3693 | struct btrfs_ioctl_qgroup_assign_args *sa; | 3693 | struct btrfs_ioctl_qgroup_assign_args *sa; |
3694 | struct btrfs_trans_handle *trans; | 3694 | struct btrfs_trans_handle *trans; |
3695 | int ret; | 3695 | int ret; |
@@ -3736,7 +3736,7 @@ drop_write: | |||
3736 | 3736 | ||
3737 | static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg) | 3737 | static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg) |
3738 | { | 3738 | { |
3739 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 3739 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
3740 | struct btrfs_ioctl_qgroup_create_args *sa; | 3740 | struct btrfs_ioctl_qgroup_create_args *sa; |
3741 | struct btrfs_trans_handle *trans; | 3741 | struct btrfs_trans_handle *trans; |
3742 | int ret; | 3742 | int ret; |
@@ -3787,7 +3787,7 @@ drop_write: | |||
3787 | 3787 | ||
3788 | static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg) | 3788 | static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg) |
3789 | { | 3789 | { |
3790 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 3790 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
3791 | struct btrfs_ioctl_qgroup_limit_args *sa; | 3791 | struct btrfs_ioctl_qgroup_limit_args *sa; |
3792 | struct btrfs_trans_handle *trans; | 3792 | struct btrfs_trans_handle *trans; |
3793 | int ret; | 3793 | int ret; |
@@ -3837,7 +3837,7 @@ static long btrfs_ioctl_set_received_subvol(struct file *file, | |||
3837 | void __user *arg) | 3837 | void __user *arg) |
3838 | { | 3838 | { |
3839 | struct btrfs_ioctl_received_subvol_args *sa = NULL; | 3839 | struct btrfs_ioctl_received_subvol_args *sa = NULL; |
3840 | struct inode *inode = fdentry(file)->d_inode; | 3840 | struct inode *inode = file_inode(file); |
3841 | struct btrfs_root *root = BTRFS_I(inode)->root; | 3841 | struct btrfs_root *root = BTRFS_I(inode)->root; |
3842 | struct btrfs_root_item *root_item = &root->root_item; | 3842 | struct btrfs_root_item *root_item = &root->root_item; |
3843 | struct btrfs_trans_handle *trans; | 3843 | struct btrfs_trans_handle *trans; |
@@ -3917,7 +3917,7 @@ out: | |||
3917 | long btrfs_ioctl(struct file *file, unsigned int | 3917 | long btrfs_ioctl(struct file *file, unsigned int |
3918 | cmd, unsigned long arg) | 3918 | cmd, unsigned long arg) |
3919 | { | 3919 | { |
3920 | struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; | 3920 | struct btrfs_root *root = BTRFS_I(file_inode(file))->root; |
3921 | void __user *argp = (void __user *)arg; | 3921 | void __user *argp = (void __user *)arg; |
3922 | 3922 | ||
3923 | switch (cmd) { | 3923 | switch (cmd) { |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 321b7fb4e441..f4ab7a9260eb 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -4544,7 +4544,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) | |||
4544 | if (!capable(CAP_SYS_ADMIN)) | 4544 | if (!capable(CAP_SYS_ADMIN)) |
4545 | return -EPERM; | 4545 | return -EPERM; |
4546 | 4546 | ||
4547 | send_root = BTRFS_I(fdentry(mnt_file)->d_inode)->root; | 4547 | send_root = BTRFS_I(file_inode(mnt_file))->root; |
4548 | fs_info = send_root->fs_info; | 4548 | fs_info = send_root->fs_info; |
4549 | 4549 | ||
4550 | arg = memdup_user(arg_, sizeof(*arg)); | 4550 | arg = memdup_user(arg_, sizeof(*arg)); |
diff --git a/fs/buffer.c b/fs/buffer.c index 62169c192c21..8e18281b4077 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2332,7 +2332,7 @@ int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
2332 | get_block_t get_block) | 2332 | get_block_t get_block) |
2333 | { | 2333 | { |
2334 | struct page *page = vmf->page; | 2334 | struct page *page = vmf->page; |
2335 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 2335 | struct inode *inode = file_inode(vma->vm_file); |
2336 | unsigned long end; | 2336 | unsigned long end; |
2337 | loff_t size; | 2337 | loff_t size; |
2338 | int ret; | 2338 | int ret; |
@@ -2371,7 +2371,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
2371 | get_block_t get_block) | 2371 | get_block_t get_block) |
2372 | { | 2372 | { |
2373 | int ret; | 2373 | int ret; |
2374 | struct super_block *sb = vma->vm_file->f_path.dentry->d_inode->i_sb; | 2374 | struct super_block *sb = file_inode(vma->vm_file)->i_sb; |
2375 | 2375 | ||
2376 | sb_start_pagefault(sb); | 2376 | sb_start_pagefault(sb); |
2377 | 2377 | ||
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 064d1a68d2c1..d4f81edd9a5d 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -195,7 +195,7 @@ static int ceph_releasepage(struct page *page, gfp_t g) | |||
195 | */ | 195 | */ |
196 | static int readpage_nounlock(struct file *filp, struct page *page) | 196 | static int readpage_nounlock(struct file *filp, struct page *page) |
197 | { | 197 | { |
198 | struct inode *inode = filp->f_dentry->d_inode; | 198 | struct inode *inode = file_inode(filp); |
199 | struct ceph_inode_info *ci = ceph_inode(inode); | 199 | struct ceph_inode_info *ci = ceph_inode(inode); |
200 | struct ceph_osd_client *osdc = | 200 | struct ceph_osd_client *osdc = |
201 | &ceph_inode_to_client(inode)->client->osdc; | 201 | &ceph_inode_to_client(inode)->client->osdc; |
@@ -370,7 +370,7 @@ out: | |||
370 | static int ceph_readpages(struct file *file, struct address_space *mapping, | 370 | static int ceph_readpages(struct file *file, struct address_space *mapping, |
371 | struct list_head *page_list, unsigned nr_pages) | 371 | struct list_head *page_list, unsigned nr_pages) |
372 | { | 372 | { |
373 | struct inode *inode = file->f_dentry->d_inode; | 373 | struct inode *inode = file_inode(file); |
374 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | 374 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); |
375 | int rc = 0; | 375 | int rc = 0; |
376 | int max = 0; | 376 | int max = 0; |
@@ -977,7 +977,7 @@ static int ceph_update_writeable_page(struct file *file, | |||
977 | loff_t pos, unsigned len, | 977 | loff_t pos, unsigned len, |
978 | struct page *page) | 978 | struct page *page) |
979 | { | 979 | { |
980 | struct inode *inode = file->f_dentry->d_inode; | 980 | struct inode *inode = file_inode(file); |
981 | struct ceph_inode_info *ci = ceph_inode(inode); | 981 | struct ceph_inode_info *ci = ceph_inode(inode); |
982 | struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc; | 982 | struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc; |
983 | loff_t page_off = pos & PAGE_CACHE_MASK; | 983 | loff_t page_off = pos & PAGE_CACHE_MASK; |
@@ -1086,7 +1086,7 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping, | |||
1086 | loff_t pos, unsigned len, unsigned flags, | 1086 | loff_t pos, unsigned len, unsigned flags, |
1087 | struct page **pagep, void **fsdata) | 1087 | struct page **pagep, void **fsdata) |
1088 | { | 1088 | { |
1089 | struct inode *inode = file->f_dentry->d_inode; | 1089 | struct inode *inode = file_inode(file); |
1090 | struct ceph_inode_info *ci = ceph_inode(inode); | 1090 | struct ceph_inode_info *ci = ceph_inode(inode); |
1091 | struct ceph_file_info *fi = file->private_data; | 1091 | struct ceph_file_info *fi = file->private_data; |
1092 | struct page *page; | 1092 | struct page *page; |
@@ -1144,7 +1144,7 @@ static int ceph_write_end(struct file *file, struct address_space *mapping, | |||
1144 | loff_t pos, unsigned len, unsigned copied, | 1144 | loff_t pos, unsigned len, unsigned copied, |
1145 | struct page *page, void *fsdata) | 1145 | struct page *page, void *fsdata) |
1146 | { | 1146 | { |
1147 | struct inode *inode = file->f_dentry->d_inode; | 1147 | struct inode *inode = file_inode(file); |
1148 | struct ceph_inode_info *ci = ceph_inode(inode); | 1148 | struct ceph_inode_info *ci = ceph_inode(inode); |
1149 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | 1149 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); |
1150 | struct ceph_mds_client *mdsc = fsc->mdsc; | 1150 | struct ceph_mds_client *mdsc = fsc->mdsc; |
@@ -1228,7 +1228,7 @@ const struct address_space_operations ceph_aops = { | |||
1228 | */ | 1228 | */ |
1229 | static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 1229 | static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
1230 | { | 1230 | { |
1231 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | 1231 | struct inode *inode = file_inode(vma->vm_file); |
1232 | struct page *page = vmf->page; | 1232 | struct page *page = vmf->page; |
1233 | struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc; | 1233 | struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc; |
1234 | loff_t off = page_offset(page); | 1234 | loff_t off = page_offset(page); |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 8c1aabe93b67..6d797f46d772 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -238,7 +238,7 @@ static int note_last_dentry(struct ceph_file_info *fi, const char *name, | |||
238 | static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir) | 238 | static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir) |
239 | { | 239 | { |
240 | struct ceph_file_info *fi = filp->private_data; | 240 | struct ceph_file_info *fi = filp->private_data; |
241 | struct inode *inode = filp->f_dentry->d_inode; | 241 | struct inode *inode = file_inode(filp); |
242 | struct ceph_inode_info *ci = ceph_inode(inode); | 242 | struct ceph_inode_info *ci = ceph_inode(inode); |
243 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | 243 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); |
244 | struct ceph_mds_client *mdsc = fsc->mdsc; | 244 | struct ceph_mds_client *mdsc = fsc->mdsc; |
@@ -1138,7 +1138,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, | |||
1138 | loff_t *ppos) | 1138 | loff_t *ppos) |
1139 | { | 1139 | { |
1140 | struct ceph_file_info *cf = file->private_data; | 1140 | struct ceph_file_info *cf = file->private_data; |
1141 | struct inode *inode = file->f_dentry->d_inode; | 1141 | struct inode *inode = file_inode(file); |
1142 | struct ceph_inode_info *ci = ceph_inode(inode); | 1142 | struct ceph_inode_info *ci = ceph_inode(inode); |
1143 | int left; | 1143 | int left; |
1144 | const int bufsize = 1024; | 1144 | const int bufsize = 1024; |
@@ -1188,7 +1188,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, | |||
1188 | static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end, | 1188 | static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end, |
1189 | int datasync) | 1189 | int datasync) |
1190 | { | 1190 | { |
1191 | struct inode *inode = file->f_path.dentry->d_inode; | 1191 | struct inode *inode = file_inode(file); |
1192 | struct ceph_inode_info *ci = ceph_inode(inode); | 1192 | struct ceph_inode_info *ci = ceph_inode(inode); |
1193 | struct list_head *head = &ci->i_unsafe_dirops; | 1193 | struct list_head *head = &ci->i_unsafe_dirops; |
1194 | struct ceph_mds_request *req; | 1194 | struct ceph_mds_request *req; |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index ca3ab3f9ca70..16796be53ca5 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -81,7 +81,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, | |||
81 | if (parent_inode) { | 81 | if (parent_inode) { |
82 | /* nfsd wants connectable */ | 82 | /* nfsd wants connectable */ |
83 | *max_len = connected_handle_length; | 83 | *max_len = connected_handle_length; |
84 | type = 255; | 84 | type = FILEID_INVALID; |
85 | } else { | 85 | } else { |
86 | dout("encode_fh %p\n", dentry); | 86 | dout("encode_fh %p\n", dentry); |
87 | fh->ino = ceph_ino(inode); | 87 | fh->ino = ceph_ino(inode); |
@@ -90,7 +90,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, | |||
90 | } | 90 | } |
91 | } else { | 91 | } else { |
92 | *max_len = handle_length; | 92 | *max_len = handle_length; |
93 | type = 255; | 93 | type = FILEID_INVALID; |
94 | } | 94 | } |
95 | if (dentry) | 95 | if (dentry) |
96 | dput(dentry); | 96 | dput(dentry); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index e51558fca3a3..11b57c2c8f15 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -393,7 +393,7 @@ more: | |||
393 | static ssize_t ceph_sync_read(struct file *file, char __user *data, | 393 | static ssize_t ceph_sync_read(struct file *file, char __user *data, |
394 | unsigned len, loff_t *poff, int *checkeof) | 394 | unsigned len, loff_t *poff, int *checkeof) |
395 | { | 395 | { |
396 | struct inode *inode = file->f_dentry->d_inode; | 396 | struct inode *inode = file_inode(file); |
397 | struct page **pages; | 397 | struct page **pages; |
398 | u64 off = *poff; | 398 | u64 off = *poff; |
399 | int num_pages, ret; | 399 | int num_pages, ret; |
@@ -466,7 +466,7 @@ static void sync_write_commit(struct ceph_osd_request *req, | |||
466 | static ssize_t ceph_sync_write(struct file *file, const char __user *data, | 466 | static ssize_t ceph_sync_write(struct file *file, const char __user *data, |
467 | size_t left, loff_t *offset) | 467 | size_t left, loff_t *offset) |
468 | { | 468 | { |
469 | struct inode *inode = file->f_dentry->d_inode; | 469 | struct inode *inode = file_inode(file); |
470 | struct ceph_inode_info *ci = ceph_inode(inode); | 470 | struct ceph_inode_info *ci = ceph_inode(inode); |
471 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | 471 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); |
472 | struct ceph_osd_request *req; | 472 | struct ceph_osd_request *req; |
@@ -483,7 +483,7 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, | |||
483 | int ret; | 483 | int ret; |
484 | struct timespec mtime = CURRENT_TIME; | 484 | struct timespec mtime = CURRENT_TIME; |
485 | 485 | ||
486 | if (ceph_snap(file->f_dentry->d_inode) != CEPH_NOSNAP) | 486 | if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) |
487 | return -EROFS; | 487 | return -EROFS; |
488 | 488 | ||
489 | dout("sync_write on file %p %lld~%u %s\n", file, *offset, | 489 | dout("sync_write on file %p %lld~%u %s\n", file, *offset, |
@@ -637,7 +637,7 @@ static ssize_t ceph_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
637 | struct ceph_file_info *fi = filp->private_data; | 637 | struct ceph_file_info *fi = filp->private_data; |
638 | loff_t *ppos = &iocb->ki_pos; | 638 | loff_t *ppos = &iocb->ki_pos; |
639 | size_t len = iov->iov_len; | 639 | size_t len = iov->iov_len; |
640 | struct inode *inode = filp->f_dentry->d_inode; | 640 | struct inode *inode = file_inode(filp); |
641 | struct ceph_inode_info *ci = ceph_inode(inode); | 641 | struct ceph_inode_info *ci = ceph_inode(inode); |
642 | void __user *base = iov->iov_base; | 642 | void __user *base = iov->iov_base; |
643 | ssize_t ret; | 643 | ssize_t ret; |
@@ -707,7 +707,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
707 | { | 707 | { |
708 | struct file *file = iocb->ki_filp; | 708 | struct file *file = iocb->ki_filp; |
709 | struct ceph_file_info *fi = file->private_data; | 709 | struct ceph_file_info *fi = file->private_data; |
710 | struct inode *inode = file->f_dentry->d_inode; | 710 | struct inode *inode = file_inode(file); |
711 | struct ceph_inode_info *ci = ceph_inode(inode); | 711 | struct ceph_inode_info *ci = ceph_inode(inode); |
712 | struct ceph_osd_client *osdc = | 712 | struct ceph_osd_client *osdc = |
713 | &ceph_sb_to_client(inode->i_sb)->client->osdc; | 713 | &ceph_sb_to_client(inode->i_sb)->client->osdc; |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index d45895f4a04d..851814d951cd 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -1131,8 +1131,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
1131 | req->r_request_started); | 1131 | req->r_request_started); |
1132 | dout(" final dn %p\n", dn); | 1132 | dout(" final dn %p\n", dn); |
1133 | i++; | 1133 | i++; |
1134 | } else if (req->r_op == CEPH_MDS_OP_LOOKUPSNAP || | 1134 | } else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP || |
1135 | req->r_op == CEPH_MDS_OP_MKSNAP) { | 1135 | req->r_op == CEPH_MDS_OP_MKSNAP) && !req->r_aborted) { |
1136 | struct dentry *dn = req->r_dentry; | 1136 | struct dentry *dn = req->r_dentry; |
1137 | 1137 | ||
1138 | /* fill out a snapdir LOOKUPSNAP dentry */ | 1138 | /* fill out a snapdir LOOKUPSNAP dentry */ |
@@ -1196,6 +1196,39 @@ done: | |||
1196 | /* | 1196 | /* |
1197 | * Prepopulate our cache with readdir results, leases, etc. | 1197 | * Prepopulate our cache with readdir results, leases, etc. |
1198 | */ | 1198 | */ |
1199 | static int readdir_prepopulate_inodes_only(struct ceph_mds_request *req, | ||
1200 | struct ceph_mds_session *session) | ||
1201 | { | ||
1202 | struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; | ||
1203 | int i, err = 0; | ||
1204 | |||
1205 | for (i = 0; i < rinfo->dir_nr; i++) { | ||
1206 | struct ceph_vino vino; | ||
1207 | struct inode *in; | ||
1208 | int rc; | ||
1209 | |||
1210 | vino.ino = le64_to_cpu(rinfo->dir_in[i].in->ino); | ||
1211 | vino.snap = le64_to_cpu(rinfo->dir_in[i].in->snapid); | ||
1212 | |||
1213 | in = ceph_get_inode(req->r_dentry->d_sb, vino); | ||
1214 | if (IS_ERR(in)) { | ||
1215 | err = PTR_ERR(in); | ||
1216 | dout("new_inode badness got %d\n", err); | ||
1217 | continue; | ||
1218 | } | ||
1219 | rc = fill_inode(in, &rinfo->dir_in[i], NULL, session, | ||
1220 | req->r_request_started, -1, | ||
1221 | &req->r_caps_reservation); | ||
1222 | if (rc < 0) { | ||
1223 | pr_err("fill_inode badness on %p got %d\n", in, rc); | ||
1224 | err = rc; | ||
1225 | continue; | ||
1226 | } | ||
1227 | } | ||
1228 | |||
1229 | return err; | ||
1230 | } | ||
1231 | |||
1199 | int ceph_readdir_prepopulate(struct ceph_mds_request *req, | 1232 | int ceph_readdir_prepopulate(struct ceph_mds_request *req, |
1200 | struct ceph_mds_session *session) | 1233 | struct ceph_mds_session *session) |
1201 | { | 1234 | { |
@@ -1210,6 +1243,9 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, | |||
1210 | u64 frag = le32_to_cpu(rhead->args.readdir.frag); | 1243 | u64 frag = le32_to_cpu(rhead->args.readdir.frag); |
1211 | struct ceph_dentry_info *di; | 1244 | struct ceph_dentry_info *di; |
1212 | 1245 | ||
1246 | if (req->r_aborted) | ||
1247 | return readdir_prepopulate_inodes_only(req, session); | ||
1248 | |||
1213 | if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) { | 1249 | if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) { |
1214 | snapdir = ceph_get_snapdir(parent->d_inode); | 1250 | snapdir = ceph_get_snapdir(parent->d_inode); |
1215 | parent = d_find_alias(snapdir); | 1251 | parent = d_find_alias(snapdir); |
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index 36549a46e311..f5ed767806df 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c | |||
@@ -16,11 +16,11 @@ | |||
16 | */ | 16 | */ |
17 | static long ceph_ioctl_get_layout(struct file *file, void __user *arg) | 17 | static long ceph_ioctl_get_layout(struct file *file, void __user *arg) |
18 | { | 18 | { |
19 | struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode); | 19 | struct ceph_inode_info *ci = ceph_inode(file_inode(file)); |
20 | struct ceph_ioctl_layout l; | 20 | struct ceph_ioctl_layout l; |
21 | int err; | 21 | int err; |
22 | 22 | ||
23 | err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT); | 23 | err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT); |
24 | if (!err) { | 24 | if (!err) { |
25 | l.stripe_unit = ceph_file_layout_su(ci->i_layout); | 25 | l.stripe_unit = ceph_file_layout_su(ci->i_layout); |
26 | l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout); | 26 | l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout); |
@@ -63,12 +63,12 @@ static long __validate_layout(struct ceph_mds_client *mdsc, | |||
63 | 63 | ||
64 | static long ceph_ioctl_set_layout(struct file *file, void __user *arg) | 64 | static long ceph_ioctl_set_layout(struct file *file, void __user *arg) |
65 | { | 65 | { |
66 | struct inode *inode = file->f_dentry->d_inode; | 66 | struct inode *inode = file_inode(file); |
67 | struct inode *parent_inode; | 67 | struct inode *parent_inode; |
68 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; | 68 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; |
69 | struct ceph_mds_request *req; | 69 | struct ceph_mds_request *req; |
70 | struct ceph_ioctl_layout l; | 70 | struct ceph_ioctl_layout l; |
71 | struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode); | 71 | struct ceph_inode_info *ci = ceph_inode(file_inode(file)); |
72 | struct ceph_ioctl_layout nl; | 72 | struct ceph_ioctl_layout nl; |
73 | int err; | 73 | int err; |
74 | 74 | ||
@@ -76,7 +76,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) | |||
76 | return -EFAULT; | 76 | return -EFAULT; |
77 | 77 | ||
78 | /* validate changed params against current layout */ | 78 | /* validate changed params against current layout */ |
79 | err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT); | 79 | err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT); |
80 | if (err) | 80 | if (err) |
81 | return err; | 81 | return err; |
82 | 82 | ||
@@ -136,7 +136,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) | |||
136 | */ | 136 | */ |
137 | static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg) | 137 | static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg) |
138 | { | 138 | { |
139 | struct inode *inode = file->f_dentry->d_inode; | 139 | struct inode *inode = file_inode(file); |
140 | struct ceph_mds_request *req; | 140 | struct ceph_mds_request *req; |
141 | struct ceph_ioctl_layout l; | 141 | struct ceph_ioctl_layout l; |
142 | int err; | 142 | int err; |
@@ -179,7 +179,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg) | |||
179 | static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) | 179 | static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) |
180 | { | 180 | { |
181 | struct ceph_ioctl_dataloc dl; | 181 | struct ceph_ioctl_dataloc dl; |
182 | struct inode *inode = file->f_dentry->d_inode; | 182 | struct inode *inode = file_inode(file); |
183 | struct ceph_inode_info *ci = ceph_inode(inode); | 183 | struct ceph_inode_info *ci = ceph_inode(inode); |
184 | struct ceph_osd_client *osdc = | 184 | struct ceph_osd_client *osdc = |
185 | &ceph_sb_to_client(inode->i_sb)->client->osdc; | 185 | &ceph_sb_to_client(inode->i_sb)->client->osdc; |
@@ -234,7 +234,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) | |||
234 | static long ceph_ioctl_lazyio(struct file *file) | 234 | static long ceph_ioctl_lazyio(struct file *file) |
235 | { | 235 | { |
236 | struct ceph_file_info *fi = file->private_data; | 236 | struct ceph_file_info *fi = file->private_data; |
237 | struct inode *inode = file->f_dentry->d_inode; | 237 | struct inode *inode = file_inode(file); |
238 | struct ceph_inode_info *ci = ceph_inode(inode); | 238 | struct ceph_inode_info *ci = ceph_inode(inode); |
239 | 239 | ||
240 | if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { | 240 | if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { |
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index 80576d05d687..202dd3d68be0 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c | |||
@@ -13,7 +13,7 @@ | |||
13 | static int ceph_lock_message(u8 lock_type, u16 operation, struct file *file, | 13 | static int ceph_lock_message(u8 lock_type, u16 operation, struct file *file, |
14 | int cmd, u8 wait, struct file_lock *fl) | 14 | int cmd, u8 wait, struct file_lock *fl) |
15 | { | 15 | { |
16 | struct inode *inode = file->f_dentry->d_inode; | 16 | struct inode *inode = file_inode(file); |
17 | struct ceph_mds_client *mdsc = | 17 | struct ceph_mds_client *mdsc = |
18 | ceph_sb_to_client(inode->i_sb)->mdsc; | 18 | ceph_sb_to_client(inode->i_sb)->mdsc; |
19 | struct ceph_mds_request *req; | 19 | struct ceph_mds_request *req; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9be09b21b4e0..4bad7b16271f 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -683,7 +683,7 @@ out_nls: | |||
683 | static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | 683 | static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
684 | unsigned long nr_segs, loff_t pos) | 684 | unsigned long nr_segs, loff_t pos) |
685 | { | 685 | { |
686 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; | 686 | struct inode *inode = file_inode(iocb->ki_filp); |
687 | ssize_t written; | 687 | ssize_t written; |
688 | int rc; | 688 | int rc; |
689 | 689 | ||
@@ -707,7 +707,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int whence) | |||
707 | */ | 707 | */ |
708 | if (whence != SEEK_SET && whence != SEEK_CUR) { | 708 | if (whence != SEEK_SET && whence != SEEK_CUR) { |
709 | int rc; | 709 | int rc; |
710 | struct inode *inode = file->f_path.dentry->d_inode; | 710 | struct inode *inode = file_inode(file); |
711 | 711 | ||
712 | /* | 712 | /* |
713 | * We need to be sure that all dirty pages are written and the | 713 | * We need to be sure that all dirty pages are written and the |
@@ -739,7 +739,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) | |||
739 | { | 739 | { |
740 | /* note that this is called by vfs setlease with lock_flocks held | 740 | /* note that this is called by vfs setlease with lock_flocks held |
741 | to protect *lease from going away */ | 741 | to protect *lease from going away */ |
742 | struct inode *inode = file->f_path.dentry->d_inode; | 742 | struct inode *inode = file_inode(file); |
743 | struct cifsFileInfo *cfile = file->private_data; | 743 | struct cifsFileInfo *cfile = file->private_data; |
744 | 744 | ||
745 | if (!(S_ISREG(inode->i_mode))) | 745 | if (!(S_ISREG(inode->i_mode))) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index a8d8b589ee0e..c16d2a018ab8 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -947,7 +947,7 @@ static int | |||
947 | cifs_posix_lock_test(struct file *file, struct file_lock *flock) | 947 | cifs_posix_lock_test(struct file *file, struct file_lock *flock) |
948 | { | 948 | { |
949 | int rc = 0; | 949 | int rc = 0; |
950 | struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode); | 950 | struct cifsInodeInfo *cinode = CIFS_I(file_inode(file)); |
951 | unsigned char saved_type = flock->fl_type; | 951 | unsigned char saved_type = flock->fl_type; |
952 | 952 | ||
953 | if ((flock->fl_flags & FL_POSIX) == 0) | 953 | if ((flock->fl_flags & FL_POSIX) == 0) |
@@ -974,7 +974,7 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock) | |||
974 | static int | 974 | static int |
975 | cifs_posix_lock_set(struct file *file, struct file_lock *flock) | 975 | cifs_posix_lock_set(struct file *file, struct file_lock *flock) |
976 | { | 976 | { |
977 | struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode); | 977 | struct cifsInodeInfo *cinode = CIFS_I(file_inode(file)); |
978 | int rc = 1; | 978 | int rc = 1; |
979 | 979 | ||
980 | if ((flock->fl_flags & FL_POSIX) == 0) | 980 | if ((flock->fl_flags & FL_POSIX) == 0) |
@@ -1548,7 +1548,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock) | |||
1548 | 1548 | ||
1549 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 1549 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
1550 | netfid = cfile->fid.netfid; | 1550 | netfid = cfile->fid.netfid; |
1551 | cinode = CIFS_I(file->f_path.dentry->d_inode); | 1551 | cinode = CIFS_I(file_inode(file)); |
1552 | 1552 | ||
1553 | if (cap_unix(tcon->ses) && | 1553 | if (cap_unix(tcon->ses) && |
1554 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) && | 1554 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) && |
@@ -2171,7 +2171,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end, | |||
2171 | struct cifs_tcon *tcon; | 2171 | struct cifs_tcon *tcon; |
2172 | struct TCP_Server_Info *server; | 2172 | struct TCP_Server_Info *server; |
2173 | struct cifsFileInfo *smbfile = file->private_data; | 2173 | struct cifsFileInfo *smbfile = file->private_data; |
2174 | struct inode *inode = file->f_path.dentry->d_inode; | 2174 | struct inode *inode = file_inode(file); |
2175 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2175 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
2176 | 2176 | ||
2177 | rc = filemap_write_and_wait_range(inode->i_mapping, start, end); | 2177 | rc = filemap_write_and_wait_range(inode->i_mapping, start, end); |
@@ -2246,7 +2246,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
2246 | */ | 2246 | */ |
2247 | int cifs_flush(struct file *file, fl_owner_t id) | 2247 | int cifs_flush(struct file *file, fl_owner_t id) |
2248 | { | 2248 | { |
2249 | struct inode *inode = file->f_path.dentry->d_inode; | 2249 | struct inode *inode = file_inode(file); |
2250 | int rc = 0; | 2250 | int rc = 0; |
2251 | 2251 | ||
2252 | if (file->f_mode & FMODE_WRITE) | 2252 | if (file->f_mode & FMODE_WRITE) |
@@ -2480,7 +2480,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2480 | ssize_t written; | 2480 | ssize_t written; |
2481 | struct inode *inode; | 2481 | struct inode *inode; |
2482 | 2482 | ||
2483 | inode = iocb->ki_filp->f_path.dentry->d_inode; | 2483 | inode = file_inode(iocb->ki_filp); |
2484 | 2484 | ||
2485 | /* | 2485 | /* |
2486 | * BB - optimize the way when signing is disabled. We can drop this | 2486 | * BB - optimize the way when signing is disabled. We can drop this |
@@ -2543,7 +2543,7 @@ ssize_t | |||
2543 | cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov, | 2543 | cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov, |
2544 | unsigned long nr_segs, loff_t pos) | 2544 | unsigned long nr_segs, loff_t pos) |
2545 | { | 2545 | { |
2546 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; | 2546 | struct inode *inode = file_inode(iocb->ki_filp); |
2547 | struct cifsInodeInfo *cinode = CIFS_I(inode); | 2547 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
2548 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2548 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
2549 | struct cifsFileInfo *cfile = (struct cifsFileInfo *) | 2549 | struct cifsFileInfo *cfile = (struct cifsFileInfo *) |
@@ -2915,7 +2915,7 @@ ssize_t | |||
2915 | cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov, | 2915 | cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov, |
2916 | unsigned long nr_segs, loff_t pos) | 2916 | unsigned long nr_segs, loff_t pos) |
2917 | { | 2917 | { |
2918 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; | 2918 | struct inode *inode = file_inode(iocb->ki_filp); |
2919 | struct cifsInodeInfo *cinode = CIFS_I(inode); | 2919 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
2920 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2920 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
2921 | struct cifsFileInfo *cfile = (struct cifsFileInfo *) | 2921 | struct cifsFileInfo *cfile = (struct cifsFileInfo *) |
@@ -3063,7 +3063,7 @@ static struct vm_operations_struct cifs_file_vm_ops = { | |||
3063 | int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma) | 3063 | int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma) |
3064 | { | 3064 | { |
3065 | int rc, xid; | 3065 | int rc, xid; |
3066 | struct inode *inode = file->f_path.dentry->d_inode; | 3066 | struct inode *inode = file_inode(file); |
3067 | 3067 | ||
3068 | xid = get_xid(); | 3068 | xid = get_xid(); |
3069 | 3069 | ||
@@ -3356,7 +3356,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page, | |||
3356 | int rc; | 3356 | int rc; |
3357 | 3357 | ||
3358 | /* Is the page cached? */ | 3358 | /* Is the page cached? */ |
3359 | rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page); | 3359 | rc = cifs_readpage_from_fscache(file_inode(file), page); |
3360 | if (rc == 0) | 3360 | if (rc == 0) |
3361 | goto read_complete; | 3361 | goto read_complete; |
3362 | 3362 | ||
@@ -3371,8 +3371,8 @@ static int cifs_readpage_worker(struct file *file, struct page *page, | |||
3371 | else | 3371 | else |
3372 | cFYI(1, "Bytes read %d", rc); | 3372 | cFYI(1, "Bytes read %d", rc); |
3373 | 3373 | ||
3374 | file->f_path.dentry->d_inode->i_atime = | 3374 | file_inode(file)->i_atime = |
3375 | current_fs_time(file->f_path.dentry->d_inode->i_sb); | 3375 | current_fs_time(file_inode(file)->i_sb); |
3376 | 3376 | ||
3377 | if (PAGE_CACHE_SIZE > rc) | 3377 | if (PAGE_CACHE_SIZE > rc) |
3378 | memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc); | 3378 | memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc); |
@@ -3381,7 +3381,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page, | |||
3381 | SetPageUptodate(page); | 3381 | SetPageUptodate(page); |
3382 | 3382 | ||
3383 | /* send this page to the cache */ | 3383 | /* send this page to the cache */ |
3384 | cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page); | 3384 | cifs_readpage_to_fscache(file_inode(file), page); |
3385 | 3385 | ||
3386 | rc = 0; | 3386 | rc = 0; |
3387 | 3387 | ||
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 9638233964fc..d2a833999bcc 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -299,7 +299,7 @@ cifs_get_file_info_unix(struct file *filp) | |||
299 | unsigned int xid; | 299 | unsigned int xid; |
300 | FILE_UNIX_BASIC_INFO find_data; | 300 | FILE_UNIX_BASIC_INFO find_data; |
301 | struct cifs_fattr fattr; | 301 | struct cifs_fattr fattr; |
302 | struct inode *inode = filp->f_path.dentry->d_inode; | 302 | struct inode *inode = file_inode(filp); |
303 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 303 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
304 | struct cifsFileInfo *cfile = filp->private_data; | 304 | struct cifsFileInfo *cfile = filp->private_data; |
305 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 305 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
@@ -568,7 +568,7 @@ cifs_get_file_info(struct file *filp) | |||
568 | unsigned int xid; | 568 | unsigned int xid; |
569 | FILE_ALL_INFO find_data; | 569 | FILE_ALL_INFO find_data; |
570 | struct cifs_fattr fattr; | 570 | struct cifs_fattr fattr; |
571 | struct inode *inode = filp->f_path.dentry->d_inode; | 571 | struct inode *inode = file_inode(filp); |
572 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 572 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
573 | struct cifsFileInfo *cfile = filp->private_data; | 573 | struct cifsFileInfo *cfile = filp->private_data; |
574 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 574 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
@@ -1688,7 +1688,7 @@ cifs_invalidate_mapping(struct inode *inode) | |||
1688 | int cifs_revalidate_file_attr(struct file *filp) | 1688 | int cifs_revalidate_file_attr(struct file *filp) |
1689 | { | 1689 | { |
1690 | int rc = 0; | 1690 | int rc = 0; |
1691 | struct inode *inode = filp->f_path.dentry->d_inode; | 1691 | struct inode *inode = file_inode(filp); |
1692 | struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data; | 1692 | struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data; |
1693 | 1693 | ||
1694 | if (!cifs_inode_needs_reval(inode)) | 1694 | if (!cifs_inode_needs_reval(inode)) |
@@ -1745,7 +1745,7 @@ out: | |||
1745 | int cifs_revalidate_file(struct file *filp) | 1745 | int cifs_revalidate_file(struct file *filp) |
1746 | { | 1746 | { |
1747 | int rc; | 1747 | int rc; |
1748 | struct inode *inode = filp->f_path.dentry->d_inode; | 1748 | struct inode *inode = file_inode(filp); |
1749 | 1749 | ||
1750 | rc = cifs_revalidate_file_attr(filp); | 1750 | rc = cifs_revalidate_file_attr(filp); |
1751 | if (rc) | 1751 | if (rc) |
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index fd5009d56f9f..6c9f1214cf0b 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) | 31 | long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) |
32 | { | 32 | { |
33 | struct inode *inode = filep->f_dentry->d_inode; | 33 | struct inode *inode = file_inode(filep); |
34 | int rc = -ENOTTY; /* strange error - but the precedent */ | 34 | int rc = -ENOTTY; /* strange error - but the precedent */ |
35 | unsigned int xid; | 35 | unsigned int xid; |
36 | struct cifs_sb_info *cifs_sb; | 36 | struct cifs_sb_info *cifs_sb; |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index cdd6ff48246b..df40cc5fd13a 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -82,12 +82,10 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
82 | 82 | ||
83 | cFYI(1, "%s: for %s", __func__, name->name); | 83 | cFYI(1, "%s: for %s", __func__, name->name); |
84 | 84 | ||
85 | if (parent->d_op && parent->d_op->d_hash) | 85 | dentry = d_hash_and_lookup(parent, name); |
86 | parent->d_op->d_hash(parent, parent->d_inode, name); | 86 | if (unlikely(IS_ERR(dentry))) |
87 | else | 87 | return; |
88 | name->hash = full_name_hash(name->name, name->len); | ||
89 | 88 | ||
90 | dentry = d_lookup(parent, name); | ||
91 | if (dentry) { | 89 | if (dentry) { |
92 | int err; | 90 | int err; |
93 | 91 | ||
@@ -505,7 +503,7 @@ static int cifs_entry_is_dot(struct cifs_dirent *de, bool is_unicode) | |||
505 | whether we can use the cached search results from the previous search */ | 503 | whether we can use the cached search results from the previous search */ |
506 | static int is_dir_changed(struct file *file) | 504 | static int is_dir_changed(struct file *file) |
507 | { | 505 | { |
508 | struct inode *inode = file->f_path.dentry->d_inode; | 506 | struct inode *inode = file_inode(file); |
509 | struct cifsInodeInfo *cifsInfo = CIFS_I(inode); | 507 | struct cifsInodeInfo *cifsInfo = CIFS_I(inode); |
510 | 508 | ||
511 | if (cifsInfo->time == 0) | 509 | if (cifsInfo->time == 0) |
@@ -778,7 +776,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
778 | switch ((int) file->f_pos) { | 776 | switch ((int) file->f_pos) { |
779 | case 0: | 777 | case 0: |
780 | if (filldir(direntry, ".", 1, file->f_pos, | 778 | if (filldir(direntry, ".", 1, file->f_pos, |
781 | file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) { | 779 | file_inode(file)->i_ino, DT_DIR) < 0) { |
782 | cERROR(1, "Filldir for current dir failed"); | 780 | cERROR(1, "Filldir for current dir failed"); |
783 | rc = -ENOMEM; | 781 | rc = -ENOMEM; |
784 | break; | 782 | break; |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 49fe52d25600..b7d3a05c062c 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -397,7 +397,7 @@ static int coda_readdir(struct file *coda_file, void *buf, filldir_t filldir) | |||
397 | * We can't use vfs_readdir because we have to keep the file | 397 | * We can't use vfs_readdir because we have to keep the file |
398 | * position in sync between the coda_file and the host_file. | 398 | * position in sync between the coda_file and the host_file. |
399 | * and as such we need grab the inode mutex. */ | 399 | * and as such we need grab the inode mutex. */ |
400 | struct inode *host_inode = host_file->f_path.dentry->d_inode; | 400 | struct inode *host_inode = file_inode(host_file); |
401 | 401 | ||
402 | mutex_lock(&host_inode->i_mutex); | 402 | mutex_lock(&host_inode->i_mutex); |
403 | host_file->f_pos = coda_file->f_pos; | 403 | host_file->f_pos = coda_file->f_pos; |
diff --git a/fs/coda/file.c b/fs/coda/file.c index 8edd404e6419..fa4c100bdc7d 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -66,7 +66,7 @@ coda_file_splice_read(struct file *coda_file, loff_t *ppos, | |||
66 | static ssize_t | 66 | static ssize_t |
67 | coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos) | 67 | coda_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_path.dentry->d_inode; | 69 | struct inode *host_inode, *coda_inode = file_inode(coda_file); |
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_path.dentry->d_inode; | 81 | host_inode = file_inode(host_file); |
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_path.dentry->d_inode; | 109 | coda_inode = file_inode(coda_file); |
110 | host_inode = host_file->f_path.dentry->d_inode; | 110 | host_inode = file_inode(host_file); |
111 | 111 | ||
112 | cii = ITOC(coda_inode); | 112 | cii = ITOC(coda_inode); |
113 | spin_lock(&cii->c_lock); | 113 | spin_lock(&cii->c_lock); |
@@ -178,7 +178,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file) | |||
178 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), | 178 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), |
179 | coda_flags, coda_file->f_cred->fsuid); | 179 | coda_flags, coda_file->f_cred->fsuid); |
180 | 180 | ||
181 | host_inode = cfi->cfi_container->f_path.dentry->d_inode; | 181 | host_inode = file_inode(cfi->cfi_container); |
182 | cii = ITOC(coda_inode); | 182 | cii = ITOC(coda_inode); |
183 | 183 | ||
184 | /* did we mmap this file? */ | 184 | /* did we mmap this file? */ |
@@ -202,7 +202,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file) | |||
202 | int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync) | 202 | int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync) |
203 | { | 203 | { |
204 | struct file *host_file; | 204 | struct file *host_file; |
205 | struct inode *coda_inode = coda_file->f_path.dentry->d_inode; | 205 | struct inode *coda_inode = file_inode(coda_file); |
206 | struct coda_file_info *cfi; | 206 | struct coda_file_info *cfi; |
207 | int err; | 207 | int err; |
208 | 208 | ||
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index cf674e9179a3..dada9d0abede 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -130,7 +130,7 @@ static int get_device_index(struct coda_mount_data *data) | |||
130 | f = fdget(data->fd); | 130 | f = fdget(data->fd); |
131 | if (!f.file) | 131 | if (!f.file) |
132 | goto Ebadf; | 132 | goto Ebadf; |
133 | inode = f.file->f_path.dentry->d_inode; | 133 | inode = file_inode(f.file); |
134 | if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) { | 134 | if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) { |
135 | fdput(f); | 135 | fdput(f); |
136 | goto Ebadf; | 136 | goto Ebadf; |
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index ee0981f1375b..3f5de96bbb58 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c | |||
@@ -52,7 +52,7 @@ static long coda_pioctl(struct file *filp, unsigned int cmd, | |||
52 | struct path path; | 52 | struct path path; |
53 | int error; | 53 | int error; |
54 | struct PioctlData data; | 54 | struct PioctlData data; |
55 | struct inode *inode = filp->f_dentry->d_inode; | 55 | struct inode *inode = file_inode(filp); |
56 | struct inode *target_inode = NULL; | 56 | struct inode *target_inode = NULL; |
57 | struct coda_inode_info *cnp; | 57 | struct coda_inode_info *cnp; |
58 | 58 | ||
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index e2f57a007029..3ced75f765ca 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1582,7 +1582,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | |||
1582 | case FIBMAP: | 1582 | case FIBMAP: |
1583 | case FIGETBSZ: | 1583 | case FIGETBSZ: |
1584 | case FIONREAD: | 1584 | case FIONREAD: |
1585 | if (S_ISREG(f.file->f_path.dentry->d_inode->i_mode)) | 1585 | if (S_ISREG(file_inode(f.file)->i_mode)) |
1586 | break; | 1586 | break; |
1587 | /*FALL THROUGH*/ | 1587 | /*FALL THROUGH*/ |
1588 | 1588 | ||
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index e9dcfa3c208c..7aabc6ad4e9b 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -1626,7 +1626,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) | |||
1626 | if (offset >= 0) | 1626 | if (offset >= 0) |
1627 | break; | 1627 | break; |
1628 | default: | 1628 | default: |
1629 | mutex_unlock(&file->f_path.dentry->d_inode->i_mutex); | 1629 | mutex_unlock(&file_inode(file)->i_mutex); |
1630 | return -EINVAL; | 1630 | return -EINVAL; |
1631 | } | 1631 | } |
1632 | if (offset != file->f_pos) { | 1632 | if (offset != file->f_pos) { |
diff --git a/fs/coredump.c b/fs/coredump.c index 177493272a61..69baf903d3bd 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -411,7 +411,7 @@ static void wait_for_dump_helpers(struct file *file) | |||
411 | { | 411 | { |
412 | struct pipe_inode_info *pipe; | 412 | struct pipe_inode_info *pipe; |
413 | 413 | ||
414 | pipe = file->f_path.dentry->d_inode->i_pipe; | 414 | pipe = file_inode(file)->i_pipe; |
415 | 415 | ||
416 | pipe_lock(pipe); | 416 | pipe_lock(pipe); |
417 | pipe->readers++; | 417 | pipe->readers++; |
@@ -600,7 +600,7 @@ void do_coredump(siginfo_t *siginfo) | |||
600 | if (IS_ERR(cprm.file)) | 600 | if (IS_ERR(cprm.file)) |
601 | goto fail_unlock; | 601 | goto fail_unlock; |
602 | 602 | ||
603 | inode = cprm.file->f_path.dentry->d_inode; | 603 | inode = file_inode(cprm.file); |
604 | if (inode->i_nlink > 1) | 604 | if (inode->i_nlink > 1) |
605 | goto close_fail; | 605 | goto close_fail; |
606 | if (d_unhashed(cprm.file->f_path.dentry)) | 606 | if (d_unhashed(cprm.file->f_path.dentry)) |
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index c6c3f91ecf06..3ceb9ec976e1 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c | |||
@@ -351,7 +351,7 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
351 | */ | 351 | */ |
352 | static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 352 | static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
353 | { | 353 | { |
354 | struct inode *inode = filp->f_path.dentry->d_inode; | 354 | struct inode *inode = file_inode(filp); |
355 | struct super_block *sb = inode->i_sb; | 355 | struct super_block *sb = inode->i_sb; |
356 | char *buf; | 356 | char *buf; |
357 | unsigned int offset; | 357 | unsigned int offset; |
diff --git a/fs/dcache.c b/fs/dcache.c index 19153a0a810c..68220dd0c135 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1358,6 +1358,7 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) | |||
1358 | WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | | 1358 | WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | |
1359 | DCACHE_OP_COMPARE | | 1359 | DCACHE_OP_COMPARE | |
1360 | DCACHE_OP_REVALIDATE | | 1360 | DCACHE_OP_REVALIDATE | |
1361 | DCACHE_OP_WEAK_REVALIDATE | | ||
1361 | DCACHE_OP_DELETE )); | 1362 | DCACHE_OP_DELETE )); |
1362 | dentry->d_op = op; | 1363 | dentry->d_op = op; |
1363 | if (!op) | 1364 | if (!op) |
@@ -1368,6 +1369,8 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) | |||
1368 | dentry->d_flags |= DCACHE_OP_COMPARE; | 1369 | dentry->d_flags |= DCACHE_OP_COMPARE; |
1369 | if (op->d_revalidate) | 1370 | if (op->d_revalidate) |
1370 | dentry->d_flags |= DCACHE_OP_REVALIDATE; | 1371 | dentry->d_flags |= DCACHE_OP_REVALIDATE; |
1372 | if (op->d_weak_revalidate) | ||
1373 | dentry->d_flags |= DCACHE_OP_WEAK_REVALIDATE; | ||
1371 | if (op->d_delete) | 1374 | if (op->d_delete) |
1372 | dentry->d_flags |= DCACHE_OP_DELETE; | 1375 | dentry->d_flags |= DCACHE_OP_DELETE; |
1373 | if (op->d_prune) | 1376 | if (op->d_prune) |
@@ -1672,7 +1675,6 @@ EXPORT_SYMBOL(d_splice_alias); | |||
1672 | struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, | 1675 | struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, |
1673 | struct qstr *name) | 1676 | struct qstr *name) |
1674 | { | 1677 | { |
1675 | int error; | ||
1676 | struct dentry *found; | 1678 | struct dentry *found; |
1677 | struct dentry *new; | 1679 | struct dentry *new; |
1678 | 1680 | ||
@@ -1681,10 +1683,12 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, | |||
1681 | * if not go ahead and create it now. | 1683 | * if not go ahead and create it now. |
1682 | */ | 1684 | */ |
1683 | found = d_hash_and_lookup(dentry->d_parent, name); | 1685 | found = d_hash_and_lookup(dentry->d_parent, name); |
1686 | if (unlikely(IS_ERR(found))) | ||
1687 | goto err_out; | ||
1684 | if (!found) { | 1688 | if (!found) { |
1685 | new = d_alloc(dentry->d_parent, name); | 1689 | new = d_alloc(dentry->d_parent, name); |
1686 | if (!new) { | 1690 | if (!new) { |
1687 | error = -ENOMEM; | 1691 | found = ERR_PTR(-ENOMEM); |
1688 | goto err_out; | 1692 | goto err_out; |
1689 | } | 1693 | } |
1690 | 1694 | ||
@@ -1725,7 +1729,7 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, | |||
1725 | 1729 | ||
1726 | err_out: | 1730 | err_out: |
1727 | iput(inode); | 1731 | iput(inode); |
1728 | return ERR_PTR(error); | 1732 | return found; |
1729 | } | 1733 | } |
1730 | EXPORT_SYMBOL(d_add_ci); | 1734 | EXPORT_SYMBOL(d_add_ci); |
1731 | 1735 | ||
@@ -1889,7 +1893,7 @@ seqretry: | |||
1889 | * dentry is returned. The caller must use dput to free the entry when it has | 1893 | * dentry is returned. The caller must use dput to free the entry when it has |
1890 | * finished using it. %NULL is returned if the dentry does not exist. | 1894 | * finished using it. %NULL is returned if the dentry does not exist. |
1891 | */ | 1895 | */ |
1892 | struct dentry *d_lookup(struct dentry *parent, struct qstr *name) | 1896 | struct dentry *d_lookup(const struct dentry *parent, const struct qstr *name) |
1893 | { | 1897 | { |
1894 | struct dentry *dentry; | 1898 | struct dentry *dentry; |
1895 | unsigned seq; | 1899 | unsigned seq; |
@@ -1919,7 +1923,7 @@ EXPORT_SYMBOL(d_lookup); | |||
1919 | * | 1923 | * |
1920 | * __d_lookup callers must be commented. | 1924 | * __d_lookup callers must be commented. |
1921 | */ | 1925 | */ |
1922 | struct dentry *__d_lookup(struct dentry *parent, struct qstr *name) | 1926 | struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name) |
1923 | { | 1927 | { |
1924 | unsigned int len = name->len; | 1928 | unsigned int len = name->len; |
1925 | unsigned int hash = name->hash; | 1929 | unsigned int hash = name->hash; |
@@ -1997,12 +2001,10 @@ next: | |||
1997 | * @dir: Directory to search in | 2001 | * @dir: Directory to search in |
1998 | * @name: qstr of name we wish to find | 2002 | * @name: qstr of name we wish to find |
1999 | * | 2003 | * |
2000 | * On hash failure or on lookup failure NULL is returned. | 2004 | * On lookup failure NULL is returned; on bad name - ERR_PTR(-error) |
2001 | */ | 2005 | */ |
2002 | struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name) | 2006 | struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name) |
2003 | { | 2007 | { |
2004 | struct dentry *dentry = NULL; | ||
2005 | |||
2006 | /* | 2008 | /* |
2007 | * Check for a fs-specific hash function. Note that we must | 2009 | * Check for a fs-specific hash function. Note that we must |
2008 | * calculate the standard hash first, as the d_op->d_hash() | 2010 | * calculate the standard hash first, as the d_op->d_hash() |
@@ -2010,13 +2012,13 @@ struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name) | |||
2010 | */ | 2012 | */ |
2011 | name->hash = full_name_hash(name->name, name->len); | 2013 | name->hash = full_name_hash(name->name, name->len); |
2012 | if (dir->d_flags & DCACHE_OP_HASH) { | 2014 | if (dir->d_flags & DCACHE_OP_HASH) { |
2013 | if (dir->d_op->d_hash(dir, dir->d_inode, name) < 0) | 2015 | int err = dir->d_op->d_hash(dir, dir->d_inode, name); |
2014 | goto out; | 2016 | if (unlikely(err < 0)) |
2017 | return ERR_PTR(err); | ||
2015 | } | 2018 | } |
2016 | dentry = d_lookup(dir, name); | 2019 | return d_lookup(dir, name); |
2017 | out: | ||
2018 | return dentry; | ||
2019 | } | 2020 | } |
2021 | EXPORT_SYMBOL(d_hash_and_lookup); | ||
2020 | 2022 | ||
2021 | /** | 2023 | /** |
2022 | * d_validate - verify dentry provided from insecure source (deprecated) | 2024 | * d_validate - verify dentry provided from insecure source (deprecated) |
@@ -2394,7 +2396,7 @@ out_err: | |||
2394 | */ | 2396 | */ |
2395 | static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | 2397 | static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) |
2396 | { | 2398 | { |
2397 | struct dentry *dparent, *aparent; | 2399 | struct dentry *dparent; |
2398 | 2400 | ||
2399 | dentry_lock_for_move(anon, dentry); | 2401 | dentry_lock_for_move(anon, dentry); |
2400 | 2402 | ||
@@ -2402,24 +2404,15 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | |||
2402 | write_seqcount_begin(&anon->d_seq); | 2404 | write_seqcount_begin(&anon->d_seq); |
2403 | 2405 | ||
2404 | dparent = dentry->d_parent; | 2406 | dparent = dentry->d_parent; |
2405 | aparent = anon->d_parent; | ||
2406 | 2407 | ||
2407 | switch_names(dentry, anon); | 2408 | switch_names(dentry, anon); |
2408 | swap(dentry->d_name.hash, anon->d_name.hash); | 2409 | swap(dentry->d_name.hash, anon->d_name.hash); |
2409 | 2410 | ||
2410 | dentry->d_parent = (aparent == anon) ? dentry : aparent; | 2411 | dentry->d_parent = dentry; |
2411 | list_del(&dentry->d_u.d_child); | 2412 | list_del_init(&dentry->d_u.d_child); |
2412 | if (!IS_ROOT(dentry)) | 2413 | anon->d_parent = dparent; |
2413 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2414 | else | ||
2415 | INIT_LIST_HEAD(&dentry->d_u.d_child); | ||
2416 | |||
2417 | anon->d_parent = (dparent == dentry) ? anon : dparent; | ||
2418 | list_del(&anon->d_u.d_child); | 2414 | list_del(&anon->d_u.d_child); |
2419 | if (!IS_ROOT(anon)) | 2415 | list_add(&anon->d_u.d_child, &dparent->d_subdirs); |
2420 | list_add(&anon->d_u.d_child, &anon->d_parent->d_subdirs); | ||
2421 | else | ||
2422 | INIT_LIST_HEAD(&anon->d_u.d_child); | ||
2423 | 2416 | ||
2424 | write_seqcount_end(&dentry->d_seq); | 2417 | write_seqcount_end(&dentry->d_seq); |
2425 | write_seqcount_end(&anon->d_seq); | 2418 | write_seqcount_end(&anon->d_seq); |
@@ -2722,37 +2715,6 @@ char *d_path(const struct path *path, char *buf, int buflen) | |||
2722 | } | 2715 | } |
2723 | EXPORT_SYMBOL(d_path); | 2716 | EXPORT_SYMBOL(d_path); |
2724 | 2717 | ||
2725 | /** | ||
2726 | * d_path_with_unreachable - return the path of a dentry | ||
2727 | * @path: path to report | ||
2728 | * @buf: buffer to return value in | ||
2729 | * @buflen: buffer length | ||
2730 | * | ||
2731 | * The difference from d_path() is that this prepends "(unreachable)" | ||
2732 | * to paths which are unreachable from the current process' root. | ||
2733 | */ | ||
2734 | char *d_path_with_unreachable(const struct path *path, char *buf, int buflen) | ||
2735 | { | ||
2736 | char *res = buf + buflen; | ||
2737 | struct path root; | ||
2738 | int error; | ||
2739 | |||
2740 | if (path->dentry->d_op && path->dentry->d_op->d_dname) | ||
2741 | return path->dentry->d_op->d_dname(path->dentry, buf, buflen); | ||
2742 | |||
2743 | get_fs_root(current->fs, &root); | ||
2744 | write_seqlock(&rename_lock); | ||
2745 | error = path_with_deleted(path, &root, &res, &buflen); | ||
2746 | if (error > 0) | ||
2747 | error = prepend_unreachable(&res, &buflen); | ||
2748 | write_sequnlock(&rename_lock); | ||
2749 | path_put(&root); | ||
2750 | if (error) | ||
2751 | res = ERR_PTR(error); | ||
2752 | |||
2753 | return res; | ||
2754 | } | ||
2755 | |||
2756 | /* | 2718 | /* |
2757 | * Helper function for dentry_operations.d_dname() members | 2719 | * Helper function for dentry_operations.d_dname() members |
2758 | */ | 2720 | */ |
@@ -3035,7 +2997,7 @@ ino_t find_inode_number(struct dentry *dir, struct qstr *name) | |||
3035 | ino_t ino = 0; | 2997 | ino_t ino = 0; |
3036 | 2998 | ||
3037 | dentry = d_hash_and_lookup(dir, name); | 2999 | dentry = d_hash_and_lookup(dir, name); |
3038 | if (dentry) { | 3000 | if (!IS_ERR_OR_NULL(dentry)) { |
3039 | if (dentry->d_inode) | 3001 | if (dentry->d_inode) |
3040 | ino = dentry->d_inode->i_ino; | 3002 | ino = dentry->d_inode->i_ino; |
3041 | dput(dentry); | 3003 | dput(dentry); |
diff --git a/fs/direct-io.c b/fs/direct-io.c index cf5b44b10c67..f853263cf74f 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -261,9 +261,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is | |||
261 | dio->end_io(dio->iocb, offset, transferred, | 261 | dio->end_io(dio->iocb, offset, transferred, |
262 | dio->private, ret, is_async); | 262 | dio->private, ret, is_async); |
263 | } else { | 263 | } else { |
264 | inode_dio_done(dio->inode); | ||
264 | if (is_async) | 265 | if (is_async) |
265 | aio_complete(dio->iocb, ret, 0); | 266 | aio_complete(dio->iocb, ret, 0); |
266 | inode_dio_done(dio->inode); | ||
267 | } | 267 | } |
268 | 268 | ||
269 | return ret; | 269 | return ret; |
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index a0387dd8b1f0..7d58d5b112b5 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -158,7 +158,7 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field, | |||
158 | unsigned int x; | 158 | unsigned int x; |
159 | 159 | ||
160 | if (!capable(CAP_SYS_ADMIN)) | 160 | if (!capable(CAP_SYS_ADMIN)) |
161 | return -EACCES; | 161 | return -EPERM; |
162 | 162 | ||
163 | x = simple_strtoul(buf, NULL, 0); | 163 | x = simple_strtoul(buf, NULL, 0); |
164 | 164 | ||
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index cfb4b9fed520..7e2c6f5d7985 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -509,6 +509,12 @@ ecryptfs_dentry_to_lower_mnt(struct dentry *dentry) | |||
509 | return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt; | 509 | return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt; |
510 | } | 510 | } |
511 | 511 | ||
512 | static inline struct path * | ||
513 | ecryptfs_dentry_to_lower_path(struct dentry *dentry) | ||
514 | { | ||
515 | return &((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path; | ||
516 | } | ||
517 | |||
512 | static inline void | 518 | static inline void |
513 | ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt) | 519 | ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt) |
514 | { | 520 | { |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index d45ba4568128..53acc9d0c138 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -118,7 +118,7 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir) | |||
118 | 118 | ||
119 | lower_file = ecryptfs_file_to_lower(file); | 119 | lower_file = ecryptfs_file_to_lower(file); |
120 | lower_file->f_pos = file->f_pos; | 120 | lower_file->f_pos = file->f_pos; |
121 | inode = file->f_path.dentry->d_inode; | 121 | inode = file_inode(file); |
122 | memset(&buf, 0, sizeof(buf)); | 122 | memset(&buf, 0, sizeof(buf)); |
123 | buf.dirent = dirent; | 123 | buf.dirent = dirent; |
124 | buf.dentry = file->f_path.dentry; | 124 | buf.dentry = file->f_path.dentry; |
@@ -133,7 +133,7 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir) | |||
133 | goto out; | 133 | goto out; |
134 | if (rc >= 0) | 134 | if (rc >= 0) |
135 | fsstack_copy_attr_atime(inode, | 135 | fsstack_copy_attr_atime(inode, |
136 | lower_file->f_path.dentry->d_inode); | 136 | file_inode(lower_file)); |
137 | out: | 137 | out: |
138 | return rc; | 138 | return rc; |
139 | } | 139 | } |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index cc7709e7c508..e0f07fb6d56b 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -1027,8 +1027,7 @@ int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1027 | struct kstat lower_stat; | 1027 | struct kstat lower_stat; |
1028 | int rc; | 1028 | int rc; |
1029 | 1029 | ||
1030 | rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry), | 1030 | rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat); |
1031 | ecryptfs_dentry_to_lower(dentry), &lower_stat); | ||
1032 | if (!rc) { | 1031 | if (!rc) { |
1033 | fsstack_copy_attr_all(dentry->d_inode, | 1032 | fsstack_copy_attr_all(dentry->d_inode, |
1034 | ecryptfs_inode_to_lower(dentry->d_inode)); | 1033 | ecryptfs_inode_to_lower(dentry->d_inode)); |
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index b2a34a192f4f..6a160539cd23 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -40,16 +40,12 @@ int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, | |||
40 | loff_t offset, size_t size) | 40 | loff_t offset, size_t size) |
41 | { | 41 | { |
42 | struct file *lower_file; | 42 | struct file *lower_file; |
43 | mm_segment_t fs_save; | ||
44 | ssize_t rc; | 43 | ssize_t rc; |
45 | 44 | ||
46 | lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file; | 45 | lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file; |
47 | if (!lower_file) | 46 | if (!lower_file) |
48 | return -EIO; | 47 | return -EIO; |
49 | fs_save = get_fs(); | 48 | rc = kernel_write(lower_file, data, size, offset); |
50 | set_fs(get_ds()); | ||
51 | rc = vfs_write(lower_file, data, size, &offset); | ||
52 | set_fs(fs_save); | ||
53 | mark_inode_dirty_sync(ecryptfs_inode); | 49 | mark_inode_dirty_sync(ecryptfs_inode); |
54 | return rc; | 50 | return rc; |
55 | } | 51 | } |
diff --git a/fs/efs/dir.c b/fs/efs/dir.c index 7ee6f7e3a608..055a9e9ca747 100644 --- a/fs/efs/dir.c +++ b/fs/efs/dir.c | |||
@@ -20,7 +20,7 @@ const struct inode_operations efs_dir_inode_operations = { | |||
20 | }; | 20 | }; |
21 | 21 | ||
22 | static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { | 22 | static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { |
23 | struct inode *inode = filp->f_path.dentry->d_inode; | 23 | struct inode *inode = file_inode(filp); |
24 | struct buffer_head *bh; | 24 | struct buffer_head *bh; |
25 | 25 | ||
26 | struct efs_dir *dirblock; | 26 | struct efs_dir *dirblock; |
@@ -123,7 +123,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) | |||
123 | goto out; | 123 | goto out; |
124 | 124 | ||
125 | error = -EINVAL; | 125 | error = -EINVAL; |
126 | if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) | 126 | if (!S_ISREG(file_inode(file)->i_mode)) |
127 | goto exit; | 127 | goto exit; |
128 | 128 | ||
129 | error = -EACCES; | 129 | error = -EACCES; |
@@ -355,7 +355,7 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len) | |||
355 | * flags, permissions, and offset, so we use temporary values. We'll update | 355 | * flags, permissions, and offset, so we use temporary values. We'll update |
356 | * them later in setup_arg_pages(). | 356 | * them later in setup_arg_pages(). |
357 | */ | 357 | */ |
358 | int bprm_mm_init(struct linux_binprm *bprm) | 358 | static int bprm_mm_init(struct linux_binprm *bprm) |
359 | { | 359 | { |
360 | int err; | 360 | int err; |
361 | struct mm_struct *mm = NULL; | 361 | struct mm_struct *mm = NULL; |
@@ -764,7 +764,7 @@ struct file *open_exec(const char *name) | |||
764 | goto out; | 764 | goto out; |
765 | 765 | ||
766 | err = -EACCES; | 766 | err = -EACCES; |
767 | if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) | 767 | if (!S_ISREG(file_inode(file)->i_mode)) |
768 | goto exit; | 768 | goto exit; |
769 | 769 | ||
770 | if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) | 770 | if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) |
@@ -1098,7 +1098,7 @@ EXPORT_SYMBOL(flush_old_exec); | |||
1098 | 1098 | ||
1099 | void would_dump(struct linux_binprm *bprm, struct file *file) | 1099 | void would_dump(struct linux_binprm *bprm, struct file *file) |
1100 | { | 1100 | { |
1101 | if (inode_permission(file->f_path.dentry->d_inode, MAY_READ) < 0) | 1101 | if (inode_permission(file_inode(file), MAY_READ) < 0) |
1102 | bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP; | 1102 | bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP; |
1103 | } | 1103 | } |
1104 | EXPORT_SYMBOL(would_dump); | 1104 | EXPORT_SYMBOL(would_dump); |
@@ -1270,7 +1270,7 @@ static int check_unsafe_exec(struct linux_binprm *bprm) | |||
1270 | int prepare_binprm(struct linux_binprm *bprm) | 1270 | int prepare_binprm(struct linux_binprm *bprm) |
1271 | { | 1271 | { |
1272 | umode_t mode; | 1272 | umode_t mode; |
1273 | struct inode * inode = bprm->file->f_path.dentry->d_inode; | 1273 | struct inode * inode = file_inode(bprm->file); |
1274 | int retval; | 1274 | int retval; |
1275 | 1275 | ||
1276 | mode = inode->i_mode; | 1276 | mode = inode->i_mode; |
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index c61e62ac231c..46375896cfc0 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c | |||
@@ -242,7 +242,7 @@ static int | |||
242 | exofs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 242 | exofs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
243 | { | 243 | { |
244 | loff_t pos = filp->f_pos; | 244 | loff_t pos = filp->f_pos; |
245 | struct inode *inode = filp->f_path.dentry->d_inode; | 245 | struct inode *inode = file_inode(filp); |
246 | unsigned int offset = pos & ~PAGE_CACHE_MASK; | 246 | unsigned int offset = pos & ~PAGE_CACHE_MASK; |
247 | unsigned long n = pos >> PAGE_CACHE_SHIFT; | 247 | unsigned long n = pos >> PAGE_CACHE_SHIFT; |
248 | unsigned long npages = dir_pages(inode); | 248 | unsigned long npages = dir_pages(inode); |
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 0f4f5c929257..4237722bfd27 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
@@ -290,7 +290,7 @@ static int | |||
290 | ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) | 290 | ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) |
291 | { | 291 | { |
292 | loff_t pos = filp->f_pos; | 292 | loff_t pos = filp->f_pos; |
293 | struct inode *inode = filp->f_path.dentry->d_inode; | 293 | struct inode *inode = file_inode(filp); |
294 | struct super_block *sb = inode->i_sb; | 294 | struct super_block *sb = inode->i_sb; |
295 | unsigned int offset = pos & ~PAGE_CACHE_MASK; | 295 | unsigned int offset = pos & ~PAGE_CACHE_MASK; |
296 | unsigned long n = pos >> PAGE_CACHE_SHIFT; | 296 | unsigned long n = pos >> PAGE_CACHE_SHIFT; |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 2de655f5d625..5d46c09863f0 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 20 | long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
21 | { | 21 | { |
22 | struct inode *inode = filp->f_dentry->d_inode; | 22 | struct inode *inode = file_inode(filp); |
23 | struct ext2_inode_info *ei = EXT2_I(inode); | 23 | struct ext2_inode_info *ei = EXT2_I(inode); |
24 | unsigned int flags; | 24 | unsigned int flags; |
25 | unsigned short rsv_window_size; | 25 | unsigned short rsv_window_size; |
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index dd91264ba94f..87eccbbca255 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -99,7 +99,7 @@ static int ext3_readdir(struct file * filp, | |||
99 | int i, stored; | 99 | int i, stored; |
100 | struct ext3_dir_entry_2 *de; | 100 | struct ext3_dir_entry_2 *de; |
101 | int err; | 101 | int err; |
102 | struct inode *inode = filp->f_path.dentry->d_inode; | 102 | struct inode *inode = file_inode(filp); |
103 | struct super_block *sb = inode->i_sb; | 103 | struct super_block *sb = inode->i_sb; |
104 | int ret = 0; | 104 | int ret = 0; |
105 | int dir_has_error = 0; | 105 | int dir_has_error = 0; |
@@ -114,7 +114,7 @@ static int ext3_readdir(struct file * filp, | |||
114 | * We don't set the inode dirty flag since it's not | 114 | * We don't set the inode dirty flag since it's not |
115 | * critical that it get flushed back to the disk. | 115 | * critical that it get flushed back to the disk. |
116 | */ | 116 | */ |
117 | EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL; | 117 | EXT3_I(file_inode(filp))->i_flags &= ~EXT3_INDEX_FL; |
118 | } | 118 | } |
119 | stored = 0; | 119 | stored = 0; |
120 | offset = filp->f_pos & (sb->s_blocksize - 1); | 120 | offset = filp->f_pos & (sb->s_blocksize - 1); |
@@ -457,7 +457,7 @@ static int call_filldir(struct file * filp, void * dirent, | |||
457 | { | 457 | { |
458 | struct dir_private_info *info = filp->private_data; | 458 | struct dir_private_info *info = filp->private_data; |
459 | loff_t curr_pos; | 459 | loff_t curr_pos; |
460 | struct inode *inode = filp->f_path.dentry->d_inode; | 460 | struct inode *inode = file_inode(filp); |
461 | struct super_block * sb; | 461 | struct super_block * sb; |
462 | int error; | 462 | int error; |
463 | 463 | ||
@@ -487,7 +487,7 @@ static int ext3_dx_readdir(struct file * filp, | |||
487 | void * dirent, filldir_t filldir) | 487 | void * dirent, filldir_t filldir) |
488 | { | 488 | { |
489 | struct dir_private_info *info = filp->private_data; | 489 | struct dir_private_info *info = filp->private_data; |
490 | struct inode *inode = filp->f_path.dentry->d_inode; | 490 | struct inode *inode = file_inode(filp); |
491 | struct fname *fname; | 491 | struct fname *fname; |
492 | int ret; | 492 | int ret; |
493 | 493 | ||
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 677a5c27dc69..4d96e9a64532 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 15 | long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
16 | { | 16 | { |
17 | struct inode *inode = filp->f_dentry->d_inode; | 17 | struct inode *inode = file_inode(filp); |
18 | struct ext3_inode_info *ei = EXT3_I(inode); | 18 | struct ext3_inode_info *ei = EXT3_I(inode); |
19 | unsigned int flags; | 19 | unsigned int flags; |
20 | unsigned short rsv_window_size; | 20 | unsigned short rsv_window_size; |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 88f64eb1b6fa..692de13e3596 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -623,7 +623,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash, | |||
623 | 623 | ||
624 | dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash, | 624 | dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash, |
625 | start_minor_hash)); | 625 | start_minor_hash)); |
626 | dir = dir_file->f_path.dentry->d_inode; | 626 | dir = file_inode(dir_file); |
627 | if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { | 627 | if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { |
628 | hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; | 628 | hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; |
629 | if (hinfo.hash_version <= DX_HASH_TEA) | 629 | if (hinfo.hash_version <= DX_HASH_TEA) |
@@ -637,7 +637,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash, | |||
637 | } | 637 | } |
638 | hinfo.hash = start_hash; | 638 | hinfo.hash = start_hash; |
639 | hinfo.minor_hash = 0; | 639 | hinfo.minor_hash = 0; |
640 | frame = dx_probe(NULL, dir_file->f_path.dentry->d_inode, &hinfo, frames, &err); | 640 | frame = dx_probe(NULL, file_inode(dir_file), &hinfo, frames, &err); |
641 | if (!frame) | 641 | if (!frame) |
642 | return err; | 642 | return err; |
643 | 643 | ||
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 3882fbc5e215..6dda04f05ef4 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -110,7 +110,7 @@ static int ext4_readdir(struct file *filp, | |||
110 | int i, stored; | 110 | int i, stored; |
111 | struct ext4_dir_entry_2 *de; | 111 | struct ext4_dir_entry_2 *de; |
112 | int err; | 112 | int err; |
113 | struct inode *inode = filp->f_path.dentry->d_inode; | 113 | struct inode *inode = file_inode(filp); |
114 | struct super_block *sb = inode->i_sb; | 114 | struct super_block *sb = inode->i_sb; |
115 | int ret = 0; | 115 | int ret = 0; |
116 | int dir_has_error = 0; | 116 | int dir_has_error = 0; |
@@ -133,7 +133,7 @@ static int ext4_readdir(struct file *filp, | |||
133 | * We don't set the inode dirty flag since it's not | 133 | * We don't set the inode dirty flag since it's not |
134 | * critical that it get flushed back to the disk. | 134 | * critical that it get flushed back to the disk. |
135 | */ | 135 | */ |
136 | ext4_clear_inode_flag(filp->f_path.dentry->d_inode, | 136 | ext4_clear_inode_flag(file_inode(filp), |
137 | EXT4_INODE_INDEX); | 137 | EXT4_INODE_INDEX); |
138 | } | 138 | } |
139 | stored = 0; | 139 | stored = 0; |
@@ -495,7 +495,7 @@ static int call_filldir(struct file *filp, void *dirent, | |||
495 | { | 495 | { |
496 | struct dir_private_info *info = filp->private_data; | 496 | struct dir_private_info *info = filp->private_data; |
497 | loff_t curr_pos; | 497 | loff_t curr_pos; |
498 | struct inode *inode = filp->f_path.dentry->d_inode; | 498 | struct inode *inode = file_inode(filp); |
499 | struct super_block *sb; | 499 | struct super_block *sb; |
500 | int error; | 500 | int error; |
501 | 501 | ||
@@ -527,7 +527,7 @@ static int ext4_dx_readdir(struct file *filp, | |||
527 | void *dirent, filldir_t filldir) | 527 | void *dirent, filldir_t filldir) |
528 | { | 528 | { |
529 | struct dir_private_info *info = filp->private_data; | 529 | struct dir_private_info *info = filp->private_data; |
530 | struct inode *inode = filp->f_path.dentry->d_inode; | 530 | struct inode *inode = file_inode(filp); |
531 | struct fname *fname; | 531 | struct fname *fname; |
532 | int ret; | 532 | int ret; |
533 | 533 | ||
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 372b2cbee07e..28dd8eeea6a9 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4309,7 +4309,7 @@ static void ext4_falloc_update_inode(struct inode *inode, | |||
4309 | */ | 4309 | */ |
4310 | long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | 4310 | long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) |
4311 | { | 4311 | { |
4312 | struct inode *inode = file->f_path.dentry->d_inode; | 4312 | struct inode *inode = file_inode(file); |
4313 | handle_t *handle; | 4313 | handle_t *handle; |
4314 | loff_t new_size; | 4314 | loff_t new_size; |
4315 | unsigned int max_blocks; | 4315 | unsigned int max_blocks; |
@@ -4571,7 +4571,7 @@ static int ext4_xattr_fiemap(struct inode *inode, | |||
4571 | */ | 4571 | */ |
4572 | int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length) | 4572 | int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length) |
4573 | { | 4573 | { |
4574 | struct inode *inode = file->f_path.dentry->d_inode; | 4574 | struct inode *inode = file_inode(file); |
4575 | struct super_block *sb = inode->i_sb; | 4575 | struct super_block *sb = inode->i_sb; |
4576 | ext4_lblk_t first_block, stop_block; | 4576 | ext4_lblk_t first_block, stop_block; |
4577 | struct address_space *mapping = inode->i_mapping; | 4577 | struct address_space *mapping = inode->i_mapping; |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 7e85a10a6f4f..64848b595b24 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -167,7 +167,7 @@ static ssize_t | |||
167 | ext4_file_write(struct kiocb *iocb, const struct iovec *iov, | 167 | ext4_file_write(struct kiocb *iocb, const struct iovec *iov, |
168 | unsigned long nr_segs, loff_t pos) | 168 | unsigned long nr_segs, loff_t pos) |
169 | { | 169 | { |
170 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; | 170 | struct inode *inode = file_inode(iocb->ki_filp); |
171 | ssize_t ret; | 171 | ssize_t ret; |
172 | 172 | ||
173 | /* | 173 | /* |
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index bc5f871f0893..c0fd1a123f7d 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
@@ -1298,7 +1298,7 @@ int ext4_read_inline_dir(struct file *filp, | |||
1298 | int i, stored; | 1298 | int i, stored; |
1299 | struct ext4_dir_entry_2 *de; | 1299 | struct ext4_dir_entry_2 *de; |
1300 | struct super_block *sb; | 1300 | struct super_block *sb; |
1301 | struct inode *inode = filp->f_path.dentry->d_inode; | 1301 | struct inode *inode = file_inode(filp); |
1302 | int ret, inline_size = 0; | 1302 | int ret, inline_size = 0; |
1303 | struct ext4_iloc iloc; | 1303 | struct ext4_iloc iloc; |
1304 | void *dir_buf = NULL; | 1304 | void *dir_buf = NULL; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 88049d8d30cb..9c4f4b1c97f8 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2948,7 +2948,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, | |||
2948 | ssize_t size, void *private, int ret, | 2948 | ssize_t size, void *private, int ret, |
2949 | bool is_async) | 2949 | bool is_async) |
2950 | { | 2950 | { |
2951 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; | 2951 | struct inode *inode = file_inode(iocb->ki_filp); |
2952 | ext4_io_end_t *io_end = iocb->private; | 2952 | ext4_io_end_t *io_end = iocb->private; |
2953 | 2953 | ||
2954 | /* if not async direct IO or dio with 0 bytes write, just return */ | 2954 | /* if not async direct IO or dio with 0 bytes write, just return */ |
@@ -3483,7 +3483,7 @@ int ext4_can_truncate(struct inode *inode) | |||
3483 | 3483 | ||
3484 | int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) | 3484 | int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) |
3485 | { | 3485 | { |
3486 | struct inode *inode = file->f_path.dentry->d_inode; | 3486 | struct inode *inode = file_inode(file); |
3487 | if (!S_ISREG(inode->i_mode)) | 3487 | if (!S_ISREG(inode->i_mode)) |
3488 | return -EOPNOTSUPP; | 3488 | return -EOPNOTSUPP; |
3489 | 3489 | ||
@@ -4855,7 +4855,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
4855 | unsigned long len; | 4855 | unsigned long len; |
4856 | int ret; | 4856 | int ret; |
4857 | struct file *file = vma->vm_file; | 4857 | struct file *file = vma->vm_file; |
4858 | struct inode *inode = file->f_path.dentry->d_inode; | 4858 | struct inode *inode = file_inode(file); |
4859 | struct address_space *mapping = inode->i_mapping; | 4859 | struct address_space *mapping = inode->i_mapping; |
4860 | handle_t *handle; | 4860 | handle_t *handle; |
4861 | get_block_t *get_block; | 4861 | get_block_t *get_block; |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 31f4f56a32d6..721f4d33e148 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 23 | long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
24 | { | 24 | { |
25 | struct inode *inode = filp->f_dentry->d_inode; | 25 | struct inode *inode = file_inode(filp); |
26 | struct super_block *sb = inode->i_sb; | 26 | struct super_block *sb = inode->i_sb; |
27 | struct ext4_inode_info *ei = EXT4_I(inode); | 27 | struct ext4_inode_info *ei = EXT4_I(inode); |
28 | unsigned int flags; | 28 | unsigned int flags; |
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index d78c33eed7e5..4e81d47aa8cb 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -900,7 +900,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode, | |||
900 | pgoff_t orig_page_offset, int data_offset_in_page, | 900 | pgoff_t orig_page_offset, int data_offset_in_page, |
901 | int block_len_in_page, int uninit, int *err) | 901 | int block_len_in_page, int uninit, int *err) |
902 | { | 902 | { |
903 | struct inode *orig_inode = o_filp->f_dentry->d_inode; | 903 | struct inode *orig_inode = file_inode(o_filp); |
904 | struct page *pagep[2] = {NULL, NULL}; | 904 | struct page *pagep[2] = {NULL, NULL}; |
905 | handle_t *handle; | 905 | handle_t *handle; |
906 | ext4_lblk_t orig_blk_offset; | 906 | ext4_lblk_t orig_blk_offset; |
@@ -1279,8 +1279,8 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
1279 | __u64 orig_start, __u64 donor_start, __u64 len, | 1279 | __u64 orig_start, __u64 donor_start, __u64 len, |
1280 | __u64 *moved_len) | 1280 | __u64 *moved_len) |
1281 | { | 1281 | { |
1282 | struct inode *orig_inode = o_filp->f_dentry->d_inode; | 1282 | struct inode *orig_inode = file_inode(o_filp); |
1283 | struct inode *donor_inode = d_filp->f_dentry->d_inode; | 1283 | struct inode *donor_inode = file_inode(d_filp); |
1284 | struct ext4_ext_path *orig_path = NULL, *holecheck_path = NULL; | 1284 | struct ext4_ext_path *orig_path = NULL, *holecheck_path = NULL; |
1285 | struct ext4_extent *ext_prev, *ext_cur, *ext_dummy; | 1285 | struct ext4_extent *ext_prev, *ext_cur, *ext_dummy; |
1286 | ext4_lblk_t block_start = orig_start; | 1286 | ext4_lblk_t block_start = orig_start; |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 2a7015d06a75..3825d6aa8336 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -964,7 +964,7 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, | |||
964 | 964 | ||
965 | dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n", | 965 | dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n", |
966 | start_hash, start_minor_hash)); | 966 | start_hash, start_minor_hash)); |
967 | dir = dir_file->f_path.dentry->d_inode; | 967 | dir = file_inode(dir_file); |
968 | if (!(ext4_test_inode_flag(dir, EXT4_INODE_INDEX))) { | 968 | if (!(ext4_test_inode_flag(dir, EXT4_INODE_INDEX))) { |
969 | hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version; | 969 | hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version; |
970 | if (hinfo.hash_version <= DX_HASH_TEA) | 970 | if (hinfo.hash_version <= DX_HASH_TEA) |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 373d46cd5d3f..620cf5615ba2 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -450,7 +450,7 @@ void ext4_error_file(struct file *file, const char *function, | |||
450 | va_list args; | 450 | va_list args; |
451 | struct va_format vaf; | 451 | struct va_format vaf; |
452 | struct ext4_super_block *es; | 452 | struct ext4_super_block *es; |
453 | struct inode *inode = file->f_dentry->d_inode; | 453 | struct inode *inode = file_inode(file); |
454 | char pathname[80], *path; | 454 | char pathname[80], *path; |
455 | 455 | ||
456 | es = EXT4_SB(inode->i_sb)->s_es; | 456 | es = EXT4_SB(inode->i_sb)->s_es; |
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index c395c5012973..a1f38443ecee 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -600,7 +600,7 @@ bool f2fs_empty_dir(struct inode *dir) | |||
600 | static int f2fs_readdir(struct file *file, void *dirent, filldir_t filldir) | 600 | static int f2fs_readdir(struct file *file, void *dirent, filldir_t filldir) |
601 | { | 601 | { |
602 | unsigned long pos = file->f_pos; | 602 | unsigned long pos = file->f_pos; |
603 | struct inode *inode = file->f_dentry->d_inode; | 603 | struct inode *inode = file_inode(file); |
604 | unsigned long npages = dir_blocks(inode); | 604 | unsigned long npages = dir_blocks(inode); |
605 | unsigned char *types = NULL; | 605 | unsigned char *types = NULL; |
606 | unsigned int bit_pos = 0, start_bit_pos = 0; | 606 | unsigned int bit_pos = 0, start_bit_pos = 0; |
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 58bf744dbf39..165012ef363a 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -698,7 +698,7 @@ out: | |||
698 | 698 | ||
699 | static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir) | 699 | static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir) |
700 | { | 700 | { |
701 | struct inode *inode = filp->f_path.dentry->d_inode; | 701 | struct inode *inode = file_inode(filp); |
702 | return __fat_readdir(inode, filp, dirent, filldir, 0, 0); | 702 | return __fat_readdir(inode, filp, dirent, filldir, 0, 0); |
703 | } | 703 | } |
704 | 704 | ||
@@ -779,7 +779,7 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp, | |||
779 | static long fat_dir_ioctl(struct file *filp, unsigned int cmd, | 779 | static long fat_dir_ioctl(struct file *filp, unsigned int cmd, |
780 | unsigned long arg) | 780 | unsigned long arg) |
781 | { | 781 | { |
782 | struct inode *inode = filp->f_path.dentry->d_inode; | 782 | struct inode *inode = file_inode(filp); |
783 | struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg; | 783 | struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg; |
784 | int short_only, both; | 784 | int short_only, both; |
785 | 785 | ||
@@ -819,7 +819,7 @@ FAT_IOCTL_FILLDIR_FUNC(fat_compat_ioctl_filldir, compat_dirent) | |||
819 | static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd, | 819 | static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd, |
820 | unsigned long arg) | 820 | unsigned long arg) |
821 | { | 821 | { |
822 | struct inode *inode = filp->f_path.dentry->d_inode; | 822 | struct inode *inode = file_inode(filp); |
823 | struct compat_dirent __user *d1 = compat_ptr(arg); | 823 | struct compat_dirent __user *d1 = compat_ptr(arg); |
824 | int short_only, both; | 824 | int short_only, both; |
825 | 825 | ||
diff --git a/fs/fat/file.c b/fs/fat/file.c index a62e0ecbe2db..3978f8ca1823 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -32,7 +32,7 @@ static int fat_ioctl_get_attributes(struct inode *inode, u32 __user *user_attr) | |||
32 | 32 | ||
33 | static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) | 33 | static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) |
34 | { | 34 | { |
35 | struct inode *inode = file->f_path.dentry->d_inode; | 35 | struct inode *inode = file_inode(file); |
36 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); | 36 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); |
37 | int is_dir = S_ISDIR(inode->i_mode); | 37 | int is_dir = S_ISDIR(inode->i_mode); |
38 | u32 attr, oldattr; | 38 | u32 attr, oldattr; |
@@ -116,7 +116,7 @@ out: | |||
116 | 116 | ||
117 | long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 117 | long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
118 | { | 118 | { |
119 | struct inode *inode = filp->f_path.dentry->d_inode; | 119 | struct inode *inode = file_inode(filp); |
120 | u32 __user *user_attr = (u32 __user *)arg; | 120 | u32 __user *user_attr = (u32 __user *)arg; |
121 | 121 | ||
122 | switch (cmd) { | 122 | switch (cmd) { |
diff --git a/fs/fcntl.c b/fs/fcntl.c index 71a600a19f06..6599222536eb 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | static int setfl(int fd, struct file * filp, unsigned long arg) | 31 | static int setfl(int fd, struct file * filp, unsigned long arg) |
32 | { | 32 | { |
33 | struct inode * inode = filp->f_path.dentry->d_inode; | 33 | struct inode * inode = file_inode(filp); |
34 | int error = 0; | 34 | int error = 0; |
35 | 35 | ||
36 | /* | 36 | /* |
diff --git a/fs/file_table.c b/fs/file_table.c index de9e9653d611..aa07d3684a2e 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -94,8 +94,8 @@ int proc_nr_files(ctl_table *table, int write, | |||
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | /* Find an unused file structure and return a pointer to it. | 96 | /* Find an unused file structure and return a pointer to it. |
97 | * Returns NULL, if there are no more free file structures or | 97 | * Returns an error pointer if some error happend e.g. we over file |
98 | * we run out of memory. | 98 | * structures limit, run out of memory or operation is not permitted. |
99 | * | 99 | * |
100 | * Be very careful using this. You are responsible for | 100 | * Be very careful using this. You are responsible for |
101 | * getting write access to any mount that you might assign | 101 | * getting write access to any mount that you might assign |
@@ -107,7 +107,8 @@ struct file *get_empty_filp(void) | |||
107 | { | 107 | { |
108 | const struct cred *cred = current_cred(); | 108 | const struct cred *cred = current_cred(); |
109 | static long old_max; | 109 | static long old_max; |
110 | struct file * f; | 110 | struct file *f; |
111 | int error; | ||
111 | 112 | ||
112 | /* | 113 | /* |
113 | * Privileged users can go above max_files | 114 | * Privileged users can go above max_files |
@@ -122,13 +123,16 @@ struct file *get_empty_filp(void) | |||
122 | } | 123 | } |
123 | 124 | ||
124 | f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL); | 125 | f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL); |
125 | if (f == NULL) | 126 | if (unlikely(!f)) |
126 | goto fail; | 127 | return ERR_PTR(-ENOMEM); |
127 | 128 | ||
128 | percpu_counter_inc(&nr_files); | 129 | percpu_counter_inc(&nr_files); |
129 | f->f_cred = get_cred(cred); | 130 | f->f_cred = get_cred(cred); |
130 | if (security_file_alloc(f)) | 131 | error = security_file_alloc(f); |
131 | goto fail_sec; | 132 | if (unlikely(error)) { |
133 | file_free(f); | ||
134 | return ERR_PTR(error); | ||
135 | } | ||
132 | 136 | ||
133 | INIT_LIST_HEAD(&f->f_u.fu_list); | 137 | INIT_LIST_HEAD(&f->f_u.fu_list); |
134 | atomic_long_set(&f->f_count, 1); | 138 | atomic_long_set(&f->f_count, 1); |
@@ -144,12 +148,7 @@ over: | |||
144 | pr_info("VFS: file-max limit %lu reached\n", get_max_files()); | 148 | pr_info("VFS: file-max limit %lu reached\n", get_max_files()); |
145 | old_max = get_nr_files(); | 149 | old_max = get_nr_files(); |
146 | } | 150 | } |
147 | goto fail; | 151 | return ERR_PTR(-ENFILE); |
148 | |||
149 | fail_sec: | ||
150 | file_free(f); | ||
151 | fail: | ||
152 | return NULL; | ||
153 | } | 152 | } |
154 | 153 | ||
155 | /** | 154 | /** |
@@ -173,8 +172,8 @@ struct file *alloc_file(struct path *path, fmode_t mode, | |||
173 | struct file *file; | 172 | struct file *file; |
174 | 173 | ||
175 | file = get_empty_filp(); | 174 | file = get_empty_filp(); |
176 | if (!file) | 175 | if (IS_ERR(file)) |
177 | return NULL; | 176 | return file; |
178 | 177 | ||
179 | file->f_path = *path; | 178 | file->f_path = *path; |
180 | file->f_mapping = path->dentry->d_inode->i_mapping; | 179 | file->f_mapping = path->dentry->d_inode->i_mapping; |
@@ -447,7 +446,7 @@ void mark_files_ro(struct super_block *sb) | |||
447 | 446 | ||
448 | lg_global_lock(&files_lglock); | 447 | lg_global_lock(&files_lglock); |
449 | do_file_list_for_each_entry(sb, f) { | 448 | do_file_list_for_each_entry(sb, f) { |
450 | if (!S_ISREG(f->f_path.dentry->d_inode->i_mode)) | 449 | if (!S_ISREG(file_inode(f)->i_mode)) |
451 | continue; | 450 | continue; |
452 | if (!file_count(f)) | 451 | if (!file_count(f)) |
453 | continue; | 452 | continue; |
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c index bd447e88f208..664b07a53870 100644 --- a/fs/freevxfs/vxfs_lookup.c +++ b/fs/freevxfs/vxfs_lookup.c | |||
@@ -237,7 +237,7 @@ vxfs_lookup(struct inode *dip, struct dentry *dp, unsigned int flags) | |||
237 | static int | 237 | static int |
238 | vxfs_readdir(struct file *fp, void *retp, filldir_t filler) | 238 | vxfs_readdir(struct file *fp, void *retp, filldir_t filler) |
239 | { | 239 | { |
240 | struct inode *ip = fp->f_path.dentry->d_inode; | 240 | struct inode *ip = file_inode(fp); |
241 | struct super_block *sbp = ip->i_sb; | 241 | struct super_block *sbp = ip->i_sb; |
242 | u_long bsize = sbp->s_blocksize; | 242 | u_long bsize = sbp->s_blocksize; |
243 | u_long page, npages, block, pblocks, nblocks, offset; | 243 | u_long page, npages, block, pblocks, nblocks, offset; |
diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 75a20c092dd4..b7978b9f75ef 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_path.dentry->d_inode->i_private; | 26 | fc = file_inode(file)->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 85065221a58a..ff15522481d4 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1325,7 +1325,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir) | |||
1325 | int plus, err; | 1325 | int plus, err; |
1326 | size_t nbytes; | 1326 | size_t nbytes; |
1327 | struct page *page; | 1327 | struct page *page; |
1328 | struct inode *inode = file->f_path.dentry->d_inode; | 1328 | struct inode *inode = file_inode(file); |
1329 | struct fuse_conn *fc = get_fuse_conn(inode); | 1329 | struct fuse_conn *fc = get_fuse_conn(inode); |
1330 | struct fuse_req *req; | 1330 | struct fuse_req *req; |
1331 | u64 attr_version = 0; | 1331 | u64 attr_version = 0; |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 01353ed75750..df00993ed108 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -679,7 +679,7 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len, | |||
679 | 679 | ||
680 | if (*max_len < len) { | 680 | if (*max_len < len) { |
681 | *max_len = len; | 681 | *max_len = len; |
682 | return 255; | 682 | return FILEID_INVALID; |
683 | } | 683 | } |
684 | 684 | ||
685 | nodeid = get_fuse_inode(inode)->nodeid; | 685 | nodeid = get_fuse_inode(inode)->nodeid; |
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index 4767774a5f3e..9973df4ff565 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c | |||
@@ -37,10 +37,10 @@ static int gfs2_encode_fh(struct inode *inode, __u32 *p, int *len, | |||
37 | 37 | ||
38 | if (parent && (*len < GFS2_LARGE_FH_SIZE)) { | 38 | if (parent && (*len < GFS2_LARGE_FH_SIZE)) { |
39 | *len = GFS2_LARGE_FH_SIZE; | 39 | *len = GFS2_LARGE_FH_SIZE; |
40 | return 255; | 40 | return FILEID_INVALID; |
41 | } else if (*len < GFS2_SMALL_FH_SIZE) { | 41 | } else if (*len < GFS2_SMALL_FH_SIZE) { |
42 | *len = GFS2_SMALL_FH_SIZE; | 42 | *len = GFS2_SMALL_FH_SIZE; |
43 | return 255; | 43 | return FILEID_INVALID; |
44 | } | 44 | } |
45 | 45 | ||
46 | fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32); | 46 | fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32); |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 2687f50d98cb..019f45e45097 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -157,7 +157,7 @@ static const u32 gfs2_to_fsflags[32] = { | |||
157 | 157 | ||
158 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) | 158 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) |
159 | { | 159 | { |
160 | struct inode *inode = filp->f_path.dentry->d_inode; | 160 | struct inode *inode = file_inode(filp); |
161 | struct gfs2_inode *ip = GFS2_I(inode); | 161 | struct gfs2_inode *ip = GFS2_I(inode); |
162 | struct gfs2_holder gh; | 162 | struct gfs2_holder gh; |
163 | int error; | 163 | int error; |
@@ -217,7 +217,7 @@ void gfs2_set_inode_flags(struct inode *inode) | |||
217 | */ | 217 | */ |
218 | static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | 218 | static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) |
219 | { | 219 | { |
220 | struct inode *inode = filp->f_path.dentry->d_inode; | 220 | struct inode *inode = file_inode(filp); |
221 | struct gfs2_inode *ip = GFS2_I(inode); | 221 | struct gfs2_inode *ip = GFS2_I(inode); |
222 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 222 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
223 | struct buffer_head *bh; | 223 | struct buffer_head *bh; |
@@ -293,7 +293,7 @@ out_drop_write: | |||
293 | 293 | ||
294 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) | 294 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) |
295 | { | 295 | { |
296 | struct inode *inode = filp->f_path.dentry->d_inode; | 296 | struct inode *inode = file_inode(filp); |
297 | u32 fsflags, gfsflags; | 297 | u32 fsflags, gfsflags; |
298 | 298 | ||
299 | if (get_user(fsflags, ptr)) | 299 | if (get_user(fsflags, ptr)) |
@@ -336,7 +336,7 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
336 | 336 | ||
337 | static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size) | 337 | static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size) |
338 | { | 338 | { |
339 | struct inode *inode = filep->f_dentry->d_inode; | 339 | struct inode *inode = file_inode(filep); |
340 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 340 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
341 | struct gfs2_inode *ip = GFS2_I(inode); | 341 | struct gfs2_inode *ip = GFS2_I(inode); |
342 | size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift; | 342 | size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift; |
@@ -386,7 +386,7 @@ static int gfs2_allocate_page_backing(struct page *page) | |||
386 | static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 386 | static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
387 | { | 387 | { |
388 | struct page *page = vmf->page; | 388 | struct page *page = vmf->page; |
389 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 389 | struct inode *inode = file_inode(vma->vm_file); |
390 | struct gfs2_inode *ip = GFS2_I(inode); | 390 | struct gfs2_inode *ip = GFS2_I(inode); |
391 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 391 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
392 | unsigned long last_index; | 392 | unsigned long last_index; |
@@ -673,8 +673,7 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
673 | { | 673 | { |
674 | struct file *file = iocb->ki_filp; | 674 | struct file *file = iocb->ki_filp; |
675 | size_t writesize = iov_length(iov, nr_segs); | 675 | size_t writesize = iov_length(iov, nr_segs); |
676 | struct dentry *dentry = file->f_dentry; | 676 | struct gfs2_inode *ip = GFS2_I(file_inode(file)); |
677 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | ||
678 | int ret; | 677 | int ret; |
679 | 678 | ||
680 | ret = gfs2_rs_alloc(ip); | 679 | ret = gfs2_rs_alloc(ip); |
@@ -772,7 +771,7 @@ static void calc_max_reserv(struct gfs2_inode *ip, loff_t max, loff_t *len, | |||
772 | static long gfs2_fallocate(struct file *file, int mode, loff_t offset, | 771 | static long gfs2_fallocate(struct file *file, int mode, loff_t offset, |
773 | loff_t len) | 772 | loff_t len) |
774 | { | 773 | { |
775 | struct inode *inode = file->f_path.dentry->d_inode; | 774 | struct inode *inode = file_inode(file); |
776 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 775 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
777 | struct gfs2_inode *ip = GFS2_I(inode); | 776 | struct gfs2_inode *ip = GFS2_I(inode); |
778 | unsigned int data_blocks = 0, ind_blocks = 0, rblocks; | 777 | unsigned int data_blocks = 0, ind_blocks = 0, rblocks; |
@@ -938,7 +937,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
938 | { | 937 | { |
939 | struct gfs2_file *fp = file->private_data; | 938 | struct gfs2_file *fp = file->private_data; |
940 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; | 939 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; |
941 | struct gfs2_inode *ip = GFS2_I(file->f_path.dentry->d_inode); | 940 | struct gfs2_inode *ip = GFS2_I(file_inode(file)); |
942 | struct gfs2_glock *gl; | 941 | struct gfs2_glock *gl; |
943 | unsigned int state; | 942 | unsigned int state; |
944 | int flags; | 943 | int flags; |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 52c2aeaf45ce..d1f51fd73f86 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1257,7 +1257,7 @@ fail: | |||
1257 | 1257 | ||
1258 | int gfs2_fitrim(struct file *filp, void __user *argp) | 1258 | int gfs2_fitrim(struct file *filp, void __user *argp) |
1259 | { | 1259 | { |
1260 | struct inode *inode = filp->f_dentry->d_inode; | 1260 | struct inode *inode = file_inode(filp); |
1261 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 1261 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
1262 | struct request_queue *q = bdev_get_queue(sdp->sd_vfs->s_bdev); | 1262 | struct request_queue *q = bdev_get_queue(sdp->sd_vfs->s_bdev); |
1263 | struct buffer_head *bh; | 1263 | struct buffer_head *bh; |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 597a612834dc..aa5c48044966 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -103,7 +103,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | |||
103 | int n = simple_strtol(buf, NULL, 0); | 103 | int n = simple_strtol(buf, NULL, 0); |
104 | 104 | ||
105 | if (!capable(CAP_SYS_ADMIN)) | 105 | if (!capable(CAP_SYS_ADMIN)) |
106 | return -EACCES; | 106 | return -EPERM; |
107 | 107 | ||
108 | switch (n) { | 108 | switch (n) { |
109 | case 0: | 109 | case 0: |
@@ -133,7 +133,7 @@ static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) | |||
133 | static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | 133 | static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) |
134 | { | 134 | { |
135 | if (!capable(CAP_SYS_ADMIN)) | 135 | if (!capable(CAP_SYS_ADMIN)) |
136 | return -EACCES; | 136 | return -EPERM; |
137 | 137 | ||
138 | if (simple_strtol(buf, NULL, 0) != 1) | 138 | if (simple_strtol(buf, NULL, 0) != 1) |
139 | return -EINVAL; | 139 | return -EINVAL; |
@@ -148,7 +148,7 @@ static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf, | |||
148 | size_t len) | 148 | size_t len) |
149 | { | 149 | { |
150 | if (!capable(CAP_SYS_ADMIN)) | 150 | if (!capable(CAP_SYS_ADMIN)) |
151 | return -EACCES; | 151 | return -EPERM; |
152 | 152 | ||
153 | if (simple_strtol(buf, NULL, 0) != 1) | 153 | if (simple_strtol(buf, NULL, 0) != 1) |
154 | return -EINVAL; | 154 | return -EINVAL; |
@@ -161,7 +161,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf, | |||
161 | size_t len) | 161 | size_t len) |
162 | { | 162 | { |
163 | if (!capable(CAP_SYS_ADMIN)) | 163 | if (!capable(CAP_SYS_ADMIN)) |
164 | return -EACCES; | 164 | return -EPERM; |
165 | 165 | ||
166 | if (simple_strtol(buf, NULL, 0) != 1) | 166 | if (simple_strtol(buf, NULL, 0) != 1) |
167 | return -EINVAL; | 167 | return -EINVAL; |
@@ -178,7 +178,7 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, | |||
178 | u32 id; | 178 | u32 id; |
179 | 179 | ||
180 | if (!capable(CAP_SYS_ADMIN)) | 180 | if (!capable(CAP_SYS_ADMIN)) |
181 | return -EACCES; | 181 | return -EPERM; |
182 | 182 | ||
183 | id = simple_strtoul(buf, NULL, 0); | 183 | id = simple_strtoul(buf, NULL, 0); |
184 | 184 | ||
@@ -198,7 +198,7 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, | |||
198 | u32 id; | 198 | u32 id; |
199 | 199 | ||
200 | if (!capable(CAP_SYS_ADMIN)) | 200 | if (!capable(CAP_SYS_ADMIN)) |
201 | return -EACCES; | 201 | return -EPERM; |
202 | 202 | ||
203 | id = simple_strtoul(buf, NULL, 0); | 203 | id = simple_strtoul(buf, NULL, 0); |
204 | 204 | ||
@@ -221,7 +221,7 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len | |||
221 | int rv; | 221 | int rv; |
222 | 222 | ||
223 | if (!capable(CAP_SYS_ADMIN)) | 223 | if (!capable(CAP_SYS_ADMIN)) |
224 | return -EACCES; | 224 | return -EPERM; |
225 | 225 | ||
226 | rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum, | 226 | rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum, |
227 | mode); | 227 | mode); |
@@ -532,7 +532,7 @@ static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf, | |||
532 | unsigned int x, y; | 532 | unsigned int x, y; |
533 | 533 | ||
534 | if (!capable(CAP_SYS_ADMIN)) | 534 | if (!capable(CAP_SYS_ADMIN)) |
535 | return -EACCES; | 535 | return -EPERM; |
536 | 536 | ||
537 | if (sscanf(buf, "%u %u", &x, &y) != 2 || !y) | 537 | if (sscanf(buf, "%u %u", &x, &y) != 2 || !y) |
538 | return -EINVAL; | 538 | return -EINVAL; |
@@ -551,7 +551,7 @@ static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field, | |||
551 | unsigned int x; | 551 | unsigned int x; |
552 | 552 | ||
553 | if (!capable(CAP_SYS_ADMIN)) | 553 | if (!capable(CAP_SYS_ADMIN)) |
554 | return -EACCES; | 554 | return -EPERM; |
555 | 555 | ||
556 | x = simple_strtoul(buf, NULL, 0); | 556 | x = simple_strtoul(buf, NULL, 0); |
557 | 557 | ||
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 422dde2ec0a1..5f7f1abd5f6d 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
@@ -51,7 +51,7 @@ done: | |||
51 | */ | 51 | */ |
52 | static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 52 | static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
53 | { | 53 | { |
54 | struct inode *inode = filp->f_path.dentry->d_inode; | 54 | struct inode *inode = file_inode(filp); |
55 | struct super_block *sb = inode->i_sb; | 55 | struct super_block *sb = inode->i_sb; |
56 | int len, err; | 56 | int len, err; |
57 | char strbuf[HFS_MAX_NAMELEN]; | 57 | char strbuf[HFS_MAX_NAMELEN]; |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index d47f11658c17..3031dfdd2358 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -128,7 +128,7 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb, | |||
128 | { | 128 | { |
129 | struct file *file = iocb->ki_filp; | 129 | struct file *file = iocb->ki_filp; |
130 | struct address_space *mapping = file->f_mapping; | 130 | struct address_space *mapping = file->f_mapping; |
131 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; | 131 | struct inode *inode = file_inode(file)->i_mapping->host; |
132 | ssize_t ret; | 132 | ssize_t ret; |
133 | 133 | ||
134 | ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, | 134 | ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 6b9f921ef2fa..074e04589248 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -122,7 +122,7 @@ fail: | |||
122 | 122 | ||
123 | static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | 123 | static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) |
124 | { | 124 | { |
125 | struct inode *inode = filp->f_path.dentry->d_inode; | 125 | struct inode *inode = file_inode(filp); |
126 | struct super_block *sb = inode->i_sb; | 126 | struct super_block *sb = inode->i_sb; |
127 | int len, err; | 127 | int len, err; |
128 | char strbuf[HFSPLUS_MAX_STRLEN + 1]; | 128 | char strbuf[HFSPLUS_MAX_STRLEN + 1]; |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 799b336b59f9..dcd05be5344b 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -124,7 +124,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb, | |||
124 | { | 124 | { |
125 | struct file *file = iocb->ki_filp; | 125 | struct file *file = iocb->ki_filp; |
126 | struct address_space *mapping = file->f_mapping; | 126 | struct address_space *mapping = file->f_mapping; |
127 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; | 127 | struct inode *inode = file_inode(file)->i_mapping->host; |
128 | ssize_t ret; | 128 | ssize_t ret; |
129 | 129 | ||
130 | ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, | 130 | ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, |
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index 09addc8615fa..e3c4c4209428 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
@@ -59,7 +59,7 @@ static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags) | |||
59 | 59 | ||
60 | static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags) | 60 | static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags) |
61 | { | 61 | { |
62 | struct inode *inode = file->f_path.dentry->d_inode; | 62 | struct inode *inode = file_inode(file); |
63 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | 63 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); |
64 | unsigned int flags = 0; | 64 | unsigned int flags = 0; |
65 | 65 | ||
@@ -75,7 +75,7 @@ static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags) | |||
75 | 75 | ||
76 | static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | 76 | static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) |
77 | { | 77 | { |
78 | struct inode *inode = file->f_path.dentry->d_inode; | 78 | struct inode *inode = file_inode(file); |
79 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | 79 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); |
80 | unsigned int flags; | 80 | unsigned int flags; |
81 | int err = 0; | 81 | int err = 0; |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 457addc5c91f..fbabb906066f 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -30,7 +30,7 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode) | |||
30 | return list_entry(inode, struct hostfs_inode_info, vfs_inode); | 30 | return list_entry(inode, struct hostfs_inode_info, vfs_inode); |
31 | } | 31 | } |
32 | 32 | ||
33 | #define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_path.dentry->d_inode) | 33 | #define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file)) |
34 | 34 | ||
35 | static int hostfs_d_delete(const struct dentry *dentry) | 35 | static int hostfs_d_delete(const struct dentry *dentry) |
36 | { | 36 | { |
@@ -861,14 +861,6 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
861 | } | 861 | } |
862 | 862 | ||
863 | static const struct inode_operations hostfs_iops = { | 863 | static const struct inode_operations hostfs_iops = { |
864 | .create = hostfs_create, | ||
865 | .link = hostfs_link, | ||
866 | .unlink = hostfs_unlink, | ||
867 | .symlink = hostfs_symlink, | ||
868 | .mkdir = hostfs_mkdir, | ||
869 | .rmdir = hostfs_rmdir, | ||
870 | .mknod = hostfs_mknod, | ||
871 | .rename = hostfs_rename, | ||
872 | .permission = hostfs_permission, | 864 | .permission = hostfs_permission, |
873 | .setattr = hostfs_setattr, | 865 | .setattr = hostfs_setattr, |
874 | }; | 866 | }; |
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 78e12b2e0ea2..546f6d39713a 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -25,7 +25,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
25 | loff_t new_off = off + (whence == 1 ? filp->f_pos : 0); | 25 | loff_t new_off = off + (whence == 1 ? filp->f_pos : 0); |
26 | loff_t pos; | 26 | loff_t pos; |
27 | struct quad_buffer_head qbh; | 27 | struct quad_buffer_head qbh; |
28 | struct inode *i = filp->f_path.dentry->d_inode; | 28 | struct inode *i = file_inode(filp); |
29 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); | 29 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); |
30 | struct super_block *s = i->i_sb; | 30 | struct super_block *s = i->i_sb; |
31 | 31 | ||
@@ -57,7 +57,7 @@ fail: | |||
57 | 57 | ||
58 | static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 58 | static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
59 | { | 59 | { |
60 | struct inode *inode = filp->f_path.dentry->d_inode; | 60 | struct inode *inode = file_inode(filp); |
61 | struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); | 61 | struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); |
62 | struct quad_buffer_head qbh; | 62 | struct quad_buffer_head qbh; |
63 | struct hpfs_dirent *de; | 63 | struct hpfs_dirent *de; |
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index fbfe2df5624b..9f9dbeceeee7 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -152,7 +152,7 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf, | |||
152 | retval = do_sync_write(file, buf, count, ppos); | 152 | retval = do_sync_write(file, buf, count, ppos); |
153 | if (retval > 0) { | 153 | if (retval > 0) { |
154 | hpfs_lock(file->f_path.dentry->d_sb); | 154 | hpfs_lock(file->f_path.dentry->d_sb); |
155 | hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1; | 155 | hpfs_i(file_inode(file))->i_dirty = 1; |
156 | hpfs_unlock(file->f_path.dentry->d_sb); | 156 | hpfs_unlock(file->f_path.dentry->d_sb); |
157 | } | 157 | } |
158 | return retval; | 158 | return retval; |
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index 43b315f2002b..74f55703be49 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c | |||
@@ -180,7 +180,7 @@ static ssize_t read_proc(struct file *file, char __user *buf, ssize_t count, | |||
180 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | 180 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); |
181 | ssize_t n; | 181 | ssize_t n; |
182 | 182 | ||
183 | read = file->f_path.dentry->d_inode->i_fop->read; | 183 | read = file_inode(file)->i_fop->read; |
184 | 184 | ||
185 | if (!is_user) | 185 | if (!is_user) |
186 | set_fs(KERNEL_DS); | 186 | set_fs(KERNEL_DS); |
@@ -288,7 +288,7 @@ static ssize_t hppfs_write(struct file *file, const char __user *buf, | |||
288 | struct file *proc_file = data->proc_file; | 288 | struct file *proc_file = data->proc_file; |
289 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); | 289 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); |
290 | 290 | ||
291 | write = proc_file->f_path.dentry->d_inode->i_fop->write; | 291 | write = file_inode(proc_file)->i_fop->write; |
292 | return (*write)(proc_file, buf, len, ppos); | 292 | return (*write)(proc_file, buf, len, ppos); |
293 | } | 293 | } |
294 | 294 | ||
@@ -513,7 +513,7 @@ static loff_t hppfs_llseek(struct file *file, loff_t off, int where) | |||
513 | loff_t (*llseek)(struct file *, loff_t, int); | 513 | loff_t (*llseek)(struct file *, loff_t, int); |
514 | loff_t ret; | 514 | loff_t ret; |
515 | 515 | ||
516 | llseek = proc_file->f_path.dentry->d_inode->i_fop->llseek; | 516 | llseek = file_inode(proc_file)->i_fop->llseek; |
517 | if (llseek != NULL) { | 517 | if (llseek != NULL) { |
518 | ret = (*llseek)(proc_file, off, where); | 518 | ret = (*llseek)(proc_file, off, where); |
519 | if (ret < 0) | 519 | if (ret < 0) |
@@ -561,7 +561,7 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir) | |||
561 | }); | 561 | }); |
562 | int err; | 562 | int err; |
563 | 563 | ||
564 | readdir = proc_file->f_path.dentry->d_inode->i_fop->readdir; | 564 | readdir = file_inode(proc_file)->i_fop->readdir; |
565 | 565 | ||
566 | proc_file->f_pos = file->f_pos; | 566 | proc_file->f_pos = file->f_pos; |
567 | err = (*readdir)(proc_file, &dirent, hppfs_filldir); | 567 | err = (*readdir)(proc_file, &dirent, hppfs_filldir); |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 78bde32ea951..7f94e0cbc69c 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -97,7 +97,7 @@ static void huge_pagevec_release(struct pagevec *pvec) | |||
97 | 97 | ||
98 | static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | 98 | static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) |
99 | { | 99 | { |
100 | struct inode *inode = file->f_path.dentry->d_inode; | 100 | struct inode *inode = file_inode(file); |
101 | loff_t len, vma_len; | 101 | loff_t len, vma_len; |
102 | int ret; | 102 | int ret; |
103 | struct hstate *h = hstate_file(file); | 103 | struct hstate *h = hstate_file(file); |
@@ -918,16 +918,25 @@ static int get_hstate_idx(int page_size_log) | |||
918 | return h - hstates; | 918 | return h - hstates; |
919 | } | 919 | } |
920 | 920 | ||
921 | static char *hugetlb_dname(struct dentry *dentry, char *buffer, int buflen) | ||
922 | { | ||
923 | return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)", | ||
924 | dentry->d_name.name); | ||
925 | } | ||
926 | |||
927 | static struct dentry_operations anon_ops = { | ||
928 | .d_dname = hugetlb_dname | ||
929 | }; | ||
930 | |||
921 | struct file *hugetlb_file_setup(const char *name, unsigned long addr, | 931 | struct file *hugetlb_file_setup(const char *name, unsigned long addr, |
922 | size_t size, vm_flags_t acctflag, | 932 | size_t size, vm_flags_t acctflag, |
923 | struct user_struct **user, | 933 | struct user_struct **user, |
924 | int creat_flags, int page_size_log) | 934 | int creat_flags, int page_size_log) |
925 | { | 935 | { |
926 | int error = -ENOMEM; | 936 | struct file *file = ERR_PTR(-ENOMEM); |
927 | struct file *file; | ||
928 | struct inode *inode; | 937 | struct inode *inode; |
929 | struct path path; | 938 | struct path path; |
930 | struct dentry *root; | 939 | struct super_block *sb; |
931 | struct qstr quick_string; | 940 | struct qstr quick_string; |
932 | struct hstate *hstate; | 941 | struct hstate *hstate; |
933 | unsigned long num_pages; | 942 | unsigned long num_pages; |
@@ -955,17 +964,18 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr, | |||
955 | } | 964 | } |
956 | } | 965 | } |
957 | 966 | ||
958 | root = hugetlbfs_vfsmount[hstate_idx]->mnt_root; | 967 | sb = hugetlbfs_vfsmount[hstate_idx]->mnt_sb; |
959 | quick_string.name = name; | 968 | quick_string.name = name; |
960 | quick_string.len = strlen(quick_string.name); | 969 | quick_string.len = strlen(quick_string.name); |
961 | quick_string.hash = 0; | 970 | quick_string.hash = 0; |
962 | path.dentry = d_alloc(root, &quick_string); | 971 | path.dentry = d_alloc_pseudo(sb, &quick_string); |
963 | if (!path.dentry) | 972 | if (!path.dentry) |
964 | goto out_shm_unlock; | 973 | goto out_shm_unlock; |
965 | 974 | ||
975 | d_set_d_op(path.dentry, &anon_ops); | ||
966 | path.mnt = mntget(hugetlbfs_vfsmount[hstate_idx]); | 976 | path.mnt = mntget(hugetlbfs_vfsmount[hstate_idx]); |
967 | error = -ENOSPC; | 977 | file = ERR_PTR(-ENOSPC); |
968 | inode = hugetlbfs_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0); | 978 | inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0); |
969 | if (!inode) | 979 | if (!inode) |
970 | goto out_dentry; | 980 | goto out_dentry; |
971 | 981 | ||
@@ -973,7 +983,7 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr, | |||
973 | size += addr & ~huge_page_mask(hstate); | 983 | size += addr & ~huge_page_mask(hstate); |
974 | num_pages = ALIGN(size, huge_page_size(hstate)) >> | 984 | num_pages = ALIGN(size, huge_page_size(hstate)) >> |
975 | huge_page_shift(hstate); | 985 | huge_page_shift(hstate); |
976 | error = -ENOMEM; | 986 | file = ERR_PTR(-ENOMEM); |
977 | if (hugetlb_reserve_pages(inode, 0, num_pages, NULL, acctflag)) | 987 | if (hugetlb_reserve_pages(inode, 0, num_pages, NULL, acctflag)) |
978 | goto out_inode; | 988 | goto out_inode; |
979 | 989 | ||
@@ -981,10 +991,9 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr, | |||
981 | inode->i_size = size; | 991 | inode->i_size = size; |
982 | clear_nlink(inode); | 992 | clear_nlink(inode); |
983 | 993 | ||
984 | error = -ENFILE; | ||
985 | file = alloc_file(&path, FMODE_WRITE | FMODE_READ, | 994 | file = alloc_file(&path, FMODE_WRITE | FMODE_READ, |
986 | &hugetlbfs_file_operations); | 995 | &hugetlbfs_file_operations); |
987 | if (!file) | 996 | if (IS_ERR(file)) |
988 | goto out_dentry; /* inode is already attached */ | 997 | goto out_dentry; /* inode is already attached */ |
989 | 998 | ||
990 | return file; | 999 | return file; |
@@ -998,7 +1007,7 @@ out_shm_unlock: | |||
998 | user_shm_unlock(size, *user); | 1007 | user_shm_unlock(size, *user); |
999 | *user = NULL; | 1008 | *user = NULL; |
1000 | } | 1009 | } |
1001 | return ERR_PTR(error); | 1010 | return file; |
1002 | } | 1011 | } |
1003 | 1012 | ||
1004 | static int __init init_hugetlbfs_fs(void) | 1013 | static int __init init_hugetlbfs_fs(void) |
diff --git a/fs/inode.c b/fs/inode.c index 14084b72b259..67880e604399 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1655,7 +1655,7 @@ EXPORT_SYMBOL(file_remove_suid); | |||
1655 | 1655 | ||
1656 | int file_update_time(struct file *file) | 1656 | int file_update_time(struct file *file) |
1657 | { | 1657 | { |
1658 | struct inode *inode = file->f_path.dentry->d_inode; | 1658 | struct inode *inode = file_inode(file); |
1659 | struct timespec now; | 1659 | struct timespec now; |
1660 | int sync_it = 0; | 1660 | int sync_it = 0; |
1661 | int ret; | 1661 | int ret; |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 3bdad6d1f268..fd507fb460f8 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -175,7 +175,7 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg) | |||
175 | struct fiemap fiemap; | 175 | struct fiemap fiemap; |
176 | struct fiemap __user *ufiemap = (struct fiemap __user *) arg; | 176 | struct fiemap __user *ufiemap = (struct fiemap __user *) arg; |
177 | struct fiemap_extent_info fieinfo = { 0, }; | 177 | struct fiemap_extent_info fieinfo = { 0, }; |
178 | struct inode *inode = filp->f_path.dentry->d_inode; | 178 | struct inode *inode = file_inode(filp); |
179 | struct super_block *sb = inode->i_sb; | 179 | struct super_block *sb = inode->i_sb; |
180 | u64 len; | 180 | u64 len; |
181 | int error; | 181 | int error; |
@@ -424,7 +424,7 @@ EXPORT_SYMBOL(generic_block_fiemap); | |||
424 | */ | 424 | */ |
425 | int ioctl_preallocate(struct file *filp, void __user *argp) | 425 | int ioctl_preallocate(struct file *filp, void __user *argp) |
426 | { | 426 | { |
427 | struct inode *inode = filp->f_path.dentry->d_inode; | 427 | struct inode *inode = file_inode(filp); |
428 | struct space_resv sr; | 428 | struct space_resv sr; |
429 | 429 | ||
430 | if (copy_from_user(&sr, argp, sizeof(sr))) | 430 | if (copy_from_user(&sr, argp, sizeof(sr))) |
@@ -449,7 +449,7 @@ int ioctl_preallocate(struct file *filp, void __user *argp) | |||
449 | static int file_ioctl(struct file *filp, unsigned int cmd, | 449 | static int file_ioctl(struct file *filp, unsigned int cmd, |
450 | unsigned long arg) | 450 | unsigned long arg) |
451 | { | 451 | { |
452 | struct inode *inode = filp->f_path.dentry->d_inode; | 452 | struct inode *inode = file_inode(filp); |
453 | int __user *p = (int __user *)arg; | 453 | int __user *p = (int __user *)arg; |
454 | 454 | ||
455 | switch (cmd) { | 455 | switch (cmd) { |
@@ -512,7 +512,7 @@ static int ioctl_fioasync(unsigned int fd, struct file *filp, | |||
512 | 512 | ||
513 | static int ioctl_fsfreeze(struct file *filp) | 513 | static int ioctl_fsfreeze(struct file *filp) |
514 | { | 514 | { |
515 | struct super_block *sb = filp->f_path.dentry->d_inode->i_sb; | 515 | struct super_block *sb = file_inode(filp)->i_sb; |
516 | 516 | ||
517 | if (!capable(CAP_SYS_ADMIN)) | 517 | if (!capable(CAP_SYS_ADMIN)) |
518 | return -EPERM; | 518 | return -EPERM; |
@@ -527,7 +527,7 @@ static int ioctl_fsfreeze(struct file *filp) | |||
527 | 527 | ||
528 | static int ioctl_fsthaw(struct file *filp) | 528 | static int ioctl_fsthaw(struct file *filp) |
529 | { | 529 | { |
530 | struct super_block *sb = filp->f_path.dentry->d_inode->i_sb; | 530 | struct super_block *sb = file_inode(filp)->i_sb; |
531 | 531 | ||
532 | if (!capable(CAP_SYS_ADMIN)) | 532 | if (!capable(CAP_SYS_ADMIN)) |
533 | return -EPERM; | 533 | return -EPERM; |
@@ -548,7 +548,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | |||
548 | { | 548 | { |
549 | int error = 0; | 549 | int error = 0; |
550 | int __user *argp = (int __user *)arg; | 550 | int __user *argp = (int __user *)arg; |
551 | struct inode *inode = filp->f_path.dentry->d_inode; | 551 | struct inode *inode = file_inode(filp); |
552 | 552 | ||
553 | switch (cmd) { | 553 | switch (cmd) { |
554 | case FIOCLEX: | 554 | case FIOCLEX: |
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c index 0b3fa7974fa8..592e5115a561 100644 --- a/fs/isofs/compress.c +++ b/fs/isofs/compress.c | |||
@@ -296,7 +296,7 @@ static int zisofs_fill_pages(struct inode *inode, int full_page, int pcount, | |||
296 | */ | 296 | */ |
297 | static int zisofs_readpage(struct file *file, struct page *page) | 297 | static int zisofs_readpage(struct file *file, struct page *page) |
298 | { | 298 | { |
299 | struct inode *inode = file->f_path.dentry->d_inode; | 299 | struct inode *inode = file_inode(file); |
300 | struct address_space *mapping = inode->i_mapping; | 300 | struct address_space *mapping = inode->i_mapping; |
301 | int err; | 301 | int err; |
302 | int i, pcount, full_page; | 302 | int i, pcount, full_page; |
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index f20437c068a0..a7d5c3c3d4e6 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c | |||
@@ -253,7 +253,7 @@ static int isofs_readdir(struct file *filp, | |||
253 | int result; | 253 | int result; |
254 | char *tmpname; | 254 | char *tmpname; |
255 | struct iso_directory_record *tmpde; | 255 | struct iso_directory_record *tmpde; |
256 | struct inode *inode = filp->f_path.dentry->d_inode; | 256 | struct inode *inode = file_inode(filp); |
257 | 257 | ||
258 | tmpname = (char *)__get_free_page(GFP_KERNEL); | 258 | tmpname = (char *)__get_free_page(GFP_KERNEL); |
259 | if (tmpname == NULL) | 259 | if (tmpname == NULL) |
diff --git a/fs/isofs/export.c b/fs/isofs/export.c index 2b4f2358eadb..12088d8de3fa 100644 --- a/fs/isofs/export.c +++ b/fs/isofs/export.c | |||
@@ -125,10 +125,10 @@ isofs_export_encode_fh(struct inode *inode, | |||
125 | */ | 125 | */ |
126 | if (parent && (len < 5)) { | 126 | if (parent && (len < 5)) { |
127 | *max_len = 5; | 127 | *max_len = 5; |
128 | return 255; | 128 | return FILEID_INVALID; |
129 | } else if (len < 3) { | 129 | } else if (len < 3) { |
130 | *max_len = 3; | 130 | *max_len = 3; |
131 | return 255; | 131 | return FILEID_INVALID; |
132 | } | 132 | } |
133 | 133 | ||
134 | len = 3; | 134 | len = 3; |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index ad7774d32095..acd46a4160cb 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -117,12 +117,12 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, | |||
117 | static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) | 117 | static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) |
118 | { | 118 | { |
119 | struct jffs2_inode_info *f; | 119 | struct jffs2_inode_info *f; |
120 | struct inode *inode = filp->f_path.dentry->d_inode; | 120 | struct inode *inode = file_inode(filp); |
121 | struct jffs2_full_dirent *fd; | 121 | struct jffs2_full_dirent *fd; |
122 | unsigned long offset, curofs; | 122 | unsigned long offset, curofs; |
123 | 123 | ||
124 | jffs2_dbg(1, "jffs2_readdir() for dir_i #%lu\n", | 124 | jffs2_dbg(1, "jffs2_readdir() for dir_i #%lu\n", |
125 | filp->f_path.dentry->d_inode->i_ino); | 125 | file_inode(filp)->i_ino); |
126 | 126 | ||
127 | f = JFFS2_INODE_INFO(inode); | 127 | f = JFFS2_INODE_INFO(inode); |
128 | 128 | ||
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c index bc555ff417e9..93a1232894f6 100644 --- a/fs/jfs/ioctl.c +++ b/fs/jfs/ioctl.c | |||
@@ -58,7 +58,7 @@ static long jfs_map_ext2(unsigned long flags, int from) | |||
58 | 58 | ||
59 | long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 59 | long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
60 | { | 60 | { |
61 | struct inode *inode = filp->f_dentry->d_inode; | 61 | struct inode *inode = file_inode(filp); |
62 | struct jfs_inode_info *jfs_inode = JFS_IP(inode); | 62 | struct jfs_inode_info *jfs_inode = JFS_IP(inode); |
63 | unsigned int flags; | 63 | unsigned int flags; |
64 | 64 | ||
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 9197a1b0d02d..0ddbeceafc62 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -3004,7 +3004,7 @@ static inline struct jfs_dirent *next_jfs_dirent(struct jfs_dirent *dirent) | |||
3004 | */ | 3004 | */ |
3005 | int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 3005 | int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
3006 | { | 3006 | { |
3007 | struct inode *ip = filp->f_path.dentry->d_inode; | 3007 | struct inode *ip = file_inode(filp); |
3008 | struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab; | 3008 | struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab; |
3009 | int rc = 0; | 3009 | int rc = 0; |
3010 | loff_t dtpos; /* legacy OS/2 style position */ | 3010 | loff_t dtpos; /* legacy OS/2 style position */ |
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index ca0a08001449..a2717408c478 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -178,7 +178,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock) | |||
178 | continue; | 178 | continue; |
179 | if (!rpc_cmp_addr(nlm_addr(block->b_host), addr)) | 179 | if (!rpc_cmp_addr(nlm_addr(block->b_host), addr)) |
180 | continue; | 180 | continue; |
181 | if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0) | 181 | if (nfs_compare_fh(NFS_FH(file_inode(fl_blocked->fl_file)) ,fh) != 0) |
182 | continue; | 182 | continue; |
183 | /* Alright, we found a lock. Set the return status | 183 | /* Alright, we found a lock. Set the return status |
184 | * and wake up the caller | 184 | * and wake up the caller |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 52e5120bb159..366277190b82 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -127,7 +127,7 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl) | |||
127 | struct nlm_lock *lock = &argp->lock; | 127 | struct nlm_lock *lock = &argp->lock; |
128 | 128 | ||
129 | nlmclnt_next_cookie(&argp->cookie); | 129 | nlmclnt_next_cookie(&argp->cookie); |
130 | memcpy(&lock->fh, NFS_FH(fl->fl_file->f_path.dentry->d_inode), sizeof(struct nfs_fh)); | 130 | memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); |
131 | lock->caller = utsname()->nodename; | 131 | lock->caller = utsname()->nodename; |
132 | lock->oh.data = req->a_owner; | 132 | lock->oh.data = req->a_owner; |
133 | lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", | 133 | 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 8d80c990dffd..e703318c41df 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -406,8 +406,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
406 | __be32 ret; | 406 | __be32 ret; |
407 | 407 | ||
408 | dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", | 408 | dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", |
409 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 409 | file_inode(file->f_file)->i_sb->s_id, |
410 | file->f_file->f_path.dentry->d_inode->i_ino, | 410 | file_inode(file->f_file)->i_ino, |
411 | lock->fl.fl_type, lock->fl.fl_pid, | 411 | lock->fl.fl_type, lock->fl.fl_pid, |
412 | (long long)lock->fl.fl_start, | 412 | (long long)lock->fl.fl_start, |
413 | (long long)lock->fl.fl_end, | 413 | (long long)lock->fl.fl_end, |
@@ -513,8 +513,8 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
513 | __be32 ret; | 513 | __be32 ret; |
514 | 514 | ||
515 | dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n", | 515 | dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n", |
516 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 516 | file_inode(file->f_file)->i_sb->s_id, |
517 | file->f_file->f_path.dentry->d_inode->i_ino, | 517 | file_inode(file->f_file)->i_ino, |
518 | lock->fl.fl_type, | 518 | lock->fl.fl_type, |
519 | (long long)lock->fl.fl_start, | 519 | (long long)lock->fl.fl_start, |
520 | (long long)lock->fl.fl_end); | 520 | (long long)lock->fl.fl_end); |
@@ -606,8 +606,8 @@ nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock) | |||
606 | int error; | 606 | int error; |
607 | 607 | ||
608 | dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n", | 608 | dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n", |
609 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 609 | file_inode(file->f_file)->i_sb->s_id, |
610 | file->f_file->f_path.dentry->d_inode->i_ino, | 610 | file_inode(file->f_file)->i_ino, |
611 | lock->fl.fl_pid, | 611 | lock->fl.fl_pid, |
612 | (long long)lock->fl.fl_start, | 612 | (long long)lock->fl.fl_start, |
613 | (long long)lock->fl.fl_end); | 613 | (long long)lock->fl.fl_end); |
@@ -635,8 +635,8 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l | |||
635 | int status = 0; | 635 | int status = 0; |
636 | 636 | ||
637 | dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", | 637 | dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", |
638 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 638 | file_inode(file->f_file)->i_sb->s_id, |
639 | file->f_file->f_path.dentry->d_inode->i_ino, | 639 | file_inode(file->f_file)->i_ino, |
640 | lock->fl.fl_pid, | 640 | lock->fl.fl_pid, |
641 | (long long)lock->fl.fl_start, | 641 | (long long)lock->fl.fl_start, |
642 | (long long)lock->fl.fl_end); | 642 | (long long)lock->fl.fl_end); |
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index 0deb5f6c9dd4..b3a24b07d981 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -45,7 +45,7 @@ static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f) | |||
45 | 45 | ||
46 | static inline void nlm_debug_print_file(char *msg, struct nlm_file *file) | 46 | static inline void nlm_debug_print_file(char *msg, struct nlm_file *file) |
47 | { | 47 | { |
48 | struct inode *inode = file->f_file->f_path.dentry->d_inode; | 48 | struct inode *inode = file_inode(file->f_file); |
49 | 49 | ||
50 | dprintk("lockd: %s %s/%ld\n", | 50 | dprintk("lockd: %s %s/%ld\n", |
51 | msg, inode->i_sb->s_id, inode->i_ino); | 51 | msg, inode->i_sb->s_id, inode->i_ino); |
diff --git a/fs/locks.c b/fs/locks.c index a94e331a52a2..cb424a4fed71 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -334,7 +334,7 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, | |||
334 | start = filp->f_pos; | 334 | start = filp->f_pos; |
335 | break; | 335 | break; |
336 | case SEEK_END: | 336 | case SEEK_END: |
337 | start = i_size_read(filp->f_path.dentry->d_inode); | 337 | start = i_size_read(file_inode(filp)); |
338 | break; | 338 | break; |
339 | default: | 339 | default: |
340 | return -EINVAL; | 340 | return -EINVAL; |
@@ -384,7 +384,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, | |||
384 | start = filp->f_pos; | 384 | start = filp->f_pos; |
385 | break; | 385 | break; |
386 | case SEEK_END: | 386 | case SEEK_END: |
387 | start = i_size_read(filp->f_path.dentry->d_inode); | 387 | start = i_size_read(file_inode(filp)); |
388 | break; | 388 | break; |
389 | default: | 389 | default: |
390 | return -EINVAL; | 390 | return -EINVAL; |
@@ -627,7 +627,7 @@ posix_test_lock(struct file *filp, struct file_lock *fl) | |||
627 | struct file_lock *cfl; | 627 | struct file_lock *cfl; |
628 | 628 | ||
629 | lock_flocks(); | 629 | lock_flocks(); |
630 | for (cfl = filp->f_path.dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) { | 630 | for (cfl = file_inode(filp)->i_flock; cfl; cfl = cfl->fl_next) { |
631 | if (!IS_POSIX(cfl)) | 631 | if (!IS_POSIX(cfl)) |
632 | continue; | 632 | continue; |
633 | if (posix_locks_conflict(fl, cfl)) | 633 | if (posix_locks_conflict(fl, cfl)) |
@@ -708,7 +708,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) | |||
708 | { | 708 | { |
709 | struct file_lock *new_fl = NULL; | 709 | struct file_lock *new_fl = NULL; |
710 | struct file_lock **before; | 710 | struct file_lock **before; |
711 | struct inode * inode = filp->f_path.dentry->d_inode; | 711 | struct inode * inode = file_inode(filp); |
712 | int error = 0; | 712 | int error = 0; |
713 | int found = 0; | 713 | int found = 0; |
714 | 714 | ||
@@ -1002,7 +1002,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str | |||
1002 | int posix_lock_file(struct file *filp, struct file_lock *fl, | 1002 | int posix_lock_file(struct file *filp, struct file_lock *fl, |
1003 | struct file_lock *conflock) | 1003 | struct file_lock *conflock) |
1004 | { | 1004 | { |
1005 | return __posix_lock_file(filp->f_path.dentry->d_inode, fl, conflock); | 1005 | return __posix_lock_file(file_inode(filp), fl, conflock); |
1006 | } | 1006 | } |
1007 | EXPORT_SYMBOL(posix_lock_file); | 1007 | EXPORT_SYMBOL(posix_lock_file); |
1008 | 1008 | ||
@@ -1326,8 +1326,8 @@ int fcntl_getlease(struct file *filp) | |||
1326 | int type = F_UNLCK; | 1326 | int type = F_UNLCK; |
1327 | 1327 | ||
1328 | lock_flocks(); | 1328 | lock_flocks(); |
1329 | time_out_leases(filp->f_path.dentry->d_inode); | 1329 | time_out_leases(file_inode(filp)); |
1330 | for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl); | 1330 | for (fl = file_inode(filp)->i_flock; fl && IS_LEASE(fl); |
1331 | fl = fl->fl_next) { | 1331 | fl = fl->fl_next) { |
1332 | if (fl->fl_file == filp) { | 1332 | if (fl->fl_file == filp) { |
1333 | type = target_leasetype(fl); | 1333 | type = target_leasetype(fl); |
@@ -1843,7 +1843,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, | |||
1843 | if (copy_from_user(&flock, l, sizeof(flock))) | 1843 | if (copy_from_user(&flock, l, sizeof(flock))) |
1844 | goto out; | 1844 | goto out; |
1845 | 1845 | ||
1846 | inode = filp->f_path.dentry->d_inode; | 1846 | inode = file_inode(filp); |
1847 | 1847 | ||
1848 | /* Don't allow mandatory locks on files that may be memory mapped | 1848 | /* Don't allow mandatory locks on files that may be memory mapped |
1849 | * and shared. | 1849 | * and shared. |
@@ -1961,7 +1961,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, | |||
1961 | if (copy_from_user(&flock, l, sizeof(flock))) | 1961 | if (copy_from_user(&flock, l, sizeof(flock))) |
1962 | goto out; | 1962 | goto out; |
1963 | 1963 | ||
1964 | inode = filp->f_path.dentry->d_inode; | 1964 | inode = file_inode(filp); |
1965 | 1965 | ||
1966 | /* Don't allow mandatory locks on files that may be memory mapped | 1966 | /* Don't allow mandatory locks on files that may be memory mapped |
1967 | * and shared. | 1967 | * and shared. |
@@ -2030,7 +2030,7 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner) | |||
2030 | * posix_lock_file(). Another process could be setting a lock on this | 2030 | * posix_lock_file(). Another process could be setting a lock on this |
2031 | * file at the same time, but we wouldn't remove that lock anyway. | 2031 | * file at the same time, but we wouldn't remove that lock anyway. |
2032 | */ | 2032 | */ |
2033 | if (!filp->f_path.dentry->d_inode->i_flock) | 2033 | if (!file_inode(filp)->i_flock) |
2034 | return; | 2034 | return; |
2035 | 2035 | ||
2036 | lock.fl_type = F_UNLCK; | 2036 | lock.fl_type = F_UNLCK; |
@@ -2056,7 +2056,7 @@ EXPORT_SYMBOL(locks_remove_posix); | |||
2056 | */ | 2056 | */ |
2057 | void locks_remove_flock(struct file *filp) | 2057 | void locks_remove_flock(struct file *filp) |
2058 | { | 2058 | { |
2059 | struct inode * inode = filp->f_path.dentry->d_inode; | 2059 | struct inode * inode = file_inode(filp); |
2060 | struct file_lock *fl; | 2060 | struct file_lock *fl; |
2061 | struct file_lock **before; | 2061 | struct file_lock **before; |
2062 | 2062 | ||
@@ -2152,7 +2152,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, | |||
2152 | fl_pid = fl->fl_pid; | 2152 | fl_pid = fl->fl_pid; |
2153 | 2153 | ||
2154 | if (fl->fl_file != NULL) | 2154 | if (fl->fl_file != NULL) |
2155 | inode = fl->fl_file->f_path.dentry->d_inode; | 2155 | inode = file_inode(fl->fl_file); |
2156 | 2156 | ||
2157 | seq_printf(f, "%lld:%s ", id, pfx); | 2157 | seq_printf(f, "%lld:%s ", id, pfx); |
2158 | if (IS_POSIX(fl)) { | 2158 | if (IS_POSIX(fl)) { |
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index 26e4a941532f..b82751082112 100644 --- a/fs/logfs/dir.c +++ b/fs/logfs/dir.c | |||
@@ -284,7 +284,7 @@ static int logfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
284 | #define IMPLICIT_NODES 2 | 284 | #define IMPLICIT_NODES 2 |
285 | static int __logfs_readdir(struct file *file, void *buf, filldir_t filldir) | 285 | static int __logfs_readdir(struct file *file, void *buf, filldir_t filldir) |
286 | { | 286 | { |
287 | struct inode *dir = file->f_dentry->d_inode; | 287 | struct inode *dir = file_inode(file); |
288 | loff_t pos = file->f_pos - IMPLICIT_NODES; | 288 | loff_t pos = file->f_pos - IMPLICIT_NODES; |
289 | struct page *page; | 289 | struct page *page; |
290 | struct logfs_disk_dentry *dd; | 290 | struct logfs_disk_dentry *dd; |
@@ -320,7 +320,7 @@ static int __logfs_readdir(struct file *file, void *buf, filldir_t filldir) | |||
320 | 320 | ||
321 | static int logfs_readdir(struct file *file, void *buf, filldir_t filldir) | 321 | static int logfs_readdir(struct file *file, void *buf, filldir_t filldir) |
322 | { | 322 | { |
323 | struct inode *inode = file->f_dentry->d_inode; | 323 | struct inode *inode = file_inode(file); |
324 | ino_t pino = parent_ino(file->f_dentry); | 324 | ino_t pino = parent_ino(file->f_dentry); |
325 | int err; | 325 | int err; |
326 | 326 | ||
diff --git a/fs/logfs/file.c b/fs/logfs/file.c index 3886cded283c..c2219a6dd3c8 100644 --- a/fs/logfs/file.c +++ b/fs/logfs/file.c | |||
@@ -183,7 +183,7 @@ static int logfs_releasepage(struct page *page, gfp_t only_xfs_uses_this) | |||
183 | 183 | ||
184 | long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 184 | long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
185 | { | 185 | { |
186 | struct inode *inode = file->f_path.dentry->d_inode; | 186 | struct inode *inode = file_inode(file); |
187 | struct logfs_inode *li = logfs_inode(inode); | 187 | struct logfs_inode *li = logfs_inode(inode); |
188 | unsigned int oldflags, flags; | 188 | unsigned int oldflags, flags; |
189 | int err; | 189 | int err; |
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 685b2d981b87..a9ed6f36e6ea 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
@@ -85,7 +85,7 @@ static inline void *minix_next_entry(void *de, struct minix_sb_info *sbi) | |||
85 | static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir) | 85 | static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir) |
86 | { | 86 | { |
87 | unsigned long pos = filp->f_pos; | 87 | unsigned long pos = filp->f_pos; |
88 | struct inode *inode = filp->f_path.dentry->d_inode; | 88 | struct inode *inode = file_inode(filp); |
89 | struct super_block *sb = inode->i_sb; | 89 | struct super_block *sb = inode->i_sb; |
90 | unsigned offset = pos & ~PAGE_CACHE_MASK; | 90 | unsigned offset = pos & ~PAGE_CACHE_MASK; |
91 | unsigned long n = pos >> PAGE_CACHE_SHIFT; | 91 | unsigned long n = pos >> PAGE_CACHE_SHIFT; |
diff --git a/fs/namei.c b/fs/namei.c index 43a97ee1d4c8..dc984fee5532 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -600,14 +600,10 @@ static int complete_walk(struct nameidata *nd) | |||
600 | if (likely(!(nd->flags & LOOKUP_JUMPED))) | 600 | if (likely(!(nd->flags & LOOKUP_JUMPED))) |
601 | return 0; | 601 | return 0; |
602 | 602 | ||
603 | if (likely(!(dentry->d_flags & DCACHE_OP_REVALIDATE))) | 603 | if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) |
604 | return 0; | 604 | return 0; |
605 | 605 | ||
606 | if (likely(!(dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT))) | 606 | status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); |
607 | return 0; | ||
608 | |||
609 | /* Note: we do not d_invalidate() */ | ||
610 | status = d_revalidate(dentry, nd->flags); | ||
611 | if (status > 0) | 607 | if (status > 0) |
612 | return 0; | 608 | return 0; |
613 | 609 | ||
@@ -1342,7 +1338,7 @@ static struct dentry *__lookup_hash(struct qstr *name, | |||
1342 | * small and for now I'd prefer to have fast path as straight as possible. | 1338 | * small and for now I'd prefer to have fast path as straight as possible. |
1343 | * It _is_ time-critical. | 1339 | * It _is_ time-critical. |
1344 | */ | 1340 | */ |
1345 | static int lookup_fast(struct nameidata *nd, struct qstr *name, | 1341 | static int lookup_fast(struct nameidata *nd, |
1346 | struct path *path, struct inode **inode) | 1342 | struct path *path, struct inode **inode) |
1347 | { | 1343 | { |
1348 | struct vfsmount *mnt = nd->path.mnt; | 1344 | struct vfsmount *mnt = nd->path.mnt; |
@@ -1358,7 +1354,7 @@ static int lookup_fast(struct nameidata *nd, struct qstr *name, | |||
1358 | */ | 1354 | */ |
1359 | if (nd->flags & LOOKUP_RCU) { | 1355 | if (nd->flags & LOOKUP_RCU) { |
1360 | unsigned seq; | 1356 | unsigned seq; |
1361 | dentry = __d_lookup_rcu(parent, name, &seq, nd->inode); | 1357 | dentry = __d_lookup_rcu(parent, &nd->last, &seq, nd->inode); |
1362 | if (!dentry) | 1358 | if (!dentry) |
1363 | goto unlazy; | 1359 | goto unlazy; |
1364 | 1360 | ||
@@ -1400,7 +1396,7 @@ unlazy: | |||
1400 | if (unlazy_walk(nd, dentry)) | 1396 | if (unlazy_walk(nd, dentry)) |
1401 | return -ECHILD; | 1397 | return -ECHILD; |
1402 | } else { | 1398 | } else { |
1403 | dentry = __d_lookup(parent, name); | 1399 | dentry = __d_lookup(parent, &nd->last); |
1404 | } | 1400 | } |
1405 | 1401 | ||
1406 | if (unlikely(!dentry)) | 1402 | if (unlikely(!dentry)) |
@@ -1436,8 +1432,7 @@ need_lookup: | |||
1436 | } | 1432 | } |
1437 | 1433 | ||
1438 | /* Fast lookup failed, do it the slow way */ | 1434 | /* Fast lookup failed, do it the slow way */ |
1439 | static int lookup_slow(struct nameidata *nd, struct qstr *name, | 1435 | static int lookup_slow(struct nameidata *nd, struct path *path) |
1440 | struct path *path) | ||
1441 | { | 1436 | { |
1442 | struct dentry *dentry, *parent; | 1437 | struct dentry *dentry, *parent; |
1443 | int err; | 1438 | int err; |
@@ -1446,7 +1441,7 @@ static int lookup_slow(struct nameidata *nd, struct qstr *name, | |||
1446 | BUG_ON(nd->inode != parent->d_inode); | 1441 | BUG_ON(nd->inode != parent->d_inode); |
1447 | 1442 | ||
1448 | mutex_lock(&parent->d_inode->i_mutex); | 1443 | mutex_lock(&parent->d_inode->i_mutex); |
1449 | dentry = __lookup_hash(name, parent, nd->flags); | 1444 | dentry = __lookup_hash(&nd->last, parent, nd->flags); |
1450 | mutex_unlock(&parent->d_inode->i_mutex); | 1445 | mutex_unlock(&parent->d_inode->i_mutex); |
1451 | if (IS_ERR(dentry)) | 1446 | if (IS_ERR(dentry)) |
1452 | return PTR_ERR(dentry); | 1447 | return PTR_ERR(dentry); |
@@ -1519,7 +1514,7 @@ static inline int should_follow_link(struct inode *inode, int follow) | |||
1519 | } | 1514 | } |
1520 | 1515 | ||
1521 | static inline int walk_component(struct nameidata *nd, struct path *path, | 1516 | static inline int walk_component(struct nameidata *nd, struct path *path, |
1522 | struct qstr *name, int type, int follow) | 1517 | int follow) |
1523 | { | 1518 | { |
1524 | struct inode *inode; | 1519 | struct inode *inode; |
1525 | int err; | 1520 | int err; |
@@ -1528,14 +1523,14 @@ static inline int walk_component(struct nameidata *nd, struct path *path, | |||
1528 | * to be able to know about the current root directory and | 1523 | * to be able to know about the current root directory and |
1529 | * parent relationships. | 1524 | * parent relationships. |
1530 | */ | 1525 | */ |
1531 | if (unlikely(type != LAST_NORM)) | 1526 | if (unlikely(nd->last_type != LAST_NORM)) |
1532 | return handle_dots(nd, type); | 1527 | return handle_dots(nd, nd->last_type); |
1533 | err = lookup_fast(nd, name, path, &inode); | 1528 | err = lookup_fast(nd, path, &inode); |
1534 | if (unlikely(err)) { | 1529 | if (unlikely(err)) { |
1535 | if (err < 0) | 1530 | if (err < 0) |
1536 | goto out_err; | 1531 | goto out_err; |
1537 | 1532 | ||
1538 | err = lookup_slow(nd, name, path); | 1533 | err = lookup_slow(nd, path); |
1539 | if (err < 0) | 1534 | if (err < 0) |
1540 | goto out_err; | 1535 | goto out_err; |
1541 | 1536 | ||
@@ -1594,8 +1589,7 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd) | |||
1594 | res = follow_link(&link, nd, &cookie); | 1589 | res = follow_link(&link, nd, &cookie); |
1595 | if (res) | 1590 | if (res) |
1596 | break; | 1591 | break; |
1597 | res = walk_component(nd, path, &nd->last, | 1592 | res = walk_component(nd, path, LOOKUP_FOLLOW); |
1598 | nd->last_type, LOOKUP_FOLLOW); | ||
1599 | put_link(nd, &link, cookie); | 1593 | put_link(nd, &link, cookie); |
1600 | } while (res > 0); | 1594 | } while (res > 0); |
1601 | 1595 | ||
@@ -1802,8 +1796,11 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1802 | } | 1796 | } |
1803 | } | 1797 | } |
1804 | 1798 | ||
1799 | nd->last = this; | ||
1800 | nd->last_type = type; | ||
1801 | |||
1805 | if (!name[len]) | 1802 | if (!name[len]) |
1806 | goto last_component; | 1803 | return 0; |
1807 | /* | 1804 | /* |
1808 | * If it wasn't NUL, we know it was '/'. Skip that | 1805 | * If it wasn't NUL, we know it was '/'. Skip that |
1809 | * slash, and continue until no more slashes. | 1806 | * slash, and continue until no more slashes. |
@@ -1812,10 +1809,11 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1812 | len++; | 1809 | len++; |
1813 | } while (unlikely(name[len] == '/')); | 1810 | } while (unlikely(name[len] == '/')); |
1814 | if (!name[len]) | 1811 | if (!name[len]) |
1815 | goto last_component; | 1812 | return 0; |
1813 | |||
1816 | name += len; | 1814 | name += len; |
1817 | 1815 | ||
1818 | err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW); | 1816 | err = walk_component(nd, &next, LOOKUP_FOLLOW); |
1819 | if (err < 0) | 1817 | if (err < 0) |
1820 | return err; | 1818 | return err; |
1821 | 1819 | ||
@@ -1824,16 +1822,10 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1824 | if (err) | 1822 | if (err) |
1825 | return err; | 1823 | return err; |
1826 | } | 1824 | } |
1827 | if (can_lookup(nd->inode)) | 1825 | if (!can_lookup(nd->inode)) { |
1828 | continue; | 1826 | err = -ENOTDIR; |
1829 | err = -ENOTDIR; | 1827 | break; |
1830 | break; | 1828 | } |
1831 | /* here ends the main loop */ | ||
1832 | |||
1833 | last_component: | ||
1834 | nd->last = this; | ||
1835 | nd->last_type = type; | ||
1836 | return 0; | ||
1837 | } | 1829 | } |
1838 | terminate_walk(nd); | 1830 | terminate_walk(nd); |
1839 | return err; | 1831 | return err; |
@@ -1932,8 +1924,7 @@ static inline int lookup_last(struct nameidata *nd, struct path *path) | |||
1932 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; | 1924 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; |
1933 | 1925 | ||
1934 | nd->flags &= ~LOOKUP_PARENT; | 1926 | nd->flags &= ~LOOKUP_PARENT; |
1935 | return walk_component(nd, path, &nd->last, nd->last_type, | 1927 | return walk_component(nd, path, nd->flags & LOOKUP_FOLLOW); |
1936 | nd->flags & LOOKUP_FOLLOW); | ||
1937 | } | 1928 | } |
1938 | 1929 | ||
1939 | /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ | 1930 | /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ |
@@ -2732,7 +2723,7 @@ static int do_last(struct nameidata *nd, struct path *path, | |||
2732 | if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW)) | 2723 | if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW)) |
2733 | symlink_ok = true; | 2724 | symlink_ok = true; |
2734 | /* we _can_ be in RCU mode here */ | 2725 | /* we _can_ be in RCU mode here */ |
2735 | error = lookup_fast(nd, &nd->last, path, &inode); | 2726 | error = lookup_fast(nd, path, &inode); |
2736 | if (likely(!error)) | 2727 | if (likely(!error)) |
2737 | goto finish_lookup; | 2728 | goto finish_lookup; |
2738 | 2729 | ||
@@ -2778,7 +2769,7 @@ retry_lookup: | |||
2778 | goto out; | 2769 | goto out; |
2779 | 2770 | ||
2780 | if ((*opened & FILE_CREATED) || | 2771 | if ((*opened & FILE_CREATED) || |
2781 | !S_ISREG(file->f_path.dentry->d_inode->i_mode)) | 2772 | !S_ISREG(file_inode(file)->i_mode)) |
2782 | will_truncate = false; | 2773 | will_truncate = false; |
2783 | 2774 | ||
2784 | audit_inode(name, file->f_path.dentry, 0); | 2775 | audit_inode(name, file->f_path.dentry, 0); |
@@ -2941,8 +2932,8 @@ static struct file *path_openat(int dfd, struct filename *pathname, | |||
2941 | int error; | 2932 | int error; |
2942 | 2933 | ||
2943 | file = get_empty_filp(); | 2934 | file = get_empty_filp(); |
2944 | if (!file) | 2935 | if (IS_ERR(file)) |
2945 | return ERR_PTR(-ENFILE); | 2936 | return file; |
2946 | 2937 | ||
2947 | file->f_flags = op->open_flag; | 2938 | file->f_flags = op->open_flag; |
2948 | 2939 | ||
diff --git a/fs/namespace.c b/fs/namespace.c index edac42c6eff2..50ca17d3cb45 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -384,7 +384,7 @@ EXPORT_SYMBOL_GPL(mnt_clone_write); | |||
384 | */ | 384 | */ |
385 | int __mnt_want_write_file(struct file *file) | 385 | int __mnt_want_write_file(struct file *file) |
386 | { | 386 | { |
387 | struct inode *inode = file->f_dentry->d_inode; | 387 | struct inode *inode = file_inode(file); |
388 | 388 | ||
389 | if (!(file->f_mode & FMODE_WRITE) || special_file(inode->i_mode)) | 389 | if (!(file->f_mode & FMODE_WRITE) || special_file(inode->i_mode)) |
390 | return __mnt_want_write(file->f_path.mnt); | 390 | return __mnt_want_write(file->f_path.mnt); |
@@ -1300,24 +1300,6 @@ SYSCALL_DEFINE1(oldumount, char __user *, name) | |||
1300 | 1300 | ||
1301 | #endif | 1301 | #endif |
1302 | 1302 | ||
1303 | static int mount_is_safe(struct path *path) | ||
1304 | { | ||
1305 | if (may_mount()) | ||
1306 | return 0; | ||
1307 | return -EPERM; | ||
1308 | #ifdef notyet | ||
1309 | if (S_ISLNK(path->dentry->d_inode->i_mode)) | ||
1310 | return -EPERM; | ||
1311 | if (path->dentry->d_inode->i_mode & S_ISVTX) { | ||
1312 | if (current_uid() != path->dentry->d_inode->i_uid) | ||
1313 | return -EPERM; | ||
1314 | } | ||
1315 | if (inode_permission(path->dentry->d_inode, MAY_WRITE)) | ||
1316 | return -EPERM; | ||
1317 | return 0; | ||
1318 | #endif | ||
1319 | } | ||
1320 | |||
1321 | static bool mnt_ns_loop(struct path *path) | 1303 | static bool mnt_ns_loop(struct path *path) |
1322 | { | 1304 | { |
1323 | /* Could bind mounting the mount namespace inode cause a | 1305 | /* Could bind mounting the mount namespace inode cause a |
@@ -1640,9 +1622,6 @@ static int do_change_type(struct path *path, int flag) | |||
1640 | int type; | 1622 | int type; |
1641 | int err = 0; | 1623 | int err = 0; |
1642 | 1624 | ||
1643 | if (!may_mount()) | ||
1644 | return -EPERM; | ||
1645 | |||
1646 | if (path->dentry != path->mnt->mnt_root) | 1625 | if (path->dentry != path->mnt->mnt_root) |
1647 | return -EINVAL; | 1626 | return -EINVAL; |
1648 | 1627 | ||
@@ -1676,9 +1655,7 @@ static int do_loopback(struct path *path, const char *old_name, | |||
1676 | LIST_HEAD(umount_list); | 1655 | LIST_HEAD(umount_list); |
1677 | struct path old_path; | 1656 | struct path old_path; |
1678 | struct mount *mnt = NULL, *old; | 1657 | struct mount *mnt = NULL, *old; |
1679 | int err = mount_is_safe(path); | 1658 | int err; |
1680 | if (err) | ||
1681 | return err; | ||
1682 | if (!old_name || !*old_name) | 1659 | if (!old_name || !*old_name) |
1683 | return -EINVAL; | 1660 | return -EINVAL; |
1684 | err = kern_path(old_name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &old_path); | 1661 | err = kern_path(old_name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &old_path); |
@@ -1755,9 +1732,6 @@ static int do_remount(struct path *path, int flags, int mnt_flags, | |||
1755 | struct super_block *sb = path->mnt->mnt_sb; | 1732 | struct super_block *sb = path->mnt->mnt_sb; |
1756 | struct mount *mnt = real_mount(path->mnt); | 1733 | struct mount *mnt = real_mount(path->mnt); |
1757 | 1734 | ||
1758 | if (!capable(CAP_SYS_ADMIN)) | ||
1759 | return -EPERM; | ||
1760 | |||
1761 | if (!check_mnt(mnt)) | 1735 | if (!check_mnt(mnt)) |
1762 | return -EINVAL; | 1736 | return -EINVAL; |
1763 | 1737 | ||
@@ -1771,6 +1745,8 @@ static int do_remount(struct path *path, int flags, int mnt_flags, | |||
1771 | down_write(&sb->s_umount); | 1745 | down_write(&sb->s_umount); |
1772 | if (flags & MS_BIND) | 1746 | if (flags & MS_BIND) |
1773 | err = change_mount_flags(path->mnt, flags); | 1747 | err = change_mount_flags(path->mnt, flags); |
1748 | else if (!capable(CAP_SYS_ADMIN)) | ||
1749 | err = -EPERM; | ||
1774 | else | 1750 | else |
1775 | err = do_remount_sb(sb, flags, data, 0); | 1751 | err = do_remount_sb(sb, flags, data, 0); |
1776 | if (!err) { | 1752 | if (!err) { |
@@ -1803,9 +1779,7 @@ static int do_move_mount(struct path *path, const char *old_name) | |||
1803 | struct path old_path, parent_path; | 1779 | struct path old_path, parent_path; |
1804 | struct mount *p; | 1780 | struct mount *p; |
1805 | struct mount *old; | 1781 | struct mount *old; |
1806 | int err = 0; | 1782 | int err; |
1807 | if (!may_mount()) | ||
1808 | return -EPERM; | ||
1809 | if (!old_name || !*old_name) | 1783 | if (!old_name || !*old_name) |
1810 | return -EINVAL; | 1784 | return -EINVAL; |
1811 | err = kern_path(old_name, LOOKUP_FOLLOW, &old_path); | 1785 | err = kern_path(old_name, LOOKUP_FOLLOW, &old_path); |
@@ -1947,9 +1921,6 @@ static int do_new_mount(struct path *path, const char *fstype, int flags, | |||
1947 | if (!fstype) | 1921 | if (!fstype) |
1948 | return -EINVAL; | 1922 | return -EINVAL; |
1949 | 1923 | ||
1950 | if (!may_mount()) | ||
1951 | return -EPERM; | ||
1952 | |||
1953 | type = get_fs_type(fstype); | 1924 | type = get_fs_type(fstype); |
1954 | if (!type) | 1925 | if (!type) |
1955 | return -ENODEV; | 1926 | return -ENODEV; |
@@ -2263,6 +2234,9 @@ long do_mount(const char *dev_name, const char *dir_name, | |||
2263 | if (retval) | 2234 | if (retval) |
2264 | goto dput_out; | 2235 | goto dput_out; |
2265 | 2236 | ||
2237 | if (!may_mount()) | ||
2238 | return -EPERM; | ||
2239 | |||
2266 | /* Default to relatime unless overriden */ | 2240 | /* Default to relatime unless overriden */ |
2267 | if (!(flags & MS_NOATIME)) | 2241 | if (!(flags & MS_NOATIME)) |
2268 | mnt_flags |= MNT_RELATIME; | 2242 | mnt_flags |= MNT_RELATIME; |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 4117e7b377bb..816326093656 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -593,14 +593,10 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir, | |||
593 | return 1; /* I'm not sure */ | 593 | return 1; /* I'm not sure */ |
594 | 594 | ||
595 | qname.name = __name; | 595 | qname.name = __name; |
596 | qname.hash = full_name_hash(qname.name, qname.len); | ||
597 | |||
598 | if (dentry->d_op && dentry->d_op->d_hash) | ||
599 | if (dentry->d_op->d_hash(dentry, dentry->d_inode, &qname) != 0) | ||
600 | goto end_advance; | ||
601 | |||
602 | newdent = d_lookup(dentry, &qname); | ||
603 | 596 | ||
597 | newdent = d_hash_and_lookup(dentry, &qname); | ||
598 | if (unlikely(IS_ERR(newdent))) | ||
599 | goto end_advance; | ||
604 | if (!newdent) { | 600 | if (!newdent) { |
605 | newdent = d_alloc(dentry, &qname); | 601 | newdent = d_alloc(dentry, &qname); |
606 | if (!newdent) | 602 | if (!newdent) |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index e2be336d1c22..7dafd6899a62 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -538,7 +538,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
538 | if (!ncp_filp) | 538 | if (!ncp_filp) |
539 | goto out; | 539 | goto out; |
540 | error = -ENOTSOCK; | 540 | error = -ENOTSOCK; |
541 | sock_inode = ncp_filp->f_path.dentry->d_inode; | 541 | sock_inode = file_inode(ncp_filp); |
542 | if (!S_ISSOCK(sock_inode->i_mode)) | 542 | if (!S_ISSOCK(sock_inode->i_mode)) |
543 | goto out_fput; | 543 | goto out_fput; |
544 | sock = SOCKET_I(sock_inode); | 544 | sock = SOCKET_I(sock_inode); |
@@ -577,7 +577,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
577 | if (!server->info_filp) | 577 | if (!server->info_filp) |
578 | goto out_bdi; | 578 | goto out_bdi; |
579 | error = -ENOTSOCK; | 579 | error = -ENOTSOCK; |
580 | sock_inode = server->info_filp->f_path.dentry->d_inode; | 580 | sock_inode = file_inode(server->info_filp); |
581 | if (!S_ISSOCK(sock_inode->i_mode)) | 581 | if (!S_ISSOCK(sock_inode->i_mode)) |
582 | goto out_fput2; | 582 | goto out_fput2; |
583 | info_sock = SOCKET_I(sock_inode); | 583 | info_sock = SOCKET_I(sock_inode); |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index d44318d27504..60426ccb3b65 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -811,7 +811,7 @@ outrel: | |||
811 | 811 | ||
812 | long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 812 | long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
813 | { | 813 | { |
814 | struct inode *inode = filp->f_dentry->d_inode; | 814 | struct inode *inode = file_inode(filp); |
815 | struct ncp_server *server = NCP_SERVER(inode); | 815 | struct ncp_server *server = NCP_SERVER(inode); |
816 | kuid_t uid = current_uid(); | 816 | kuid_t uid = current_uid(); |
817 | int need_drop_write = 0; | 817 | int need_drop_write = 0; |
@@ -822,7 +822,7 @@ long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
822 | case NCP_IOC_CONN_LOGGED_IN: | 822 | case NCP_IOC_CONN_LOGGED_IN: |
823 | case NCP_IOC_SETROOT: | 823 | case NCP_IOC_SETROOT: |
824 | if (!capable(CAP_SYS_ADMIN)) { | 824 | if (!capable(CAP_SYS_ADMIN)) { |
825 | ret = -EACCES; | 825 | ret = -EPERM; |
826 | goto out; | 826 | goto out; |
827 | } | 827 | } |
828 | break; | 828 | break; |
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c index 63d14a99483d..ee24df5af1f9 100644 --- a/fs/ncpfs/mmap.c +++ b/fs/ncpfs/mmap.c | |||
@@ -105,7 +105,7 @@ static const struct vm_operations_struct ncp_file_mmap = | |||
105 | /* This is used for a general mmap of a ncp file */ | 105 | /* This is used for a general mmap of a ncp file */ |
106 | int ncp_mmap(struct file *file, struct vm_area_struct *vma) | 106 | int ncp_mmap(struct file *file, struct vm_area_struct *vma) |
107 | { | 107 | { |
108 | struct inode *inode = file->f_path.dentry->d_inode; | 108 | struct inode *inode = file_inode(file); |
109 | 109 | ||
110 | DPRINTK("ncp_mmap: called\n"); | 110 | DPRINTK("ncp_mmap: called\n"); |
111 | 111 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 1b2d7eb93796..f23f455be42b 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -281,7 +281,7 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des | |||
281 | 281 | ||
282 | for (i = 0; i < array->size; i++) { | 282 | for (i = 0; i < array->size; i++) { |
283 | if (array->array[i].cookie == *desc->dir_cookie) { | 283 | if (array->array[i].cookie == *desc->dir_cookie) { |
284 | struct nfs_inode *nfsi = NFS_I(desc->file->f_path.dentry->d_inode); | 284 | struct nfs_inode *nfsi = NFS_I(file_inode(desc->file)); |
285 | struct nfs_open_dir_context *ctx = desc->file->private_data; | 285 | struct nfs_open_dir_context *ctx = desc->file->private_data; |
286 | 286 | ||
287 | new_pos = desc->current_index + i; | 287 | new_pos = desc->current_index + i; |
@@ -629,7 +629,7 @@ out: | |||
629 | static | 629 | static |
630 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) | 630 | int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) |
631 | { | 631 | { |
632 | struct inode *inode = desc->file->f_path.dentry->d_inode; | 632 | struct inode *inode = file_inode(desc->file); |
633 | int ret; | 633 | int ret; |
634 | 634 | ||
635 | ret = nfs_readdir_xdr_to_array(desc, page, inode); | 635 | ret = nfs_readdir_xdr_to_array(desc, page, inode); |
@@ -660,7 +660,7 @@ void cache_page_release(nfs_readdir_descriptor_t *desc) | |||
660 | static | 660 | static |
661 | struct page *get_cache_page(nfs_readdir_descriptor_t *desc) | 661 | struct page *get_cache_page(nfs_readdir_descriptor_t *desc) |
662 | { | 662 | { |
663 | return read_cache_page(desc->file->f_path.dentry->d_inode->i_mapping, | 663 | return read_cache_page(file_inode(desc->file)->i_mapping, |
664 | desc->page_index, (filler_t *)nfs_readdir_filler, desc); | 664 | desc->page_index, (filler_t *)nfs_readdir_filler, desc); |
665 | } | 665 | } |
666 | 666 | ||
@@ -764,7 +764,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
764 | { | 764 | { |
765 | struct page *page = NULL; | 765 | struct page *page = NULL; |
766 | int status; | 766 | int status; |
767 | struct inode *inode = desc->file->f_path.dentry->d_inode; | 767 | struct inode *inode = file_inode(desc->file); |
768 | struct nfs_open_dir_context *ctx = desc->file->private_data; | 768 | struct nfs_open_dir_context *ctx = desc->file->private_data; |
769 | 769 | ||
770 | dfprintk(DIRCACHE, "NFS: uncached_readdir() searching for cookie %Lu\n", | 770 | dfprintk(DIRCACHE, "NFS: uncached_readdir() searching for cookie %Lu\n", |
@@ -1136,6 +1136,45 @@ out_error: | |||
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | /* | 1138 | /* |
1139 | * A weaker form of d_revalidate for revalidating just the dentry->d_inode | ||
1140 | * when we don't really care about the dentry name. This is called when a | ||
1141 | * pathwalk ends on a dentry that was not found via a normal lookup in the | ||
1142 | * parent dir (e.g.: ".", "..", procfs symlinks or mountpoint traversals). | ||
1143 | * | ||
1144 | * In this situation, we just want to verify that the inode itself is OK | ||
1145 | * since the dentry might have changed on the server. | ||
1146 | */ | ||
1147 | static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags) | ||
1148 | { | ||
1149 | int error; | ||
1150 | struct inode *inode = dentry->d_inode; | ||
1151 | |||
1152 | /* | ||
1153 | * I believe we can only get a negative dentry here in the case of a | ||
1154 | * procfs-style symlink. Just assume it's correct for now, but we may | ||
1155 | * eventually need to do something more here. | ||
1156 | */ | ||
1157 | if (!inode) { | ||
1158 | dfprintk(LOOKUPCACHE, "%s: %s/%s has negative inode\n", | ||
1159 | __func__, dentry->d_parent->d_name.name, | ||
1160 | dentry->d_name.name); | ||
1161 | return 1; | ||
1162 | } | ||
1163 | |||
1164 | if (is_bad_inode(inode)) { | ||
1165 | dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n", | ||
1166 | __func__, dentry->d_parent->d_name.name, | ||
1167 | dentry->d_name.name); | ||
1168 | return 0; | ||
1169 | } | ||
1170 | |||
1171 | error = nfs_revalidate_inode(NFS_SERVER(inode), inode); | ||
1172 | dfprintk(LOOKUPCACHE, "NFS: %s: inode %lu is %s\n", | ||
1173 | __func__, inode->i_ino, error ? "invalid" : "valid"); | ||
1174 | return !error; | ||
1175 | } | ||
1176 | |||
1177 | /* | ||
1139 | * This is called from dput() when d_count is going to 0. | 1178 | * This is called from dput() when d_count is going to 0. |
1140 | */ | 1179 | */ |
1141 | static int nfs_dentry_delete(const struct dentry *dentry) | 1180 | static int nfs_dentry_delete(const struct dentry *dentry) |
@@ -1202,6 +1241,7 @@ static void nfs_d_release(struct dentry *dentry) | |||
1202 | 1241 | ||
1203 | const struct dentry_operations nfs_dentry_operations = { | 1242 | const struct dentry_operations nfs_dentry_operations = { |
1204 | .d_revalidate = nfs_lookup_revalidate, | 1243 | .d_revalidate = nfs_lookup_revalidate, |
1244 | .d_weak_revalidate = nfs_weak_revalidate, | ||
1205 | .d_delete = nfs_dentry_delete, | 1245 | .d_delete = nfs_dentry_delete, |
1206 | .d_iput = nfs_dentry_iput, | 1246 | .d_iput = nfs_dentry_iput, |
1207 | .d_automount = nfs_d_automount, | 1247 | .d_automount = nfs_d_automount, |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 3c2b893665ba..29f4a48a0ee6 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -292,7 +292,7 @@ static int | |||
292 | nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 292 | nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
293 | { | 293 | { |
294 | int ret; | 294 | int ret; |
295 | struct inode *inode = file->f_path.dentry->d_inode; | 295 | struct inode *inode = file_inode(file); |
296 | 296 | ||
297 | do { | 297 | do { |
298 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 298 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index b9623d19d599..dc0f98dfa717 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -765,7 +765,7 @@ out: | |||
765 | static ssize_t | 765 | static ssize_t |
766 | idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | 766 | idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) |
767 | { | 767 | { |
768 | struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); | 768 | struct rpc_inode *rpci = RPC_I(file_inode(filp)); |
769 | struct idmap *idmap = (struct idmap *)rpci->private; | 769 | struct idmap *idmap = (struct idmap *)rpci->private; |
770 | struct key_construction *cons; | 770 | struct key_construction *cons; |
771 | struct idmap_msg im; | 771 | struct idmap_msg im; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 468ba8bf0f56..b586fe9af475 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -711,7 +711,7 @@ EXPORT_SYMBOL_GPL(put_nfs_open_context); | |||
711 | */ | 711 | */ |
712 | void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) | 712 | void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx) |
713 | { | 713 | { |
714 | struct inode *inode = filp->f_path.dentry->d_inode; | 714 | struct inode *inode = file_inode(filp); |
715 | struct nfs_inode *nfsi = NFS_I(inode); | 715 | struct nfs_inode *nfsi = NFS_I(inode); |
716 | 716 | ||
717 | filp->private_data = get_nfs_open_context(ctx); | 717 | filp->private_data = get_nfs_open_context(ctx); |
@@ -744,7 +744,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c | |||
744 | 744 | ||
745 | static void nfs_file_clear_open_context(struct file *filp) | 745 | static void nfs_file_clear_open_context(struct file *filp) |
746 | { | 746 | { |
747 | struct inode *inode = filp->f_path.dentry->d_inode; | 747 | struct inode *inode = file_inode(filp); |
748 | struct nfs_open_context *ctx = nfs_file_open_context(filp); | 748 | struct nfs_open_context *ctx = nfs_file_open_context(filp); |
749 | 749 | ||
750 | if (ctx) { | 750 | if (ctx) { |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 70efb63b1e42..43ea96ced28c 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -872,7 +872,7 @@ static void nfs3_proc_commit_setup(struct nfs_commit_data *data, struct rpc_mess | |||
872 | static int | 872 | static int |
873 | nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl) | 873 | nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl) |
874 | { | 874 | { |
875 | struct inode *inode = filp->f_path.dentry->d_inode; | 875 | struct inode *inode = file_inode(filp); |
876 | 876 | ||
877 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); | 877 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); |
878 | } | 878 | } |
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 08ddcccb8887..13e6bb3e3fe5 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -94,7 +94,7 @@ static int | |||
94 | nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 94 | nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
95 | { | 95 | { |
96 | int ret; | 96 | int ret; |
97 | struct inode *inode = file->f_path.dentry->d_inode; | 97 | struct inode *inode = file_inode(file); |
98 | 98 | ||
99 | do { | 99 | do { |
100 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 100 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index 84d2e9e2f313..569b166cc050 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
@@ -28,7 +28,7 @@ static struct file_system_type nfs4_remote_fs_type = { | |||
28 | .name = "nfs4", | 28 | .name = "nfs4", |
29 | .mount = nfs4_remote_mount, | 29 | .mount = nfs4_remote_mount, |
30 | .kill_sb = nfs_kill_super, | 30 | .kill_sb = nfs_kill_super, |
31 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 31 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static struct file_system_type nfs4_remote_referral_fs_type = { | 34 | static struct file_system_type nfs4_remote_referral_fs_type = { |
@@ -36,7 +36,7 @@ static struct file_system_type nfs4_remote_referral_fs_type = { | |||
36 | .name = "nfs4", | 36 | .name = "nfs4", |
37 | .mount = nfs4_remote_referral_mount, | 37 | .mount = nfs4_remote_referral_mount, |
38 | .kill_sb = nfs_kill_super, | 38 | .kill_sb = nfs_kill_super, |
39 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 39 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct file_system_type nfs4_referral_fs_type = { | 42 | struct file_system_type nfs4_referral_fs_type = { |
@@ -44,7 +44,7 @@ struct file_system_type nfs4_referral_fs_type = { | |||
44 | .name = "nfs4", | 44 | .name = "nfs4", |
45 | .mount = nfs4_referral_mount, | 45 | .mount = nfs4_referral_mount, |
46 | .kill_sb = nfs_kill_super, | 46 | .kill_sb = nfs_kill_super, |
47 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 47 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static const struct super_operations nfs4_sops = { | 50 | static const struct super_operations nfs4_sops = { |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index f084dac948e1..fc8de9016acf 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -662,7 +662,7 @@ nfs_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg) | |||
662 | static int | 662 | static int |
663 | nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) | 663 | nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl) |
664 | { | 664 | { |
665 | struct inode *inode = filp->f_path.dentry->d_inode; | 665 | struct inode *inode = file_inode(filp); |
666 | 666 | ||
667 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); | 667 | return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl); |
668 | } | 668 | } |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index befbae0cce41..a9dc5fc29955 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -291,7 +291,7 @@ struct file_system_type nfs_fs_type = { | |||
291 | .name = "nfs", | 291 | .name = "nfs", |
292 | .mount = nfs_fs_mount, | 292 | .mount = nfs_fs_mount, |
293 | .kill_sb = nfs_kill_super, | 293 | .kill_sb = nfs_kill_super, |
294 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 294 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
295 | }; | 295 | }; |
296 | EXPORT_SYMBOL_GPL(nfs_fs_type); | 296 | EXPORT_SYMBOL_GPL(nfs_fs_type); |
297 | 297 | ||
@@ -300,7 +300,7 @@ struct file_system_type nfs_xdev_fs_type = { | |||
300 | .name = "nfs", | 300 | .name = "nfs", |
301 | .mount = nfs_xdev_mount, | 301 | .mount = nfs_xdev_mount, |
302 | .kill_sb = nfs_kill_super, | 302 | .kill_sb = nfs_kill_super, |
303 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 303 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
304 | }; | 304 | }; |
305 | 305 | ||
306 | const struct super_operations nfs_sops = { | 306 | const struct super_operations nfs_sops = { |
@@ -330,7 +330,7 @@ struct file_system_type nfs4_fs_type = { | |||
330 | .name = "nfs4", | 330 | .name = "nfs4", |
331 | .mount = nfs_fs_mount, | 331 | .mount = nfs_fs_mount, |
332 | .kill_sb = nfs_kill_super, | 332 | .kill_sb = nfs_kill_super, |
333 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 333 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
334 | }; | 334 | }; |
335 | EXPORT_SYMBOL_GPL(nfs4_fs_type); | 335 | EXPORT_SYMBOL_GPL(nfs4_fs_type); |
336 | 336 | ||
diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c index e761ee95617f..497584c70366 100644 --- a/fs/nfsd/fault_inject.c +++ b/fs/nfsd/fault_inject.c | |||
@@ -101,7 +101,7 @@ static ssize_t fault_inject_read(struct file *file, char __user *buf, | |||
101 | loff_t pos = *ppos; | 101 | loff_t pos = *ppos; |
102 | 102 | ||
103 | if (!pos) | 103 | if (!pos) |
104 | nfsd_inject_get(file->f_dentry->d_inode->i_private, &val); | 104 | nfsd_inject_get(file_inode(file)->i_private, &val); |
105 | size = scnprintf(read_buf, sizeof(read_buf), "%llu\n", val); | 105 | size = scnprintf(read_buf, sizeof(read_buf), "%llu\n", val); |
106 | 106 | ||
107 | if (pos < 0) | 107 | if (pos < 0) |
@@ -133,10 +133,10 @@ static ssize_t fault_inject_write(struct file *file, const char __user *buf, | |||
133 | 133 | ||
134 | size = rpc_pton(net, write_buf, size, (struct sockaddr *)&sa, sizeof(sa)); | 134 | size = rpc_pton(net, write_buf, size, (struct sockaddr *)&sa, sizeof(sa)); |
135 | if (size > 0) | 135 | if (size > 0) |
136 | nfsd_inject_set_client(file->f_dentry->d_inode->i_private, &sa, size); | 136 | nfsd_inject_set_client(file_inode(file)->i_private, &sa, size); |
137 | else { | 137 | else { |
138 | val = simple_strtoll(write_buf, NULL, 0); | 138 | val = simple_strtoll(write_buf, NULL, 0); |
139 | nfsd_inject_set(file->f_dentry->d_inode->i_private, val); | 139 | nfsd_inject_set(file_inode(file)->i_private, val); |
140 | } | 140 | } |
141 | return len; /* on success, claim we got the whole input */ | 141 | return len; /* on success, claim we got the whole input */ |
142 | } | 142 | } |
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 9170861c804a..95d76dc6c5da 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -45,6 +45,10 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, | |||
45 | RETURN_STATUS(nfserr_inval); | 45 | RETURN_STATUS(nfserr_inval); |
46 | resp->mask = argp->mask; | 46 | resp->mask = argp->mask; |
47 | 47 | ||
48 | nfserr = fh_getattr(fh, &resp->stat); | ||
49 | if (nfserr) | ||
50 | goto fail; | ||
51 | |||
48 | if (resp->mask & (NFS_ACL|NFS_ACLCNT)) { | 52 | if (resp->mask & (NFS_ACL|NFS_ACLCNT)) { |
49 | acl = nfsd_get_posix_acl(fh, ACL_TYPE_ACCESS); | 53 | acl = nfsd_get_posix_acl(fh, ACL_TYPE_ACCESS); |
50 | if (IS_ERR(acl)) { | 54 | if (IS_ERR(acl)) { |
@@ -115,6 +119,9 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, | |||
115 | nfserr = nfserrno( nfsd_set_posix_acl( | 119 | nfserr = nfserrno( nfsd_set_posix_acl( |
116 | fh, ACL_TYPE_DEFAULT, argp->acl_default) ); | 120 | fh, ACL_TYPE_DEFAULT, argp->acl_default) ); |
117 | } | 121 | } |
122 | if (!nfserr) { | ||
123 | nfserr = fh_getattr(fh, &resp->stat); | ||
124 | } | ||
118 | 125 | ||
119 | /* argp->acl_{access,default} may have been allocated in | 126 | /* argp->acl_{access,default} may have been allocated in |
120 | nfssvc_decode_setaclargs. */ | 127 | nfssvc_decode_setaclargs. */ |
@@ -129,10 +136,15 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, | |||
129 | static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp, | 136 | static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp, |
130 | struct nfsd_fhandle *argp, struct nfsd_attrstat *resp) | 137 | struct nfsd_fhandle *argp, struct nfsd_attrstat *resp) |
131 | { | 138 | { |
139 | __be32 nfserr; | ||
132 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); | 140 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); |
133 | 141 | ||
134 | fh_copy(&resp->fh, &argp->fh); | 142 | fh_copy(&resp->fh, &argp->fh); |
135 | return fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); | 143 | nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
144 | if (nfserr) | ||
145 | return nfserr; | ||
146 | nfserr = fh_getattr(&resp->fh, &resp->stat); | ||
147 | return nfserr; | ||
136 | } | 148 | } |
137 | 149 | ||
138 | /* | 150 | /* |
@@ -150,6 +162,9 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessarg | |||
150 | fh_copy(&resp->fh, &argp->fh); | 162 | fh_copy(&resp->fh, &argp->fh); |
151 | resp->access = argp->access; | 163 | resp->access = argp->access; |
152 | nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL); | 164 | nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL); |
165 | if (nfserr) | ||
166 | return nfserr; | ||
167 | nfserr = fh_getattr(&resp->fh, &resp->stat); | ||
153 | return nfserr; | 168 | return nfserr; |
154 | } | 169 | } |
155 | 170 | ||
@@ -243,7 +258,7 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, | |||
243 | return 0; | 258 | return 0; |
244 | inode = dentry->d_inode; | 259 | inode = dentry->d_inode; |
245 | 260 | ||
246 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); | 261 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); |
247 | *p++ = htonl(resp->mask); | 262 | *p++ = htonl(resp->mask); |
248 | if (!xdr_ressize_check(rqstp, p)) | 263 | if (!xdr_ressize_check(rqstp, p)) |
249 | return 0; | 264 | return 0; |
@@ -274,7 +289,7 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, | |||
274 | static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p, | 289 | static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p, |
275 | struct nfsd_attrstat *resp) | 290 | struct nfsd_attrstat *resp) |
276 | { | 291 | { |
277 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); | 292 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); |
278 | return xdr_ressize_check(rqstp, p); | 293 | return xdr_ressize_check(rqstp, p); |
279 | } | 294 | } |
280 | 295 | ||
@@ -282,7 +297,7 @@ static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p, | |||
282 | static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, | 297 | static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, |
283 | struct nfsd3_accessres *resp) | 298 | struct nfsd3_accessres *resp) |
284 | { | 299 | { |
285 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); | 300 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); |
286 | *p++ = htonl(resp->access); | 301 | *p++ = htonl(resp->access); |
287 | return xdr_ressize_check(rqstp, p); | 302 | return xdr_ressize_check(rqstp, p); |
288 | } | 303 | } |
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 1fc02dfdc5c4..401289913130 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c | |||
@@ -43,7 +43,6 @@ static __be32 | |||
43 | nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | 43 | nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, |
44 | struct nfsd3_attrstat *resp) | 44 | struct nfsd3_attrstat *resp) |
45 | { | 45 | { |
46 | int err; | ||
47 | __be32 nfserr; | 46 | __be32 nfserr; |
48 | 47 | ||
49 | dprintk("nfsd: GETATTR(3) %s\n", | 48 | dprintk("nfsd: GETATTR(3) %s\n", |
@@ -55,9 +54,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | |||
55 | if (nfserr) | 54 | if (nfserr) |
56 | RETURN_STATUS(nfserr); | 55 | RETURN_STATUS(nfserr); |
57 | 56 | ||
58 | err = vfs_getattr(resp->fh.fh_export->ex_path.mnt, | 57 | nfserr = fh_getattr(&resp->fh, &resp->stat); |
59 | resp->fh.fh_dentry, &resp->stat); | ||
60 | nfserr = nfserrno(err); | ||
61 | 58 | ||
62 | RETURN_STATUS(nfserr); | 59 | RETURN_STATUS(nfserr); |
63 | } | 60 | } |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 925c944bc0bc..14d9ecb96cff 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "xdr3.h" | 11 | #include "xdr3.h" |
12 | #include "auth.h" | 12 | #include "auth.h" |
13 | #include "netns.h" | 13 | #include "netns.h" |
14 | #include "vfs.h" | ||
14 | 15 | ||
15 | #define NFSDDBG_FACILITY NFSDDBG_XDR | 16 | #define NFSDDBG_FACILITY NFSDDBG_XDR |
16 | 17 | ||
@@ -206,10 +207,10 @@ encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) | |||
206 | { | 207 | { |
207 | struct dentry *dentry = fhp->fh_dentry; | 208 | struct dentry *dentry = fhp->fh_dentry; |
208 | if (dentry && dentry->d_inode) { | 209 | if (dentry && dentry->d_inode) { |
209 | int err; | 210 | __be32 err; |
210 | struct kstat stat; | 211 | struct kstat stat; |
211 | 212 | ||
212 | err = vfs_getattr(fhp->fh_export->ex_path.mnt, dentry, &stat); | 213 | err = fh_getattr(fhp, &stat); |
213 | if (!err) { | 214 | if (!err) { |
214 | *p++ = xdr_one; /* attributes follow */ | 215 | *p++ = xdr_one; /* attributes follow */ |
215 | lease_get_mtime(dentry->d_inode, &stat.mtime); | 216 | lease_get_mtime(dentry->d_inode, &stat.mtime); |
@@ -256,13 +257,12 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) | |||
256 | */ | 257 | */ |
257 | void fill_post_wcc(struct svc_fh *fhp) | 258 | void fill_post_wcc(struct svc_fh *fhp) |
258 | { | 259 | { |
259 | int err; | 260 | __be32 err; |
260 | 261 | ||
261 | if (fhp->fh_post_saved) | 262 | if (fhp->fh_post_saved) |
262 | printk("nfsd: inode locked twice during operation.\n"); | 263 | printk("nfsd: inode locked twice during operation.\n"); |
263 | 264 | ||
264 | err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, | 265 | err = fh_getattr(fhp, &fhp->fh_post_attr); |
265 | &fhp->fh_post_attr); | ||
266 | fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; | 266 | fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; |
267 | if (err) { | 267 | if (err) { |
268 | fhp->fh_post_saved = 0; | 268 | fhp->fh_post_saved = 0; |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2d1d06bae3a7..8ca6d17f6cf3 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -2015,7 +2015,7 @@ static int get_parent_attributes(struct svc_export *exp, struct kstat *stat) | |||
2015 | if (path.dentry != path.mnt->mnt_root) | 2015 | if (path.dentry != path.mnt->mnt_root) |
2016 | break; | 2016 | break; |
2017 | } | 2017 | } |
2018 | err = vfs_getattr(path.mnt, path.dentry, stat); | 2018 | err = vfs_getattr(&path, stat); |
2019 | path_put(&path); | 2019 | path_put(&path); |
2020 | return err; | 2020 | return err; |
2021 | } | 2021 | } |
@@ -2068,7 +2068,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
2068 | goto out; | 2068 | goto out; |
2069 | } | 2069 | } |
2070 | 2070 | ||
2071 | err = vfs_getattr(exp->ex_path.mnt, dentry, &stat); | 2071 | err = vfs_getattr(&path, &stat); |
2072 | if (err) | 2072 | if (err) |
2073 | goto out_nfserr; | 2073 | goto out_nfserr; |
2074 | if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | | 2074 | if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 74934284d9a7..2db7021b01ae 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -85,7 +85,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
85 | 85 | ||
86 | static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) | 86 | static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) |
87 | { | 87 | { |
88 | ino_t ino = file->f_path.dentry->d_inode->i_ino; | 88 | ino_t ino = file_inode(file)->i_ino; |
89 | char *data; | 89 | char *data; |
90 | ssize_t rv; | 90 | ssize_t rv; |
91 | 91 | ||
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index aad6d457b9e8..54c6b3d3cc79 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -26,17 +26,13 @@ static __be32 | |||
26 | nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) | 26 | nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) |
27 | { | 27 | { |
28 | if (err) return err; | 28 | if (err) return err; |
29 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, | 29 | return fh_getattr(&resp->fh, &resp->stat); |
30 | resp->fh.fh_dentry, | ||
31 | &resp->stat)); | ||
32 | } | 30 | } |
33 | static __be32 | 31 | static __be32 |
34 | nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) | 32 | nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) |
35 | { | 33 | { |
36 | if (err) return err; | 34 | if (err) return err; |
37 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, | 35 | return fh_getattr(&resp->fh, &resp->stat); |
38 | resp->fh.fh_dentry, | ||
39 | &resp->stat)); | ||
40 | } | 36 | } |
41 | /* | 37 | /* |
42 | * Get a file's attributes | 38 | * Get a file's attributes |
@@ -150,9 +146,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, | |||
150 | &resp->count); | 146 | &resp->count); |
151 | 147 | ||
152 | if (nfserr) return nfserr; | 148 | if (nfserr) return nfserr; |
153 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, | 149 | return fh_getattr(&resp->fh, &resp->stat); |
154 | resp->fh.fh_dentry, | ||
155 | &resp->stat)); | ||
156 | } | 150 | } |
157 | 151 | ||
158 | /* | 152 | /* |
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index 4201ede0ec91..9c769a47ac5a 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "vfs.h" | ||
7 | #include "xdr.h" | 8 | #include "xdr.h" |
8 | #include "auth.h" | 9 | #include "auth.h" |
9 | 10 | ||
@@ -196,11 +197,9 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, | |||
196 | } | 197 | } |
197 | 198 | ||
198 | /* Helper function for NFSv2 ACL code */ | 199 | /* Helper function for NFSv2 ACL code */ |
199 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) | 200 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat) |
200 | { | 201 | { |
201 | struct kstat stat; | 202 | return encode_fattr(rqstp, p, fhp, stat); |
202 | vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &stat); | ||
203 | return encode_fattr(rqstp, p, fhp, &stat); | ||
204 | } | 203 | } |
205 | 204 | ||
206 | /* | 205 | /* |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 31ff1d642e31..2a7eb536de0b 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -979,7 +979,7 @@ static void kill_suid(struct dentry *dentry) | |||
979 | */ | 979 | */ |
980 | static int wait_for_concurrent_writes(struct file *file) | 980 | static int wait_for_concurrent_writes(struct file *file) |
981 | { | 981 | { |
982 | struct inode *inode = file->f_path.dentry->d_inode; | 982 | struct inode *inode = file_inode(file); |
983 | static ino_t last_ino; | 983 | static ino_t last_ino; |
984 | static dev_t last_dev; | 984 | static dev_t last_dev; |
985 | int err = 0; | 985 | int err = 0; |
@@ -1070,7 +1070,7 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1070 | if (err) | 1070 | if (err) |
1071 | return err; | 1071 | return err; |
1072 | 1072 | ||
1073 | inode = file->f_path.dentry->d_inode; | 1073 | inode = file_inode(file); |
1074 | 1074 | ||
1075 | /* Get readahead parameters */ | 1075 | /* Get readahead parameters */ |
1076 | ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino); | 1076 | ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino); |
@@ -1957,7 +1957,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, | |||
1957 | offset = *offsetp; | 1957 | offset = *offsetp; |
1958 | 1958 | ||
1959 | while (1) { | 1959 | while (1) { |
1960 | struct inode *dir_inode = file->f_path.dentry->d_inode; | 1960 | struct inode *dir_inode = file_inode(file); |
1961 | unsigned int reclen; | 1961 | unsigned int reclen; |
1962 | 1962 | ||
1963 | cdp->err = nfserr_eof; /* will be cleared on successful read */ | 1963 | cdp->err = nfserr_eof; /* will be cleared on successful read */ |
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index 359594c393d2..5b5894159f22 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #define LINUX_NFSD_VFS_H | 6 | #define LINUX_NFSD_VFS_H |
7 | 7 | ||
8 | #include "nfsfh.h" | 8 | #include "nfsfh.h" |
9 | #include "nfsd.h" | ||
9 | 10 | ||
10 | /* | 11 | /* |
11 | * Flags for nfsd_permission | 12 | * Flags for nfsd_permission |
@@ -125,4 +126,11 @@ static inline void fh_drop_write(struct svc_fh *fh) | |||
125 | } | 126 | } |
126 | } | 127 | } |
127 | 128 | ||
129 | static inline __be32 fh_getattr(struct svc_fh *fh, struct kstat *stat) | ||
130 | { | ||
131 | struct path p = {.mnt = fh->fh_export->ex_path.mnt, | ||
132 | .dentry = fh->fh_dentry}; | ||
133 | return nfserrno(vfs_getattr(&p, stat)); | ||
134 | } | ||
135 | |||
128 | #endif /* LINUX_NFSD_VFS_H */ | 136 | #endif /* LINUX_NFSD_VFS_H */ |
diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h index 53b1863dd8f6..4f0481d63804 100644 --- a/fs/nfsd/xdr.h +++ b/fs/nfsd/xdr.h | |||
@@ -167,7 +167,7 @@ int nfssvc_encode_entry(void *, const char *name, | |||
167 | int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); | 167 | int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); |
168 | 168 | ||
169 | /* Helper functions for NFSv2 ACL code */ | 169 | /* Helper functions for NFSv2 ACL code */ |
170 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp); | 170 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat); |
171 | __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp); | 171 | __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp); |
172 | 172 | ||
173 | #endif /* LINUX_NFSD_H */ | 173 | #endif /* LINUX_NFSD_H */ |
diff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h index 7df980eb0562..b6d5542a4ac8 100644 --- a/fs/nfsd/xdr3.h +++ b/fs/nfsd/xdr3.h | |||
@@ -136,6 +136,7 @@ struct nfsd3_accessres { | |||
136 | __be32 status; | 136 | __be32 status; |
137 | struct svc_fh fh; | 137 | struct svc_fh fh; |
138 | __u32 access; | 138 | __u32 access; |
139 | struct kstat stat; | ||
139 | }; | 140 | }; |
140 | 141 | ||
141 | struct nfsd3_readlinkres { | 142 | struct nfsd3_readlinkres { |
@@ -225,6 +226,7 @@ struct nfsd3_getaclres { | |||
225 | int mask; | 226 | int mask; |
226 | struct posix_acl *acl_access; | 227 | struct posix_acl *acl_access; |
227 | struct posix_acl *acl_default; | 228 | struct posix_acl *acl_default; |
229 | struct kstat stat; | ||
228 | }; | 230 | }; |
229 | 231 | ||
230 | /* dummy type for release */ | 232 | /* dummy type for release */ |
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index df1a7fb238d1..f30b017740a7 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -259,7 +259,7 @@ static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode *inode) | |||
259 | static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 259 | static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
260 | { | 260 | { |
261 | loff_t pos = filp->f_pos; | 261 | loff_t pos = filp->f_pos; |
262 | struct inode *inode = filp->f_dentry->d_inode; | 262 | struct inode *inode = file_inode(filp); |
263 | struct super_block *sb = inode->i_sb; | 263 | struct super_block *sb = inode->i_sb; |
264 | unsigned int offset = pos & ~PAGE_CACHE_MASK; | 264 | unsigned int offset = pos & ~PAGE_CACHE_MASK; |
265 | unsigned long n = pos >> PAGE_CACHE_SHIFT; | 265 | unsigned long n = pos >> PAGE_CACHE_SHIFT; |
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index bec4af6eab13..08fdb77852ac 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c | |||
@@ -67,7 +67,7 @@ int nilfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
67 | static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 67 | static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
68 | { | 68 | { |
69 | struct page *page = vmf->page; | 69 | struct page *page = vmf->page; |
70 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | 70 | struct inode *inode = file_inode(vma->vm_file); |
71 | struct nilfs_transaction_info ti; | 71 | struct nilfs_transaction_info ti; |
72 | int ret = 0; | 72 | int ret = 0; |
73 | 73 | ||
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index f3859354e41a..b44bdb291b84 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -796,7 +796,7 @@ static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp, | |||
796 | 796 | ||
797 | long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 797 | long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
798 | { | 798 | { |
799 | struct inode *inode = filp->f_dentry->d_inode; | 799 | struct inode *inode = file_inode(filp); |
800 | void __user *argp = (void __user *)arg; | 800 | void __user *argp = (void __user *)arg; |
801 | 801 | ||
802 | switch (cmd) { | 802 | switch (cmd) { |
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 1d0c0b84c5a3..9de78f08989e 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -517,11 +517,11 @@ static int nilfs_encode_fh(struct inode *inode, __u32 *fh, int *lenp, | |||
517 | 517 | ||
518 | if (parent && *lenp < NILFS_FID_SIZE_CONNECTABLE) { | 518 | if (parent && *lenp < NILFS_FID_SIZE_CONNECTABLE) { |
519 | *lenp = NILFS_FID_SIZE_CONNECTABLE; | 519 | *lenp = NILFS_FID_SIZE_CONNECTABLE; |
520 | return 255; | 520 | return FILEID_INVALID; |
521 | } | 521 | } |
522 | if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE) { | 522 | if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE) { |
523 | *lenp = NILFS_FID_SIZE_NON_CONNECTABLE; | 523 | *lenp = NILFS_FID_SIZE_NON_CONNECTABLE; |
524 | return 255; | 524 | return FILEID_INVALID; |
525 | } | 525 | } |
526 | 526 | ||
527 | fid->cno = root->cno; | 527 | fid->cno = root->cno; |
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 08b886f119ce..2bfe6dc413a0 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
@@ -174,7 +174,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id) | |||
174 | struct dnotify_struct **prev; | 174 | struct dnotify_struct **prev; |
175 | struct inode *inode; | 175 | struct inode *inode; |
176 | 176 | ||
177 | inode = filp->f_path.dentry->d_inode; | 177 | inode = file_inode(filp); |
178 | if (!S_ISDIR(inode->i_mode)) | 178 | if (!S_ISDIR(inode->i_mode)) |
179 | return; | 179 | return; |
180 | 180 | ||
@@ -296,7 +296,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) | |||
296 | } | 296 | } |
297 | 297 | ||
298 | /* dnotify only works on directories */ | 298 | /* dnotify only works on directories */ |
299 | inode = filp->f_path.dentry->d_inode; | 299 | inode = file_inode(filp); |
300 | if (!S_ISDIR(inode->i_mode)) { | 300 | if (!S_ISDIR(inode->i_mode)) { |
301 | error = -ENOTDIR; | 301 | error = -ENOTDIR; |
302 | goto out_err; | 302 | goto out_err; |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 9ff4a5ee6e20..5d8444268a16 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -466,7 +466,7 @@ static int fanotify_find_path(int dfd, const char __user *filename, | |||
466 | 466 | ||
467 | ret = -ENOTDIR; | 467 | ret = -ENOTDIR; |
468 | if ((flags & FAN_MARK_ONLYDIR) && | 468 | if ((flags & FAN_MARK_ONLYDIR) && |
469 | !(S_ISDIR(f.file->f_path.dentry->d_inode->i_mode))) { | 469 | !(S_ISDIR(file_inode(f.file)->i_mode))) { |
470 | fdput(f); | 470 | fdput(f); |
471 | goto out; | 471 | goto out; |
472 | } | 472 | } |
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index 99e36107ff60..aa411c3f20e9 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_path.dentry->d_inode; | 1104 | struct inode *bmp_vi, *vdir = file_inode(filp); |
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); |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 9796330d8f04..20dfec72e903 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -569,7 +569,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, | |||
569 | int ret, | 569 | int ret, |
570 | bool is_async) | 570 | bool is_async) |
571 | { | 571 | { |
572 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; | 572 | struct inode *inode = file_inode(iocb->ki_filp); |
573 | int level; | 573 | int level; |
574 | wait_queue_head_t *wq = ocfs2_ioend_wq(inode); | 574 | wait_queue_head_t *wq = ocfs2_ioend_wq(inode); |
575 | 575 | ||
@@ -593,9 +593,9 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, | |||
593 | level = ocfs2_iocb_rw_locked_level(iocb); | 593 | level = ocfs2_iocb_rw_locked_level(iocb); |
594 | ocfs2_rw_unlock(inode, level); | 594 | ocfs2_rw_unlock(inode, level); |
595 | 595 | ||
596 | inode_dio_done(inode); | ||
596 | if (is_async) | 597 | if (is_async) |
597 | aio_complete(iocb, ret, 0); | 598 | aio_complete(iocb, ret, 0); |
598 | inode_dio_done(inode); | ||
599 | } | 599 | } |
600 | 600 | ||
601 | /* | 601 | /* |
@@ -626,7 +626,7 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
626 | unsigned long nr_segs) | 626 | unsigned long nr_segs) |
627 | { | 627 | { |
628 | struct file *file = iocb->ki_filp; | 628 | struct file *file = iocb->ki_filp; |
629 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; | 629 | struct inode *inode = file_inode(file)->i_mapping->host; |
630 | 630 | ||
631 | /* | 631 | /* |
632 | * Fallback to buffered I/O if we see an inode without | 632 | * Fallback to buffered I/O if we see an inode without |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index fc121350d8cb..f1e1aed8f638 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -2014,12 +2014,12 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, | |||
2014 | int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) | 2014 | int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) |
2015 | { | 2015 | { |
2016 | int error = 0; | 2016 | int error = 0; |
2017 | struct inode *inode = filp->f_path.dentry->d_inode; | 2017 | struct inode *inode = file_inode(filp); |
2018 | int lock_level = 0; | 2018 | int lock_level = 0; |
2019 | 2019 | ||
2020 | trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno); | 2020 | trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno); |
2021 | 2021 | ||
2022 | error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level); | 2022 | error = ocfs2_inode_lock_atime(inode, filp->f_path.mnt, &lock_level); |
2023 | if (lock_level && error >= 0) { | 2023 | if (lock_level && error >= 0) { |
2024 | /* We release EX lock which used to update atime | 2024 | /* We release EX lock which used to update atime |
2025 | * and get PR lock again to reduce contention | 2025 | * and get PR lock again to reduce contention |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 005261c333b0..33ecbe0e6734 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -2020,7 +2020,7 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm, | |||
2020 | int ignore_higher, u8 request_from, u32 flags) | 2020 | int ignore_higher, u8 request_from, u32 flags) |
2021 | { | 2021 | { |
2022 | struct dlm_work_item *item; | 2022 | struct dlm_work_item *item; |
2023 | item = kzalloc(sizeof(*item), GFP_NOFS); | 2023 | item = kzalloc(sizeof(*item), GFP_ATOMIC); |
2024 | if (!item) | 2024 | if (!item) |
2025 | return -ENOMEM; | 2025 | return -ENOMEM; |
2026 | 2026 | ||
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index 16b712d260d4..4c5fc8d77dc2 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c | |||
@@ -224,7 +224,7 @@ static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr) | |||
224 | static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait) | 224 | static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait) |
225 | { | 225 | { |
226 | int event = 0; | 226 | int event = 0; |
227 | struct inode *inode = file->f_path.dentry->d_inode; | 227 | struct inode *inode = file_inode(file); |
228 | struct dlmfs_inode_private *ip = DLMFS_I(inode); | 228 | struct dlmfs_inode_private *ip = DLMFS_I(inode); |
229 | 229 | ||
230 | poll_wait(file, &ip->ip_lockres.l_event, wait); | 230 | poll_wait(file, &ip->ip_lockres.l_event, wait); |
@@ -245,7 +245,7 @@ static ssize_t dlmfs_file_read(struct file *filp, | |||
245 | int bytes_left; | 245 | int bytes_left; |
246 | ssize_t readlen, got; | 246 | ssize_t readlen, got; |
247 | char *lvb_buf; | 247 | char *lvb_buf; |
248 | struct inode *inode = filp->f_path.dentry->d_inode; | 248 | struct inode *inode = file_inode(filp); |
249 | 249 | ||
250 | mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", | 250 | mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", |
251 | inode->i_ino, count, *ppos); | 251 | inode->i_ino, count, *ppos); |
@@ -293,7 +293,7 @@ static ssize_t dlmfs_file_write(struct file *filp, | |||
293 | int bytes_left; | 293 | int bytes_left; |
294 | ssize_t writelen; | 294 | ssize_t writelen; |
295 | char *lvb_buf; | 295 | char *lvb_buf; |
296 | struct inode *inode = filp->f_path.dentry->d_inode; | 296 | struct inode *inode = file_inode(filp); |
297 | 297 | ||
298 | mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", | 298 | mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", |
299 | inode->i_ino, count, *ppos); | 299 | inode->i_ino, count, *ppos); |
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 322216a5f0dd..29651167190d 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c | |||
@@ -195,11 +195,11 @@ static int ocfs2_encode_fh(struct inode *inode, u32 *fh_in, int *max_len, | |||
195 | 195 | ||
196 | if (parent && (len < 6)) { | 196 | if (parent && (len < 6)) { |
197 | *max_len = 6; | 197 | *max_len = 6; |
198 | type = 255; | 198 | type = FILEID_INVALID; |
199 | goto bail; | 199 | goto bail; |
200 | } else if (len < 3) { | 200 | } else if (len < 3) { |
201 | *max_len = 3; | 201 | *max_len = 3; |
202 | type = 255; | 202 | type = FILEID_INVALID; |
203 | goto bail; | 203 | goto bail; |
204 | } | 204 | } |
205 | 205 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 0a2924a2d9e6..6474cb44004d 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1950,7 +1950,7 @@ out: | |||
1950 | int ocfs2_change_file_space(struct file *file, unsigned int cmd, | 1950 | int ocfs2_change_file_space(struct file *file, unsigned int cmd, |
1951 | struct ocfs2_space_resv *sr) | 1951 | struct ocfs2_space_resv *sr) |
1952 | { | 1952 | { |
1953 | struct inode *inode = file->f_path.dentry->d_inode; | 1953 | struct inode *inode = file_inode(file); |
1954 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1954 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1955 | int ret; | 1955 | int ret; |
1956 | 1956 | ||
@@ -1978,7 +1978,7 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd, | |||
1978 | static long ocfs2_fallocate(struct file *file, int mode, loff_t offset, | 1978 | static long ocfs2_fallocate(struct file *file, int mode, loff_t offset, |
1979 | loff_t len) | 1979 | loff_t len) |
1980 | { | 1980 | { |
1981 | struct inode *inode = file->f_path.dentry->d_inode; | 1981 | struct inode *inode = file_inode(file); |
1982 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1982 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1983 | struct ocfs2_space_resv sr; | 1983 | struct ocfs2_space_resv sr; |
1984 | int change_size = 1; | 1984 | int change_size = 1; |
@@ -2233,7 +2233,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2233 | loff_t old_size, *ppos = &iocb->ki_pos; | 2233 | loff_t old_size, *ppos = &iocb->ki_pos; |
2234 | u32 old_clusters; | 2234 | u32 old_clusters; |
2235 | struct file *file = iocb->ki_filp; | 2235 | struct file *file = iocb->ki_filp; |
2236 | struct inode *inode = file->f_path.dentry->d_inode; | 2236 | struct inode *inode = file_inode(file); |
2237 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 2237 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
2238 | int full_coherency = !(osb->s_mount_opt & | 2238 | int full_coherency = !(osb->s_mount_opt & |
2239 | OCFS2_MOUNT_COHERENCY_BUFFERED); | 2239 | OCFS2_MOUNT_COHERENCY_BUFFERED); |
@@ -2517,7 +2517,7 @@ static ssize_t ocfs2_file_splice_read(struct file *in, | |||
2517 | unsigned int flags) | 2517 | unsigned int flags) |
2518 | { | 2518 | { |
2519 | int ret = 0, lock_level = 0; | 2519 | int ret = 0, lock_level = 0; |
2520 | struct inode *inode = in->f_path.dentry->d_inode; | 2520 | struct inode *inode = file_inode(in); |
2521 | 2521 | ||
2522 | trace_ocfs2_file_splice_read(inode, in, in->f_path.dentry, | 2522 | trace_ocfs2_file_splice_read(inode, in, in->f_path.dentry, |
2523 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 2523 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
@@ -2527,7 +2527,7 @@ static ssize_t ocfs2_file_splice_read(struct file *in, | |||
2527 | /* | 2527 | /* |
2528 | * See the comment in ocfs2_file_aio_read() | 2528 | * See the comment in ocfs2_file_aio_read() |
2529 | */ | 2529 | */ |
2530 | ret = ocfs2_inode_lock_atime(inode, in->f_vfsmnt, &lock_level); | 2530 | ret = ocfs2_inode_lock_atime(inode, in->f_path.mnt, &lock_level); |
2531 | if (ret < 0) { | 2531 | if (ret < 0) { |
2532 | mlog_errno(ret); | 2532 | mlog_errno(ret); |
2533 | goto bail; | 2533 | goto bail; |
@@ -2547,7 +2547,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2547 | { | 2547 | { |
2548 | int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0; | 2548 | int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0; |
2549 | struct file *filp = iocb->ki_filp; | 2549 | struct file *filp = iocb->ki_filp; |
2550 | struct inode *inode = filp->f_path.dentry->d_inode; | 2550 | struct inode *inode = file_inode(filp); |
2551 | 2551 | ||
2552 | trace_ocfs2_file_aio_read(inode, filp, filp->f_path.dentry, | 2552 | trace_ocfs2_file_aio_read(inode, filp, filp->f_path.dentry, |
2553 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 2553 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
@@ -2590,7 +2590,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2590 | * like i_size. This allows the checks down below | 2590 | * like i_size. This allows the checks down below |
2591 | * generic_file_aio_read() a chance of actually working. | 2591 | * generic_file_aio_read() a chance of actually working. |
2592 | */ | 2592 | */ |
2593 | ret = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level); | 2593 | ret = ocfs2_inode_lock_atime(inode, filp->f_path.mnt, &lock_level); |
2594 | if (ret < 0) { | 2594 | if (ret < 0) { |
2595 | mlog_errno(ret); | 2595 | mlog_errno(ret); |
2596 | goto bail; | 2596 | goto bail; |
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index f20edcbfe700..752f0b26221d 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -881,7 +881,7 @@ bail: | |||
881 | 881 | ||
882 | long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 882 | long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
883 | { | 883 | { |
884 | struct inode *inode = filp->f_path.dentry->d_inode; | 884 | struct inode *inode = file_inode(filp); |
885 | unsigned int flags; | 885 | unsigned int flags; |
886 | int new_clusters; | 886 | int new_clusters; |
887 | int status; | 887 | int status; |
@@ -994,7 +994,7 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
994 | { | 994 | { |
995 | bool preserve; | 995 | bool preserve; |
996 | struct reflink_arguments args; | 996 | struct reflink_arguments args; |
997 | struct inode *inode = file->f_path.dentry->d_inode; | 997 | struct inode *inode = file_inode(file); |
998 | struct ocfs2_info info; | 998 | struct ocfs2_info info; |
999 | void __user *argp = (void __user *)arg; | 999 | void __user *argp = (void __user *)arg; |
1000 | 1000 | ||
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 47a87dda54ce..10d66c75cecb 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -62,7 +62,7 @@ static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, | |||
62 | struct page *page) | 62 | struct page *page) |
63 | { | 63 | { |
64 | int ret = VM_FAULT_NOPAGE; | 64 | int ret = VM_FAULT_NOPAGE; |
65 | struct inode *inode = file->f_path.dentry->d_inode; | 65 | struct inode *inode = file_inode(file); |
66 | struct address_space *mapping = inode->i_mapping; | 66 | struct address_space *mapping = inode->i_mapping; |
67 | loff_t pos = page_offset(page); | 67 | loff_t pos = page_offset(page); |
68 | unsigned int len = PAGE_CACHE_SIZE; | 68 | unsigned int len = PAGE_CACHE_SIZE; |
@@ -131,7 +131,7 @@ out: | |||
131 | static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 131 | static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
132 | { | 132 | { |
133 | struct page *page = vmf->page; | 133 | struct page *page = vmf->page; |
134 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 134 | struct inode *inode = file_inode(vma->vm_file); |
135 | struct buffer_head *di_bh = NULL; | 135 | struct buffer_head *di_bh = NULL; |
136 | sigset_t oldset; | 136 | sigset_t oldset; |
137 | int ret; | 137 | int ret; |
@@ -180,13 +180,13 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) | |||
180 | { | 180 | { |
181 | int ret = 0, lock_level = 0; | 181 | int ret = 0, lock_level = 0; |
182 | 182 | ||
183 | ret = ocfs2_inode_lock_atime(file->f_dentry->d_inode, | 183 | ret = ocfs2_inode_lock_atime(file_inode(file), |
184 | file->f_vfsmnt, &lock_level); | 184 | file->f_path.mnt, &lock_level); |
185 | if (ret < 0) { | 185 | if (ret < 0) { |
186 | mlog_errno(ret); | 186 | mlog_errno(ret); |
187 | goto out; | 187 | goto out; |
188 | } | 188 | } |
189 | ocfs2_inode_unlock(file->f_dentry->d_inode, lock_level); | 189 | ocfs2_inode_unlock(file_inode(file), lock_level); |
190 | out: | 190 | out: |
191 | vma->vm_ops = &ocfs2_file_vm_ops; | 191 | vma->vm_ops = &ocfs2_file_vm_ops; |
192 | return 0; | 192 | return 0; |
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 6083432f667e..9f8dcadd9a50 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c | |||
@@ -1055,7 +1055,7 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp) | |||
1055 | { | 1055 | { |
1056 | int status; | 1056 | int status; |
1057 | 1057 | ||
1058 | struct inode *inode = filp->f_path.dentry->d_inode; | 1058 | struct inode *inode = file_inode(filp); |
1059 | struct ocfs2_move_extents range; | 1059 | struct ocfs2_move_extents range; |
1060 | struct ocfs2_move_extents_context *context = NULL; | 1060 | struct ocfs2_move_extents_context *context = NULL; |
1061 | 1061 | ||
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 934a4ac3e7fc..998b17eda09d 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -2927,7 +2927,7 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, | |||
2927 | u32 new_cluster, u32 new_len) | 2927 | u32 new_cluster, u32 new_len) |
2928 | { | 2928 | { |
2929 | int ret = 0, partial; | 2929 | int ret = 0, partial; |
2930 | struct inode *inode = file->f_path.dentry->d_inode; | 2930 | struct inode *inode = file_inode(file); |
2931 | struct ocfs2_caching_info *ci = INODE_CACHE(inode); | 2931 | struct ocfs2_caching_info *ci = INODE_CACHE(inode); |
2932 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | 2932 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); |
2933 | u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster); | 2933 | u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster); |
@@ -3020,7 +3020,7 @@ int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, | |||
3020 | u32 new_cluster, u32 new_len) | 3020 | u32 new_cluster, u32 new_len) |
3021 | { | 3021 | { |
3022 | int ret = 0; | 3022 | int ret = 0; |
3023 | struct inode *inode = file->f_path.dentry->d_inode; | 3023 | struct inode *inode = file_inode(file); |
3024 | struct super_block *sb = inode->i_sb; | 3024 | struct super_block *sb = inode->i_sb; |
3025 | struct ocfs2_caching_info *ci = INODE_CACHE(inode); | 3025 | struct ocfs2_caching_info *ci = INODE_CACHE(inode); |
3026 | int i, blocks = ocfs2_clusters_to_blocks(sb, new_len); | 3026 | int i, blocks = ocfs2_clusters_to_blocks(sb, new_len); |
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index f1fbb4b552ad..66edce7ecfd7 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c | |||
@@ -57,7 +57,7 @@ | |||
57 | static int ocfs2_fast_symlink_readpage(struct file *unused, struct page *page) | 57 | static int ocfs2_fast_symlink_readpage(struct file *unused, struct page *page) |
58 | { | 58 | { |
59 | struct inode *inode = page->mapping->host; | 59 | struct inode *inode = page->mapping->host; |
60 | struct buffer_head *bh; | 60 | struct buffer_head *bh = NULL; |
61 | int status = ocfs2_read_inode_block(inode, &bh); | 61 | int status = ocfs2_read_inode_block(inode, &bh); |
62 | struct ocfs2_dinode *fe; | 62 | struct ocfs2_dinode *fe; |
63 | const char *link; | 63 | const char *link; |
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c index fb5b3ff79dc6..acbaebcad3a8 100644 --- a/fs/omfs/dir.c +++ b/fs/omfs/dir.c | |||
@@ -330,7 +330,7 @@ int omfs_is_bad(struct omfs_sb_info *sbi, struct omfs_header *header, | |||
330 | static int omfs_fill_chain(struct file *filp, void *dirent, filldir_t filldir, | 330 | static int omfs_fill_chain(struct file *filp, void *dirent, filldir_t filldir, |
331 | u64 fsblock, int hindex) | 331 | u64 fsblock, int hindex) |
332 | { | 332 | { |
333 | struct inode *dir = filp->f_dentry->d_inode; | 333 | struct inode *dir = file_inode(filp); |
334 | struct buffer_head *bh; | 334 | struct buffer_head *bh; |
335 | struct omfs_inode *oi; | 335 | struct omfs_inode *oi; |
336 | u64 self; | 336 | u64 self; |
@@ -405,7 +405,7 @@ out: | |||
405 | 405 | ||
406 | static int omfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 406 | static int omfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
407 | { | 407 | { |
408 | struct inode *dir = filp->f_dentry->d_inode; | 408 | struct inode *dir = file_inode(filp); |
409 | struct buffer_head *bh; | 409 | struct buffer_head *bh; |
410 | loff_t offset, res; | 410 | loff_t offset, res; |
411 | unsigned int hchain, hindex; | 411 | unsigned int hchain, hindex; |
@@ -228,7 +228,7 @@ SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64); | |||
228 | 228 | ||
229 | int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | 229 | int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) |
230 | { | 230 | { |
231 | struct inode *inode = file->f_path.dentry->d_inode; | 231 | struct inode *inode = file_inode(file); |
232 | long ret; | 232 | long ret; |
233 | 233 | ||
234 | if (offset < 0 || len <= 0) | 234 | if (offset < 0 || len <= 0) |
@@ -426,7 +426,7 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd) | |||
426 | if (!f.file) | 426 | if (!f.file) |
427 | goto out; | 427 | goto out; |
428 | 428 | ||
429 | inode = f.file->f_path.dentry->d_inode; | 429 | inode = file_inode(f.file); |
430 | 430 | ||
431 | error = -ENOTDIR; | 431 | error = -ENOTDIR; |
432 | if (!S_ISDIR(inode->i_mode)) | 432 | if (!S_ISDIR(inode->i_mode)) |
@@ -689,7 +689,7 @@ static int do_dentry_open(struct file *f, | |||
689 | f->f_mode = FMODE_PATH; | 689 | f->f_mode = FMODE_PATH; |
690 | 690 | ||
691 | path_get(&f->f_path); | 691 | path_get(&f->f_path); |
692 | inode = f->f_path.dentry->d_inode; | 692 | inode = file_inode(f); |
693 | if (f->f_mode & FMODE_WRITE) { | 693 | if (f->f_mode & FMODE_WRITE) { |
694 | error = __get_file_write_access(inode, f->f_path.mnt); | 694 | error = __get_file_write_access(inode, f->f_path.mnt); |
695 | if (error) | 695 | if (error) |
@@ -699,7 +699,6 @@ static int do_dentry_open(struct file *f, | |||
699 | } | 699 | } |
700 | 700 | ||
701 | f->f_mapping = inode->i_mapping; | 701 | f->f_mapping = inode->i_mapping; |
702 | f->f_pos = 0; | ||
703 | file_sb_list_add(f, inode->i_sb); | 702 | file_sb_list_add(f, inode->i_sb); |
704 | 703 | ||
705 | if (unlikely(f->f_mode & FMODE_PATH)) { | 704 | if (unlikely(f->f_mode & FMODE_PATH)) { |
@@ -810,23 +809,22 @@ struct file *dentry_open(const struct path *path, int flags, | |||
810 | /* We must always pass in a valid mount pointer. */ | 809 | /* We must always pass in a valid mount pointer. */ |
811 | BUG_ON(!path->mnt); | 810 | BUG_ON(!path->mnt); |
812 | 811 | ||
813 | error = -ENFILE; | ||
814 | f = get_empty_filp(); | 812 | f = get_empty_filp(); |
815 | if (f == NULL) | 813 | if (!IS_ERR(f)) { |
816 | return ERR_PTR(error); | 814 | f->f_flags = flags; |
817 | 815 | f->f_path = *path; | |
818 | f->f_flags = flags; | 816 | error = do_dentry_open(f, NULL, cred); |
819 | f->f_path = *path; | 817 | if (!error) { |
820 | error = do_dentry_open(f, NULL, cred); | 818 | /* from now on we need fput() to dispose of f */ |
821 | if (!error) { | 819 | error = open_check_o_direct(f); |
822 | error = open_check_o_direct(f); | 820 | if (error) { |
823 | if (error) { | 821 | fput(f); |
824 | fput(f); | 822 | f = ERR_PTR(error); |
823 | } | ||
824 | } else { | ||
825 | put_filp(f); | ||
825 | f = ERR_PTR(error); | 826 | f = ERR_PTR(error); |
826 | } | 827 | } |
827 | } else { | ||
828 | put_filp(f); | ||
829 | f = ERR_PTR(error); | ||
830 | } | 828 | } |
831 | return f; | 829 | return f; |
832 | } | 830 | } |
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 2ad080faca34..ae47fa7efb9d 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c | |||
@@ -262,7 +262,7 @@ found: | |||
262 | 262 | ||
263 | static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filldir) | 263 | static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filldir) |
264 | { | 264 | { |
265 | struct inode *inode = filp->f_path.dentry->d_inode; | 265 | struct inode *inode = file_inode(filp); |
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; |
@@ -361,7 +361,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |||
361 | unsigned long nr_segs, loff_t pos) | 361 | unsigned long nr_segs, loff_t pos) |
362 | { | 362 | { |
363 | struct file *filp = iocb->ki_filp; | 363 | struct file *filp = iocb->ki_filp; |
364 | struct inode *inode = filp->f_path.dentry->d_inode; | 364 | struct inode *inode = file_inode(filp); |
365 | struct pipe_inode_info *pipe; | 365 | struct pipe_inode_info *pipe; |
366 | int do_wakeup; | 366 | int do_wakeup; |
367 | ssize_t ret; | 367 | ssize_t ret; |
@@ -486,7 +486,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, | |||
486 | unsigned long nr_segs, loff_t ppos) | 486 | unsigned long nr_segs, loff_t ppos) |
487 | { | 487 | { |
488 | struct file *filp = iocb->ki_filp; | 488 | struct file *filp = iocb->ki_filp; |
489 | struct inode *inode = filp->f_path.dentry->d_inode; | 489 | struct inode *inode = file_inode(filp); |
490 | struct pipe_inode_info *pipe; | 490 | struct pipe_inode_info *pipe; |
491 | ssize_t ret; | 491 | ssize_t ret; |
492 | int do_wakeup; | 492 | int do_wakeup; |
@@ -677,7 +677,7 @@ bad_pipe_w(struct file *filp, const char __user *buf, size_t count, | |||
677 | 677 | ||
678 | static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 678 | static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
679 | { | 679 | { |
680 | struct inode *inode = filp->f_path.dentry->d_inode; | 680 | struct inode *inode = file_inode(filp); |
681 | struct pipe_inode_info *pipe; | 681 | struct pipe_inode_info *pipe; |
682 | int count, buf, nrbufs; | 682 | int count, buf, nrbufs; |
683 | 683 | ||
@@ -705,7 +705,7 @@ static unsigned int | |||
705 | pipe_poll(struct file *filp, poll_table *wait) | 705 | pipe_poll(struct file *filp, poll_table *wait) |
706 | { | 706 | { |
707 | unsigned int mask; | 707 | unsigned int mask; |
708 | struct inode *inode = filp->f_path.dentry->d_inode; | 708 | struct inode *inode = file_inode(filp); |
709 | struct pipe_inode_info *pipe = inode->i_pipe; | 709 | struct pipe_inode_info *pipe = inode->i_pipe; |
710 | int nrbufs; | 710 | int nrbufs; |
711 | 711 | ||
@@ -758,7 +758,7 @@ pipe_release(struct inode *inode, int decr, int decw) | |||
758 | static int | 758 | static int |
759 | pipe_read_fasync(int fd, struct file *filp, int on) | 759 | pipe_read_fasync(int fd, struct file *filp, int on) |
760 | { | 760 | { |
761 | struct inode *inode = filp->f_path.dentry->d_inode; | 761 | struct inode *inode = file_inode(filp); |
762 | int retval; | 762 | int retval; |
763 | 763 | ||
764 | mutex_lock(&inode->i_mutex); | 764 | mutex_lock(&inode->i_mutex); |
@@ -772,7 +772,7 @@ pipe_read_fasync(int fd, struct file *filp, int on) | |||
772 | static int | 772 | static int |
773 | pipe_write_fasync(int fd, struct file *filp, int on) | 773 | pipe_write_fasync(int fd, struct file *filp, int on) |
774 | { | 774 | { |
775 | struct inode *inode = filp->f_path.dentry->d_inode; | 775 | struct inode *inode = file_inode(filp); |
776 | int retval; | 776 | int retval; |
777 | 777 | ||
778 | mutex_lock(&inode->i_mutex); | 778 | mutex_lock(&inode->i_mutex); |
@@ -786,7 +786,7 @@ pipe_write_fasync(int fd, struct file *filp, int on) | |||
786 | static int | 786 | static int |
787 | pipe_rdwr_fasync(int fd, struct file *filp, int on) | 787 | pipe_rdwr_fasync(int fd, struct file *filp, int on) |
788 | { | 788 | { |
789 | struct inode *inode = filp->f_path.dentry->d_inode; | 789 | struct inode *inode = file_inode(filp); |
790 | struct pipe_inode_info *pipe = inode->i_pipe; | 790 | struct pipe_inode_info *pipe = inode->i_pipe; |
791 | int retval; | 791 | int retval; |
792 | 792 | ||
@@ -1037,13 +1037,13 @@ int create_pipe_files(struct file **res, int flags) | |||
1037 | 1037 | ||
1038 | err = -ENFILE; | 1038 | err = -ENFILE; |
1039 | f = alloc_file(&path, FMODE_WRITE, &write_pipefifo_fops); | 1039 | f = alloc_file(&path, FMODE_WRITE, &write_pipefifo_fops); |
1040 | if (!f) | 1040 | if (IS_ERR(f)) |
1041 | goto err_dentry; | 1041 | goto err_dentry; |
1042 | 1042 | ||
1043 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); | 1043 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); |
1044 | 1044 | ||
1045 | res[0] = alloc_file(&path, FMODE_READ, &read_pipefifo_fops); | 1045 | res[0] = alloc_file(&path, FMODE_READ, &read_pipefifo_fops); |
1046 | if (!res[0]) | 1046 | if (IS_ERR(res[0])) |
1047 | goto err_file; | 1047 | goto err_file; |
1048 | 1048 | ||
1049 | path_get(&path); | 1049 | path_get(&path); |
@@ -1226,7 +1226,7 @@ int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf, | |||
1226 | */ | 1226 | */ |
1227 | struct pipe_inode_info *get_pipe_info(struct file *file) | 1227 | struct pipe_inode_info *get_pipe_info(struct file *file) |
1228 | { | 1228 | { |
1229 | struct inode *i = file->f_path.dentry->d_inode; | 1229 | struct inode *i = file_inode(file); |
1230 | 1230 | ||
1231 | return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; | 1231 | return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; |
1232 | } | 1232 | } |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 9b43ff77a51e..f3b133d79914 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -383,7 +383,7 @@ static int lstats_open(struct inode *inode, struct file *file) | |||
383 | static ssize_t lstats_write(struct file *file, const char __user *buf, | 383 | static ssize_t lstats_write(struct file *file, const char __user *buf, |
384 | size_t count, loff_t *offs) | 384 | size_t count, loff_t *offs) |
385 | { | 385 | { |
386 | struct task_struct *task = get_proc_task(file->f_dentry->d_inode); | 386 | struct task_struct *task = get_proc_task(file_inode(file)); |
387 | 387 | ||
388 | if (!task) | 388 | if (!task) |
389 | return -ESRCH; | 389 | return -ESRCH; |
@@ -602,7 +602,7 @@ static const struct inode_operations proc_def_inode_operations = { | |||
602 | static ssize_t proc_info_read(struct file * file, char __user * buf, | 602 | static ssize_t proc_info_read(struct file * file, char __user * buf, |
603 | size_t count, loff_t *ppos) | 603 | size_t count, loff_t *ppos) |
604 | { | 604 | { |
605 | struct inode * inode = file->f_path.dentry->d_inode; | 605 | struct inode * inode = file_inode(file); |
606 | unsigned long page; | 606 | unsigned long page; |
607 | ssize_t length; | 607 | ssize_t length; |
608 | struct task_struct *task = get_proc_task(inode); | 608 | struct task_struct *task = get_proc_task(inode); |
@@ -668,7 +668,7 @@ static const struct file_operations proc_single_file_operations = { | |||
668 | 668 | ||
669 | static int __mem_open(struct inode *inode, struct file *file, unsigned int mode) | 669 | static int __mem_open(struct inode *inode, struct file *file, unsigned int mode) |
670 | { | 670 | { |
671 | struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); | 671 | struct task_struct *task = get_proc_task(file_inode(file)); |
672 | struct mm_struct *mm; | 672 | struct mm_struct *mm; |
673 | 673 | ||
674 | if (!task) | 674 | if (!task) |
@@ -869,7 +869,7 @@ static const struct file_operations proc_environ_operations = { | |||
869 | static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, | 869 | static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, |
870 | loff_t *ppos) | 870 | loff_t *ppos) |
871 | { | 871 | { |
872 | struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); | 872 | struct task_struct *task = get_proc_task(file_inode(file)); |
873 | char buffer[PROC_NUMBUF]; | 873 | char buffer[PROC_NUMBUF]; |
874 | int oom_adj = OOM_ADJUST_MIN; | 874 | int oom_adj = OOM_ADJUST_MIN; |
875 | size_t len; | 875 | size_t len; |
@@ -916,7 +916,7 @@ static ssize_t oom_adj_write(struct file *file, const char __user *buf, | |||
916 | goto out; | 916 | goto out; |
917 | } | 917 | } |
918 | 918 | ||
919 | task = get_proc_task(file->f_path.dentry->d_inode); | 919 | task = get_proc_task(file_inode(file)); |
920 | if (!task) { | 920 | if (!task) { |
921 | err = -ESRCH; | 921 | err = -ESRCH; |
922 | goto out; | 922 | goto out; |
@@ -976,7 +976,7 @@ static const struct file_operations proc_oom_adj_operations = { | |||
976 | static ssize_t oom_score_adj_read(struct file *file, char __user *buf, | 976 | static ssize_t oom_score_adj_read(struct file *file, char __user *buf, |
977 | size_t count, loff_t *ppos) | 977 | size_t count, loff_t *ppos) |
978 | { | 978 | { |
979 | struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); | 979 | struct task_struct *task = get_proc_task(file_inode(file)); |
980 | char buffer[PROC_NUMBUF]; | 980 | char buffer[PROC_NUMBUF]; |
981 | short oom_score_adj = OOM_SCORE_ADJ_MIN; | 981 | short oom_score_adj = OOM_SCORE_ADJ_MIN; |
982 | unsigned long flags; | 982 | unsigned long flags; |
@@ -1019,7 +1019,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, | |||
1019 | goto out; | 1019 | goto out; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | task = get_proc_task(file->f_path.dentry->d_inode); | 1022 | task = get_proc_task(file_inode(file)); |
1023 | if (!task) { | 1023 | if (!task) { |
1024 | err = -ESRCH; | 1024 | err = -ESRCH; |
1025 | goto out; | 1025 | goto out; |
@@ -1067,7 +1067,7 @@ static const struct file_operations proc_oom_score_adj_operations = { | |||
1067 | static ssize_t proc_loginuid_read(struct file * file, char __user * buf, | 1067 | static ssize_t proc_loginuid_read(struct file * file, char __user * buf, |
1068 | size_t count, loff_t *ppos) | 1068 | size_t count, loff_t *ppos) |
1069 | { | 1069 | { |
1070 | struct inode * inode = file->f_path.dentry->d_inode; | 1070 | struct inode * inode = file_inode(file); |
1071 | struct task_struct *task = get_proc_task(inode); | 1071 | struct task_struct *task = get_proc_task(inode); |
1072 | ssize_t length; | 1072 | ssize_t length; |
1073 | char tmpbuf[TMPBUFLEN]; | 1073 | char tmpbuf[TMPBUFLEN]; |
@@ -1084,7 +1084,7 @@ static ssize_t proc_loginuid_read(struct file * file, char __user * buf, | |||
1084 | static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, | 1084 | static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, |
1085 | size_t count, loff_t *ppos) | 1085 | size_t count, loff_t *ppos) |
1086 | { | 1086 | { |
1087 | struct inode * inode = file->f_path.dentry->d_inode; | 1087 | struct inode * inode = file_inode(file); |
1088 | char *page, *tmp; | 1088 | char *page, *tmp; |
1089 | ssize_t length; | 1089 | ssize_t length; |
1090 | uid_t loginuid; | 1090 | uid_t loginuid; |
@@ -1142,7 +1142,7 @@ static const struct file_operations proc_loginuid_operations = { | |||
1142 | static ssize_t proc_sessionid_read(struct file * file, char __user * buf, | 1142 | static ssize_t proc_sessionid_read(struct file * file, char __user * buf, |
1143 | size_t count, loff_t *ppos) | 1143 | size_t count, loff_t *ppos) |
1144 | { | 1144 | { |
1145 | struct inode * inode = file->f_path.dentry->d_inode; | 1145 | struct inode * inode = file_inode(file); |
1146 | struct task_struct *task = get_proc_task(inode); | 1146 | struct task_struct *task = get_proc_task(inode); |
1147 | ssize_t length; | 1147 | ssize_t length; |
1148 | char tmpbuf[TMPBUFLEN]; | 1148 | char tmpbuf[TMPBUFLEN]; |
@@ -1165,7 +1165,7 @@ static const struct file_operations proc_sessionid_operations = { | |||
1165 | static ssize_t proc_fault_inject_read(struct file * file, char __user * buf, | 1165 | static ssize_t proc_fault_inject_read(struct file * file, char __user * buf, |
1166 | size_t count, loff_t *ppos) | 1166 | size_t count, loff_t *ppos) |
1167 | { | 1167 | { |
1168 | struct task_struct *task = get_proc_task(file->f_dentry->d_inode); | 1168 | struct task_struct *task = get_proc_task(file_inode(file)); |
1169 | char buffer[PROC_NUMBUF]; | 1169 | char buffer[PROC_NUMBUF]; |
1170 | size_t len; | 1170 | size_t len; |
1171 | int make_it_fail; | 1171 | int make_it_fail; |
@@ -1197,7 +1197,7 @@ static ssize_t proc_fault_inject_write(struct file * file, | |||
1197 | make_it_fail = simple_strtol(strstrip(buffer), &end, 0); | 1197 | make_it_fail = simple_strtol(strstrip(buffer), &end, 0); |
1198 | if (*end) | 1198 | if (*end) |
1199 | return -EINVAL; | 1199 | return -EINVAL; |
1200 | task = get_proc_task(file->f_dentry->d_inode); | 1200 | task = get_proc_task(file_inode(file)); |
1201 | if (!task) | 1201 | if (!task) |
1202 | return -ESRCH; | 1202 | return -ESRCH; |
1203 | task->make_it_fail = make_it_fail; | 1203 | task->make_it_fail = make_it_fail; |
@@ -1237,7 +1237,7 @@ static ssize_t | |||
1237 | sched_write(struct file *file, const char __user *buf, | 1237 | sched_write(struct file *file, const char __user *buf, |
1238 | size_t count, loff_t *offset) | 1238 | size_t count, loff_t *offset) |
1239 | { | 1239 | { |
1240 | struct inode *inode = file->f_path.dentry->d_inode; | 1240 | struct inode *inode = file_inode(file); |
1241 | struct task_struct *p; | 1241 | struct task_struct *p; |
1242 | 1242 | ||
1243 | p = get_proc_task(inode); | 1243 | p = get_proc_task(inode); |
@@ -1288,7 +1288,7 @@ static ssize_t | |||
1288 | sched_autogroup_write(struct file *file, const char __user *buf, | 1288 | sched_autogroup_write(struct file *file, const char __user *buf, |
1289 | size_t count, loff_t *offset) | 1289 | size_t count, loff_t *offset) |
1290 | { | 1290 | { |
1291 | struct inode *inode = file->f_path.dentry->d_inode; | 1291 | struct inode *inode = file_inode(file); |
1292 | struct task_struct *p; | 1292 | struct task_struct *p; |
1293 | char buffer[PROC_NUMBUF]; | 1293 | char buffer[PROC_NUMBUF]; |
1294 | int nice; | 1294 | int nice; |
@@ -1343,7 +1343,7 @@ static const struct file_operations proc_pid_sched_autogroup_operations = { | |||
1343 | static ssize_t comm_write(struct file *file, const char __user *buf, | 1343 | static ssize_t comm_write(struct file *file, const char __user *buf, |
1344 | size_t count, loff_t *offset) | 1344 | size_t count, loff_t *offset) |
1345 | { | 1345 | { |
1346 | struct inode *inode = file->f_path.dentry->d_inode; | 1346 | struct inode *inode = file_inode(file); |
1347 | struct task_struct *p; | 1347 | struct task_struct *p; |
1348 | char buffer[TASK_COMM_LEN]; | 1348 | char buffer[TASK_COMM_LEN]; |
1349 | 1349 | ||
@@ -1711,7 +1711,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
1711 | return -ECHILD; | 1711 | return -ECHILD; |
1712 | 1712 | ||
1713 | if (!capable(CAP_SYS_ADMIN)) { | 1713 | if (!capable(CAP_SYS_ADMIN)) { |
1714 | status = -EACCES; | 1714 | status = -EPERM; |
1715 | goto out_notask; | 1715 | goto out_notask; |
1716 | } | 1716 | } |
1717 | 1717 | ||
@@ -1844,7 +1844,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
1844 | struct dentry *result; | 1844 | struct dentry *result; |
1845 | struct mm_struct *mm; | 1845 | struct mm_struct *mm; |
1846 | 1846 | ||
1847 | result = ERR_PTR(-EACCES); | 1847 | result = ERR_PTR(-EPERM); |
1848 | if (!capable(CAP_SYS_ADMIN)) | 1848 | if (!capable(CAP_SYS_ADMIN)) |
1849 | goto out; | 1849 | goto out; |
1850 | 1850 | ||
@@ -1900,7 +1900,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
1900 | ino_t ino; | 1900 | ino_t ino; |
1901 | int ret; | 1901 | int ret; |
1902 | 1902 | ||
1903 | ret = -EACCES; | 1903 | ret = -EPERM; |
1904 | if (!capable(CAP_SYS_ADMIN)) | 1904 | if (!capable(CAP_SYS_ADMIN)) |
1905 | goto out; | 1905 | goto out; |
1906 | 1906 | ||
@@ -2146,7 +2146,7 @@ out_no_task: | |||
2146 | static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, | 2146 | static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, |
2147 | size_t count, loff_t *ppos) | 2147 | size_t count, loff_t *ppos) |
2148 | { | 2148 | { |
2149 | struct inode * inode = file->f_path.dentry->d_inode; | 2149 | struct inode * inode = file_inode(file); |
2150 | char *p = NULL; | 2150 | char *p = NULL; |
2151 | ssize_t length; | 2151 | ssize_t length; |
2152 | struct task_struct *task = get_proc_task(inode); | 2152 | struct task_struct *task = get_proc_task(inode); |
@@ -2167,7 +2167,7 @@ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, | |||
2167 | static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, | 2167 | static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, |
2168 | size_t count, loff_t *ppos) | 2168 | size_t count, loff_t *ppos) |
2169 | { | 2169 | { |
2170 | struct inode * inode = file->f_path.dentry->d_inode; | 2170 | struct inode * inode = file_inode(file); |
2171 | char *page; | 2171 | char *page; |
2172 | ssize_t length; | 2172 | ssize_t length; |
2173 | struct task_struct *task = get_proc_task(inode); | 2173 | struct task_struct *task = get_proc_task(inode); |
@@ -2256,7 +2256,7 @@ static const struct inode_operations proc_attr_dir_inode_operations = { | |||
2256 | static ssize_t proc_coredump_filter_read(struct file *file, char __user *buf, | 2256 | static ssize_t proc_coredump_filter_read(struct file *file, char __user *buf, |
2257 | size_t count, loff_t *ppos) | 2257 | size_t count, loff_t *ppos) |
2258 | { | 2258 | { |
2259 | struct task_struct *task = get_proc_task(file->f_dentry->d_inode); | 2259 | struct task_struct *task = get_proc_task(file_inode(file)); |
2260 | struct mm_struct *mm; | 2260 | struct mm_struct *mm; |
2261 | char buffer[PROC_NUMBUF]; | 2261 | char buffer[PROC_NUMBUF]; |
2262 | size_t len; | 2262 | size_t len; |
@@ -2308,7 +2308,7 @@ static ssize_t proc_coredump_filter_write(struct file *file, | |||
2308 | goto out_no_task; | 2308 | goto out_no_task; |
2309 | 2309 | ||
2310 | ret = -ESRCH; | 2310 | ret = -ESRCH; |
2311 | task = get_proc_task(file->f_dentry->d_inode); | 2311 | task = get_proc_task(file_inode(file)); |
2312 | if (!task) | 2312 | if (!task) |
2313 | goto out_no_task; | 2313 | goto out_no_task; |
2314 | 2314 | ||
@@ -2618,6 +2618,7 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) | |||
2618 | 2618 | ||
2619 | name.name = buf; | 2619 | name.name = buf; |
2620 | name.len = snprintf(buf, sizeof(buf), "%d", pid); | 2620 | name.len = snprintf(buf, sizeof(buf), "%d", pid); |
2621 | /* no ->d_hash() rejects on procfs */ | ||
2621 | dentry = d_hash_and_lookup(mnt->mnt_root, &name); | 2622 | dentry = d_hash_and_lookup(mnt->mnt_root, &name); |
2622 | if (dentry) { | 2623 | if (dentry) { |
2623 | shrink_dcache_parent(dentry); | 2624 | shrink_dcache_parent(dentry); |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 76ddae83daa5..2983dc52ca25 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -42,7 +42,7 @@ static ssize_t | |||
42 | __proc_file_read(struct file *file, char __user *buf, size_t nbytes, | 42 | __proc_file_read(struct file *file, char __user *buf, size_t nbytes, |
43 | loff_t *ppos) | 43 | loff_t *ppos) |
44 | { | 44 | { |
45 | struct inode * inode = file->f_path.dentry->d_inode; | 45 | struct inode * inode = file_inode(file); |
46 | char *page; | 46 | char *page; |
47 | ssize_t retval=0; | 47 | ssize_t retval=0; |
48 | int eof=0; | 48 | int eof=0; |
@@ -188,7 +188,7 @@ static ssize_t | |||
188 | proc_file_read(struct file *file, char __user *buf, size_t nbytes, | 188 | proc_file_read(struct file *file, char __user *buf, size_t nbytes, |
189 | loff_t *ppos) | 189 | loff_t *ppos) |
190 | { | 190 | { |
191 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 191 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
192 | ssize_t rv = -EIO; | 192 | ssize_t rv = -EIO; |
193 | 193 | ||
194 | spin_lock(&pde->pde_unload_lock); | 194 | spin_lock(&pde->pde_unload_lock); |
@@ -209,7 +209,7 @@ static ssize_t | |||
209 | proc_file_write(struct file *file, const char __user *buffer, | 209 | proc_file_write(struct file *file, const char __user *buffer, |
210 | size_t count, loff_t *ppos) | 210 | size_t count, loff_t *ppos) |
211 | { | 211 | { |
212 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 212 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
213 | ssize_t rv = -EIO; | 213 | ssize_t rv = -EIO; |
214 | 214 | ||
215 | if (pde->write_proc) { | 215 | if (pde->write_proc) { |
@@ -412,8 +412,7 @@ static const struct dentry_operations proc_dentry_operations = | |||
412 | struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | 412 | struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, |
413 | struct dentry *dentry) | 413 | struct dentry *dentry) |
414 | { | 414 | { |
415 | struct inode *inode = NULL; | 415 | struct inode *inode; |
416 | int error = -ENOENT; | ||
417 | 416 | ||
418 | spin_lock(&proc_subdir_lock); | 417 | spin_lock(&proc_subdir_lock); |
419 | for (de = de->subdir; de ; de = de->next) { | 418 | for (de = de->subdir; de ; de = de->next) { |
@@ -422,22 +421,16 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | |||
422 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { | 421 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { |
423 | pde_get(de); | 422 | pde_get(de); |
424 | spin_unlock(&proc_subdir_lock); | 423 | spin_unlock(&proc_subdir_lock); |
425 | error = -ENOMEM; | ||
426 | inode = proc_get_inode(dir->i_sb, de); | 424 | inode = proc_get_inode(dir->i_sb, de); |
427 | goto out_unlock; | 425 | if (!inode) |
426 | return ERR_PTR(-ENOMEM); | ||
427 | d_set_d_op(dentry, &proc_dentry_operations); | ||
428 | d_add(dentry, inode); | ||
429 | return NULL; | ||
428 | } | 430 | } |
429 | } | 431 | } |
430 | spin_unlock(&proc_subdir_lock); | 432 | spin_unlock(&proc_subdir_lock); |
431 | out_unlock: | 433 | return ERR_PTR(-ENOENT); |
432 | |||
433 | if (inode) { | ||
434 | d_set_d_op(dentry, &proc_dentry_operations); | ||
435 | d_add(dentry, inode); | ||
436 | return NULL; | ||
437 | } | ||
438 | if (de) | ||
439 | pde_put(de); | ||
440 | return ERR_PTR(error); | ||
441 | } | 434 | } |
442 | 435 | ||
443 | struct dentry *proc_lookup(struct inode *dir, struct dentry *dentry, | 436 | struct dentry *proc_lookup(struct inode *dir, struct dentry *dentry, |
@@ -460,7 +453,7 @@ int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent, | |||
460 | { | 453 | { |
461 | unsigned int ino; | 454 | unsigned int ino; |
462 | int i; | 455 | int i; |
463 | struct inode *inode = filp->f_path.dentry->d_inode; | 456 | struct inode *inode = file_inode(filp); |
464 | int ret = 0; | 457 | int ret = 0; |
465 | 458 | ||
466 | ino = inode->i_ino; | 459 | ino = inode->i_ino; |
@@ -522,7 +515,7 @@ out: | |||
522 | 515 | ||
523 | int proc_readdir(struct file *filp, void *dirent, filldir_t filldir) | 516 | int proc_readdir(struct file *filp, void *dirent, filldir_t filldir) |
524 | { | 517 | { |
525 | struct inode *inode = filp->f_path.dentry->d_inode; | 518 | struct inode *inode = file_inode(filp); |
526 | 519 | ||
527 | return proc_readdir_de(PDE(inode), filp, dirent, filldir); | 520 | return proc_readdir_de(PDE(inode), filp, dirent, filldir); |
528 | } | 521 | } |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 439ae6886507..70322e1a4f0f 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -144,7 +144,7 @@ void pde_users_dec(struct proc_dir_entry *pde) | |||
144 | 144 | ||
145 | static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) | 145 | static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) |
146 | { | 146 | { |
147 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 147 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
148 | loff_t rv = -EINVAL; | 148 | loff_t rv = -EINVAL; |
149 | loff_t (*llseek)(struct file *, loff_t, int); | 149 | loff_t (*llseek)(struct file *, loff_t, int); |
150 | 150 | ||
@@ -179,7 +179,7 @@ static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) | |||
179 | 179 | ||
180 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 180 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
181 | { | 181 | { |
182 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 182 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
183 | ssize_t rv = -EIO; | 183 | ssize_t rv = -EIO; |
184 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | 184 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); |
185 | 185 | ||
@@ -201,7 +201,7 @@ static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, | |||
201 | 201 | ||
202 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 202 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
203 | { | 203 | { |
204 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 204 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
205 | ssize_t rv = -EIO; | 205 | ssize_t rv = -EIO; |
206 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); | 206 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); |
207 | 207 | ||
@@ -223,7 +223,7 @@ static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t | |||
223 | 223 | ||
224 | static unsigned int proc_reg_poll(struct file *file, struct poll_table_struct *pts) | 224 | static unsigned int proc_reg_poll(struct file *file, struct poll_table_struct *pts) |
225 | { | 225 | { |
226 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 226 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
227 | unsigned int rv = DEFAULT_POLLMASK; | 227 | unsigned int rv = DEFAULT_POLLMASK; |
228 | unsigned int (*poll)(struct file *, struct poll_table_struct *); | 228 | unsigned int (*poll)(struct file *, struct poll_table_struct *); |
229 | 229 | ||
@@ -245,7 +245,7 @@ static unsigned int proc_reg_poll(struct file *file, struct poll_table_struct *p | |||
245 | 245 | ||
246 | static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 246 | static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
247 | { | 247 | { |
248 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 248 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
249 | long rv = -ENOTTY; | 249 | long rv = -ENOTTY; |
250 | long (*ioctl)(struct file *, unsigned int, unsigned long); | 250 | long (*ioctl)(struct file *, unsigned int, unsigned long); |
251 | 251 | ||
@@ -268,7 +268,7 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne | |||
268 | #ifdef CONFIG_COMPAT | 268 | #ifdef CONFIG_COMPAT |
269 | static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 269 | static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
270 | { | 270 | { |
271 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 271 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
272 | long rv = -ENOTTY; | 272 | long rv = -ENOTTY; |
273 | long (*compat_ioctl)(struct file *, unsigned int, unsigned long); | 273 | long (*compat_ioctl)(struct file *, unsigned int, unsigned long); |
274 | 274 | ||
@@ -291,7 +291,7 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned | |||
291 | 291 | ||
292 | static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma) | 292 | static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma) |
293 | { | 293 | { |
294 | struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 294 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
295 | int rv = -EIO; | 295 | int rv = -EIO; |
296 | int (*mmap)(struct file *, struct vm_area_struct *); | 296 | int (*mmap)(struct file *, struct vm_area_struct *); |
297 | 297 | ||
@@ -445,12 +445,9 @@ static const struct file_operations proc_reg_file_ops_no_compat = { | |||
445 | 445 | ||
446 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | 446 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) |
447 | { | 447 | { |
448 | struct inode * inode; | 448 | struct inode *inode = iget_locked(sb, de->low_ino); |
449 | 449 | ||
450 | inode = iget_locked(sb, de->low_ino); | 450 | if (inode && (inode->i_state & I_NEW)) { |
451 | if (!inode) | ||
452 | return NULL; | ||
453 | if (inode->i_state & I_NEW) { | ||
454 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 451 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
455 | PROC_I(inode)->pde = de; | 452 | PROC_I(inode)->pde = de; |
456 | 453 | ||
@@ -482,10 +479,12 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | |||
482 | } else | 479 | } else |
483 | pde_put(de); | 480 | pde_put(de); |
484 | return inode; | 481 | return inode; |
485 | } | 482 | } |
486 | 483 | ||
487 | int proc_fill_super(struct super_block *s) | 484 | int proc_fill_super(struct super_block *s) |
488 | { | 485 | { |
486 | struct inode *root_inode; | ||
487 | |||
489 | s->s_flags |= MS_NODIRATIME | MS_NOSUID | MS_NOEXEC; | 488 | s->s_flags |= MS_NODIRATIME | MS_NOSUID | MS_NOEXEC; |
490 | s->s_blocksize = 1024; | 489 | s->s_blocksize = 1024; |
491 | s->s_blocksize_bits = 10; | 490 | s->s_blocksize_bits = 10; |
@@ -494,11 +493,17 @@ int proc_fill_super(struct super_block *s) | |||
494 | s->s_time_gran = 1; | 493 | s->s_time_gran = 1; |
495 | 494 | ||
496 | pde_get(&proc_root); | 495 | pde_get(&proc_root); |
497 | s->s_root = d_make_root(proc_get_inode(s, &proc_root)); | 496 | root_inode = proc_get_inode(s, &proc_root); |
498 | if (s->s_root) | 497 | if (!root_inode) { |
499 | return 0; | 498 | printk(KERN_ERR "proc_fill_super: get root inode failed\n"); |
499 | return -ENOMEM; | ||
500 | } | ||
500 | 501 | ||
501 | printk("proc_read_super: get root inode failed\n"); | 502 | s->s_root = d_make_root(root_inode); |
502 | pde_put(&proc_root); | 503 | if (!s->s_root) { |
503 | return -ENOMEM; | 504 | printk(KERN_ERR "proc_fill_super: allocate dentry failed\n"); |
505 | return -ENOMEM; | ||
506 | } | ||
507 | |||
508 | return 0; | ||
504 | } | 509 | } |
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c index b1822dde55c2..ccfd99bd1c5a 100644 --- a/fs/proc/nommu.c +++ b/fs/proc/nommu.c | |||
@@ -45,7 +45,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region) | |||
45 | file = region->vm_file; | 45 | file = region->vm_file; |
46 | 46 | ||
47 | if (file) { | 47 | if (file) { |
48 | struct inode *inode = region->vm_file->f_path.dentry->d_inode; | 48 | struct inode *inode = file_inode(region->vm_file); |
49 | dev = inode->i_sb->s_dev; | 49 | dev = inode->i_sb->s_dev; |
50 | ino = inode->i_ino; | 50 | ino = inode->i_ino; |
51 | } | 51 | } |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 3131a03d7d37..b4ac6572474f 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -163,7 +163,7 @@ static int proc_tgid_net_readdir(struct file *filp, void *dirent, | |||
163 | struct net *net; | 163 | struct net *net; |
164 | 164 | ||
165 | ret = -EINVAL; | 165 | ret = -EINVAL; |
166 | net = get_proc_task_net(filp->f_path.dentry->d_inode); | 166 | net = get_proc_task_net(file_inode(filp)); |
167 | if (net != NULL) { | 167 | if (net != NULL) { |
168 | ret = proc_readdir_de(net->proc_net, filp, dirent, filldir); | 168 | ret = proc_readdir_de(net->proc_net, filp, dirent, filldir); |
169 | put_net(net); | 169 | put_net(net); |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 1827d88ad58b..612df79cc6a1 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -478,7 +478,7 @@ out: | |||
478 | static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf, | 478 | static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf, |
479 | size_t count, loff_t *ppos, int write) | 479 | size_t count, loff_t *ppos, int write) |
480 | { | 480 | { |
481 | struct inode *inode = filp->f_path.dentry->d_inode; | 481 | struct inode *inode = file_inode(filp); |
482 | struct ctl_table_header *head = grab_header(inode); | 482 | struct ctl_table_header *head = grab_header(inode); |
483 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; | 483 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; |
484 | ssize_t error; | 484 | ssize_t error; |
@@ -542,7 +542,7 @@ static int proc_sys_open(struct inode *inode, struct file *filp) | |||
542 | 542 | ||
543 | static unsigned int proc_sys_poll(struct file *filp, poll_table *wait) | 543 | static unsigned int proc_sys_poll(struct file *filp, poll_table *wait) |
544 | { | 544 | { |
545 | struct inode *inode = filp->f_path.dentry->d_inode; | 545 | struct inode *inode = file_inode(filp); |
546 | struct ctl_table_header *head = grab_header(inode); | 546 | struct ctl_table_header *head = grab_header(inode); |
547 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; | 547 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; |
548 | unsigned int ret = DEFAULT_POLLMASK; | 548 | unsigned int ret = DEFAULT_POLLMASK; |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index ca5ce7f9f800..3e636d864d56 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -271,7 +271,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) | |||
271 | const char *name = NULL; | 271 | const char *name = NULL; |
272 | 272 | ||
273 | if (file) { | 273 | if (file) { |
274 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 274 | struct inode *inode = file_inode(vma->vm_file); |
275 | dev = inode->i_sb->s_dev; | 275 | dev = inode->i_sb->s_dev; |
276 | ino = inode->i_ino; | 276 | ino = inode->i_ino; |
277 | pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT; | 277 | pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT; |
@@ -743,7 +743,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, | |||
743 | return rv; | 743 | return rv; |
744 | if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED) | 744 | if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED) |
745 | return -EINVAL; | 745 | return -EINVAL; |
746 | task = get_proc_task(file->f_path.dentry->d_inode); | 746 | task = get_proc_task(file_inode(file)); |
747 | if (!task) | 747 | if (!task) |
748 | return -ESRCH; | 748 | return -ESRCH; |
749 | mm = get_task_mm(task); | 749 | mm = get_task_mm(task); |
@@ -1015,7 +1015,7 @@ static int pagemap_hugetlb_range(pte_t *pte, unsigned long hmask, | |||
1015 | static ssize_t pagemap_read(struct file *file, char __user *buf, | 1015 | static ssize_t pagemap_read(struct file *file, char __user *buf, |
1016 | size_t count, loff_t *ppos) | 1016 | size_t count, loff_t *ppos) |
1017 | { | 1017 | { |
1018 | struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); | 1018 | struct task_struct *task = get_proc_task(file_inode(file)); |
1019 | struct mm_struct *mm; | 1019 | struct mm_struct *mm; |
1020 | struct pagemapread pm; | 1020 | struct pagemapread pm; |
1021 | int ret = -ESRCH; | 1021 | int ret = -ESRCH; |
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 1ccfa537f5f5..56123a6f462e 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -149,7 +149,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, | |||
149 | file = vma->vm_file; | 149 | file = vma->vm_file; |
150 | 150 | ||
151 | if (file) { | 151 | if (file) { |
152 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 152 | struct inode *inode = file_inode(vma->vm_file); |
153 | dev = inode->i_sb->s_dev; | 153 | dev = inode->i_sb->s_dev; |
154 | ino = inode->i_ino; | 154 | ino = inode->i_ino; |
155 | pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; | 155 | pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; |
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c index 7b0329468a5d..28ce014b3cef 100644 --- a/fs/qnx4/dir.c +++ b/fs/qnx4/dir.c | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir) | 17 | static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir) |
18 | { | 18 | { |
19 | struct inode *inode = filp->f_path.dentry->d_inode; | 19 | struct inode *inode = file_inode(filp); |
20 | unsigned int offset; | 20 | unsigned int offset; |
21 | struct buffer_head *bh; | 21 | struct buffer_head *bh; |
22 | struct qnx4_inode_entry *de; | 22 | struct qnx4_inode_entry *de; |
diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c index dc597353db3b..8798d065e400 100644 --- a/fs/qnx6/dir.c +++ b/fs/qnx6/dir.c | |||
@@ -117,7 +117,7 @@ static int qnx6_dir_longfilename(struct inode *inode, | |||
117 | 117 | ||
118 | static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir) | 118 | static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir) |
119 | { | 119 | { |
120 | struct inode *inode = filp->f_path.dentry->d_inode; | 120 | struct inode *inode = file_inode(filp); |
121 | struct super_block *s = inode->i_sb; | 121 | struct super_block *s = inode->i_sb; |
122 | struct qnx6_sb_info *sbi = QNX6_SB(s); | 122 | struct qnx6_sb_info *sbi = QNX6_SB(s); |
123 | loff_t pos = filp->f_pos & (QNX6_DIR_ENTRY_SIZE - 1); | 123 | loff_t pos = filp->f_pos & (QNX6_DIR_ENTRY_SIZE - 1); |
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index d5378d028589..8d5b438cc188 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -202,7 +202,7 @@ unsigned long ramfs_nommu_get_unmapped_area(struct file *file, | |||
202 | unsigned long pgoff, unsigned long flags) | 202 | unsigned long pgoff, unsigned long flags) |
203 | { | 203 | { |
204 | unsigned long maxpages, lpages, nr, loop, ret; | 204 | unsigned long maxpages, lpages, nr, loop, ret; |
205 | struct inode *inode = file->f_path.dentry->d_inode; | 205 | struct inode *inode = file_inode(file); |
206 | struct page **pages = NULL, **ptr, *page; | 206 | struct page **pages = NULL, **ptr, *page; |
207 | loff_t isize; | 207 | loff_t isize; |
208 | 208 | ||
diff --git a/fs/read_write.c b/fs/read_write.c index bb34af315280..3ae6dbe828bf 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -163,7 +163,7 @@ EXPORT_SYMBOL(no_llseek); | |||
163 | 163 | ||
164 | loff_t default_llseek(struct file *file, loff_t offset, int whence) | 164 | loff_t default_llseek(struct file *file, loff_t offset, int whence) |
165 | { | 165 | { |
166 | struct inode *inode = file->f_path.dentry->d_inode; | 166 | struct inode *inode = file_inode(file); |
167 | loff_t retval; | 167 | loff_t retval; |
168 | 168 | ||
169 | mutex_lock(&inode->i_mutex); | 169 | mutex_lock(&inode->i_mutex); |
@@ -290,7 +290,7 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count | |||
290 | loff_t pos; | 290 | loff_t pos; |
291 | int retval = -EINVAL; | 291 | int retval = -EINVAL; |
292 | 292 | ||
293 | inode = file->f_path.dentry->d_inode; | 293 | inode = file_inode(file); |
294 | if (unlikely((ssize_t) count < 0)) | 294 | if (unlikely((ssize_t) count < 0)) |
295 | return retval; | 295 | return retval; |
296 | pos = *ppos; | 296 | pos = *ppos; |
@@ -901,8 +901,8 @@ ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count, | |||
901 | if (!(out.file->f_mode & FMODE_WRITE)) | 901 | if (!(out.file->f_mode & FMODE_WRITE)) |
902 | goto fput_out; | 902 | goto fput_out; |
903 | retval = -EINVAL; | 903 | retval = -EINVAL; |
904 | in_inode = in.file->f_path.dentry->d_inode; | 904 | in_inode = file_inode(in.file); |
905 | out_inode = out.file->f_path.dentry->d_inode; | 905 | out_inode = file_inode(out.file); |
906 | retval = rw_verify_area(WRITE, out.file, &out.file->f_pos, count); | 906 | retval = rw_verify_area(WRITE, out.file, &out.file->f_pos, count); |
907 | if (retval < 0) | 907 | if (retval < 0) |
908 | goto fput_out; | 908 | goto fput_out; |
diff --git a/fs/readdir.c b/fs/readdir.c index 5e69ef533b77..fee38e04fae4 100644 --- a/fs/readdir.c +++ b/fs/readdir.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | int vfs_readdir(struct file *file, filldir_t filler, void *buf) | 23 | int vfs_readdir(struct file *file, filldir_t filler, void *buf) |
24 | { | 24 | { |
25 | struct inode *inode = file->f_path.dentry->d_inode; | 25 | struct inode *inode = file_inode(file); |
26 | int res = -ENOTDIR; | 26 | int res = -ENOTDIR; |
27 | if (!file->f_op || !file->f_op->readdir) | 27 | if (!file->f_op || !file->f_op->readdir) |
28 | goto out; | 28 | goto out; |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 50302d6f8895..6165bd4784f6 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -268,7 +268,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
268 | * new current position before returning. */ | 268 | * new current position before returning. */ |
269 | ) | 269 | ) |
270 | { | 270 | { |
271 | struct inode *inode = file->f_path.dentry->d_inode; // Inode of the file that we are writing to. | 271 | struct inode *inode = file_inode(file); // Inode of the file that we are writing to. |
272 | /* To simplify coding at this time, we store | 272 | /* To simplify coding at this time, we store |
273 | locked pages in array for now */ | 273 | locked pages in array for now */ |
274 | struct reiserfs_transaction_handle th; | 274 | struct reiserfs_transaction_handle th; |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 95d7680ead47..ea5061fd4f3e 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1603,10 +1603,10 @@ int reiserfs_encode_fh(struct inode *inode, __u32 * data, int *lenp, | |||
1603 | 1603 | ||
1604 | if (parent && (maxlen < 5)) { | 1604 | if (parent && (maxlen < 5)) { |
1605 | *lenp = 5; | 1605 | *lenp = 5; |
1606 | return 255; | 1606 | return FILEID_INVALID; |
1607 | } else if (maxlen < 3) { | 1607 | } else if (maxlen < 3) { |
1608 | *lenp = 3; | 1608 | *lenp = 3; |
1609 | return 255; | 1609 | return FILEID_INVALID; |
1610 | } | 1610 | } |
1611 | 1611 | ||
1612 | data[0] = inode->i_ino; | 1612 | data[0] = inode->i_ino; |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 0c2185042d5f..15cb5fe6b425 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 22 | long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
23 | { | 23 | { |
24 | struct inode *inode = filp->f_path.dentry->d_inode; | 24 | struct inode *inode = file_inode(filp); |
25 | unsigned int flags; | 25 | unsigned int flags; |
26 | int err = 0; | 26 | int err = 0; |
27 | 27 | ||
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index e60e87035bb3..9cc0740adffa 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -281,7 +281,7 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb) | |||
281 | } | 281 | } |
282 | #if defined( REISERFS_USE_OIDMAPF ) | 282 | #if defined( REISERFS_USE_OIDMAPF ) |
283 | if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) { | 283 | if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) { |
284 | loff_t size = sb_info->oidmap.mapf->f_path.dentry->d_inode->i_size; | 284 | loff_t size = file_inode(sb_info->oidmap.mapf)->i_size; |
285 | total_used += size / sizeof(reiserfs_oidinterval_d_t); | 285 | total_used += size / sizeof(reiserfs_oidinterval_d_t); |
286 | } | 286 | } |
287 | #endif | 287 | #endif |
diff --git a/fs/romfs/super.c b/fs/romfs/super.c index fd7c5f60b46b..7e8d3a80bdab 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c | |||
@@ -147,7 +147,7 @@ static const struct address_space_operations romfs_aops = { | |||
147 | */ | 147 | */ |
148 | static int romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 148 | static int romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
149 | { | 149 | { |
150 | struct inode *i = filp->f_dentry->d_inode; | 150 | struct inode *i = file_inode(filp); |
151 | struct romfs_inode ri; | 151 | struct romfs_inode ri; |
152 | unsigned long offset, maxoff; | 152 | unsigned long offset, maxoff; |
153 | int j, ino, nextfh; | 153 | int j, ino, nextfh; |
diff --git a/fs/splice.c b/fs/splice.c index 6909d89d0da5..718bd0056384 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -569,7 +569,7 @@ static ssize_t kernel_readv(struct file *file, const struct iovec *vec, | |||
569 | return res; | 569 | return res; |
570 | } | 570 | } |
571 | 571 | ||
572 | static ssize_t kernel_write(struct file *file, const char *buf, size_t count, | 572 | ssize_t kernel_write(struct file *file, const char *buf, size_t count, |
573 | loff_t pos) | 573 | loff_t pos) |
574 | { | 574 | { |
575 | mm_segment_t old_fs; | 575 | mm_segment_t old_fs; |
@@ -578,11 +578,12 @@ static ssize_t kernel_write(struct file *file, const char *buf, size_t count, | |||
578 | old_fs = get_fs(); | 578 | old_fs = get_fs(); |
579 | set_fs(get_ds()); | 579 | set_fs(get_ds()); |
580 | /* The cast to a user pointer is valid due to the set_fs() */ | 580 | /* The cast to a user pointer is valid due to the set_fs() */ |
581 | res = vfs_write(file, (const char __user *)buf, count, &pos); | 581 | res = vfs_write(file, (__force const char __user *)buf, count, &pos); |
582 | set_fs(old_fs); | 582 | set_fs(old_fs); |
583 | 583 | ||
584 | return res; | 584 | return res; |
585 | } | 585 | } |
586 | EXPORT_SYMBOL(kernel_write); | ||
586 | 587 | ||
587 | ssize_t default_file_splice_read(struct file *in, loff_t *ppos, | 588 | ssize_t default_file_splice_read(struct file *in, loff_t *ppos, |
588 | struct pipe_inode_info *pipe, size_t len, | 589 | struct pipe_inode_info *pipe, size_t len, |
@@ -1170,7 +1171,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
1170 | * randomly drop data for eg socket -> socket splicing. Use the | 1171 | * randomly drop data for eg socket -> socket splicing. Use the |
1171 | * piped splicing for that! | 1172 | * piped splicing for that! |
1172 | */ | 1173 | */ |
1173 | i_mode = in->f_path.dentry->d_inode->i_mode; | 1174 | i_mode = file_inode(in)->i_mode; |
1174 | if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) | 1175 | if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) |
1175 | return -EINVAL; | 1176 | return -EINVAL; |
1176 | 1177 | ||
diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c index b381305c9a47..57dc70ebbb19 100644 --- a/fs/squashfs/dir.c +++ b/fs/squashfs/dir.c | |||
@@ -102,7 +102,7 @@ static int get_dir_index_using_offset(struct super_block *sb, | |||
102 | 102 | ||
103 | static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) | 103 | static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) |
104 | { | 104 | { |
105 | struct inode *inode = file->f_dentry->d_inode; | 105 | struct inode *inode = file_inode(file); |
106 | struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; | 106 | struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; |
107 | u64 block = squashfs_i(inode)->start + msblk->directory_table; | 107 | u64 block = squashfs_i(inode)->start + msblk->directory_table; |
108 | int offset = squashfs_i(inode)->offset, length, dir_count, size, | 108 | int offset = squashfs_i(inode)->offset, length, dir_count, size, |
@@ -37,17 +37,17 @@ void generic_fillattr(struct inode *inode, struct kstat *stat) | |||
37 | 37 | ||
38 | EXPORT_SYMBOL(generic_fillattr); | 38 | EXPORT_SYMBOL(generic_fillattr); |
39 | 39 | ||
40 | int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 40 | int vfs_getattr(struct path *path, struct kstat *stat) |
41 | { | 41 | { |
42 | struct inode *inode = dentry->d_inode; | 42 | struct inode *inode = path->dentry->d_inode; |
43 | int retval; | 43 | int retval; |
44 | 44 | ||
45 | retval = security_inode_getattr(mnt, dentry); | 45 | retval = security_inode_getattr(path->mnt, path->dentry); |
46 | if (retval) | 46 | if (retval) |
47 | return retval; | 47 | return retval; |
48 | 48 | ||
49 | if (inode->i_op->getattr) | 49 | if (inode->i_op->getattr) |
50 | return inode->i_op->getattr(mnt, dentry, stat); | 50 | return inode->i_op->getattr(path->mnt, path->dentry, stat); |
51 | 51 | ||
52 | generic_fillattr(inode, stat); | 52 | generic_fillattr(inode, stat); |
53 | return 0; | 53 | return 0; |
@@ -61,8 +61,7 @@ int vfs_fstat(unsigned int fd, struct kstat *stat) | |||
61 | int error = -EBADF; | 61 | int error = -EBADF; |
62 | 62 | ||
63 | if (f.file) { | 63 | if (f.file) { |
64 | error = vfs_getattr(f.file->f_path.mnt, f.file->f_path.dentry, | 64 | error = vfs_getattr(&f.file->f_path, stat); |
65 | stat); | ||
66 | fdput(f); | 65 | fdput(f); |
67 | } | 66 | } |
68 | return error; | 67 | return error; |
@@ -89,7 +88,7 @@ retry: | |||
89 | if (error) | 88 | if (error) |
90 | goto out; | 89 | goto out; |
91 | 90 | ||
92 | error = vfs_getattr(path.mnt, path.dentry, stat); | 91 | error = vfs_getattr(&path, stat); |
93 | path_put(&path); | 92 | path_put(&path); |
94 | if (retry_estale(error, lookup_flags)) { | 93 | if (retry_estale(error, lookup_flags)) { |
95 | lookup_flags |= LOOKUP_REVAL; | 94 | lookup_flags |= LOOKUP_REVAL; |
@@ -332,7 +332,7 @@ SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes, | |||
332 | if (!f.file) | 332 | if (!f.file) |
333 | goto out; | 333 | goto out; |
334 | 334 | ||
335 | i_mode = f.file->f_path.dentry->d_inode->i_mode; | 335 | i_mode = file_inode(f.file)->i_mode; |
336 | ret = -ESPIPE; | 336 | ret = -ESPIPE; |
337 | if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) && | 337 | if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) && |
338 | !S_ISLNK(i_mode)) | 338 | !S_ISLNK(i_mode)) |
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index 614b2b544880..2ce9a5db6ab5 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -70,7 +70,7 @@ static ssize_t | |||
70 | read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off) | 70 | read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off) |
71 | { | 71 | { |
72 | struct bin_buffer *bb = file->private_data; | 72 | struct bin_buffer *bb = file->private_data; |
73 | int size = file->f_path.dentry->d_inode->i_size; | 73 | int size = file_inode(file)->i_size; |
74 | loff_t offs = *off; | 74 | loff_t offs = *off; |
75 | int count = min_t(size_t, bytes, PAGE_SIZE); | 75 | int count = min_t(size_t, bytes, PAGE_SIZE); |
76 | char *temp; | 76 | char *temp; |
@@ -140,7 +140,7 @@ static ssize_t write(struct file *file, const char __user *userbuf, | |||
140 | size_t bytes, loff_t *off) | 140 | size_t bytes, loff_t *off) |
141 | { | 141 | { |
142 | struct bin_buffer *bb = file->private_data; | 142 | struct bin_buffer *bb = file->private_data; |
143 | int size = file->f_path.dentry->d_inode->i_size; | 143 | int size = file_inode(file)->i_size; |
144 | loff_t offs = *off; | 144 | loff_t offs = *off; |
145 | int count = min_t(size_t, bytes, PAGE_SIZE); | 145 | int count = min_t(size_t, bytes, PAGE_SIZE); |
146 | char *temp; | 146 | char *temp; |
@@ -469,7 +469,7 @@ void unmap_bin_file(struct sysfs_dirent *attr_sd) | |||
469 | mutex_lock(&sysfs_bin_lock); | 469 | mutex_lock(&sysfs_bin_lock); |
470 | 470 | ||
471 | hlist_for_each_entry(bb, tmp, &attr_sd->s_bin_attr.buffers, list) { | 471 | hlist_for_each_entry(bb, tmp, &attr_sd->s_bin_attr.buffers, list) { |
472 | struct inode *inode = bb->file->f_path.dentry->d_inode; | 472 | struct inode *inode = file_inode(bb->file); |
473 | 473 | ||
474 | unmap_mapping_range(inode->i_mapping, 0, 0, 1); | 474 | unmap_mapping_range(inode->i_mapping, 0, 0, 1); |
475 | } | 475 | } |
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index a77c42157620..3799e8dac3eb 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c | |||
@@ -68,7 +68,7 @@ static struct page * dir_get_page(struct inode *dir, unsigned long n) | |||
68 | static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) | 68 | static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) |
69 | { | 69 | { |
70 | unsigned long pos = filp->f_pos; | 70 | unsigned long pos = filp->f_pos; |
71 | struct inode *inode = filp->f_path.dentry->d_inode; | 71 | struct inode *inode = file_inode(filp); |
72 | struct super_block *sb = inode->i_sb; | 72 | struct super_block *sb = inode->i_sb; |
73 | unsigned offset = pos & ~PAGE_CACHE_MASK; | 73 | unsigned offset = pos & ~PAGE_CACHE_MASK; |
74 | unsigned long n = pos >> PAGE_CACHE_SHIFT; | 74 | unsigned long n = pos >> PAGE_CACHE_SHIFT; |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 8a574776a493..de08c92f2e23 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -352,7 +352,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) | |||
352 | struct qstr nm; | 352 | struct qstr nm; |
353 | union ubifs_key key; | 353 | union ubifs_key key; |
354 | struct ubifs_dent_node *dent; | 354 | struct ubifs_dent_node *dent; |
355 | struct inode *dir = file->f_path.dentry->d_inode; | 355 | struct inode *dir = file_inode(file); |
356 | struct ubifs_info *c = dir->i_sb->s_fs_info; | 356 | struct ubifs_info *c = dir->i_sb->s_fs_info; |
357 | 357 | ||
358 | dbg_gen("dir ino %lu, f_pos %#llx", dir->i_ino, file->f_pos); | 358 | dbg_gen("dir ino %lu, f_pos %#llx", dir->i_ino, file->f_pos); |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 4f6493c130e0..f12189d2db1d 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -1444,7 +1444,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, | |||
1444 | struct vm_fault *vmf) | 1444 | struct vm_fault *vmf) |
1445 | { | 1445 | { |
1446 | struct page *page = vmf->page; | 1446 | struct page *page = vmf->page; |
1447 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1447 | struct inode *inode = file_inode(vma->vm_file); |
1448 | struct ubifs_info *c = inode->i_sb->s_fs_info; | 1448 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
1449 | struct timespec now = ubifs_current_time(inode); | 1449 | struct timespec now = ubifs_current_time(inode); |
1450 | struct ubifs_budget_req req = { .new_page = 1 }; | 1450 | struct ubifs_budget_req req = { .new_page = 1 }; |
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c index 1a7e2d8bdbe9..648b143606cc 100644 --- a/fs/ubifs/ioctl.c +++ b/fs/ubifs/ioctl.c | |||
@@ -147,7 +147,7 @@ out_unlock: | |||
147 | long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 147 | long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
148 | { | 148 | { |
149 | int flags, err; | 149 | int flags, err; |
150 | struct inode *inode = file->f_path.dentry->d_inode; | 150 | struct inode *inode = file_inode(file); |
151 | 151 | ||
152 | switch (cmd) { | 152 | switch (cmd) { |
153 | case FS_IOC_GETFLAGS: | 153 | case FS_IOC_GETFLAGS: |
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index eb8bfe2b89a5..b3e93f5e17c3 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
@@ -186,7 +186,7 @@ out: | |||
186 | 186 | ||
187 | static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir) | 187 | static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir) |
188 | { | 188 | { |
189 | struct inode *dir = filp->f_path.dentry->d_inode; | 189 | struct inode *dir = file_inode(filp); |
190 | int result; | 190 | int result; |
191 | 191 | ||
192 | if (filp->f_pos == 0) { | 192 | if (filp->f_pos == 0) { |
diff --git a/fs/udf/file.c b/fs/udf/file.c index 77b5953eaac8..29569dd08168 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -139,7 +139,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
139 | { | 139 | { |
140 | ssize_t retval; | 140 | ssize_t retval; |
141 | struct file *file = iocb->ki_filp; | 141 | struct file *file = iocb->ki_filp; |
142 | struct inode *inode = file->f_path.dentry->d_inode; | 142 | struct inode *inode = file_inode(file); |
143 | int err, pos; | 143 | int err, pos; |
144 | size_t count = iocb->ki_left; | 144 | size_t count = iocb->ki_left; |
145 | struct udf_inode_info *iinfo = UDF_I(inode); | 145 | struct udf_inode_info *iinfo = UDF_I(inode); |
@@ -178,7 +178,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
178 | 178 | ||
179 | long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 179 | long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
180 | { | 180 | { |
181 | struct inode *inode = filp->f_dentry->d_inode; | 181 | struct inode *inode = file_inode(filp); |
182 | long old_block, new_block; | 182 | long old_block, new_block; |
183 | int result = -EINVAL; | 183 | int result = -EINVAL; |
184 | 184 | ||
@@ -204,7 +204,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
204 | goto out; | 204 | goto out; |
205 | case UDF_RELOCATE_BLOCKS: | 205 | case UDF_RELOCATE_BLOCKS: |
206 | if (!capable(CAP_SYS_ADMIN)) { | 206 | if (!capable(CAP_SYS_ADMIN)) { |
207 | result = -EACCES; | 207 | result = -EPERM; |
208 | goto out; | 208 | goto out; |
209 | } | 209 | } |
210 | if (get_user(old_block, (long __user *)arg)) { | 210 | if (get_user(old_block, (long __user *)arg)) { |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 95fee278ab9d..102c072c6bbf 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -1270,10 +1270,10 @@ static int udf_encode_fh(struct inode *inode, __u32 *fh, int *lenp, | |||
1270 | 1270 | ||
1271 | if (parent && (len < 5)) { | 1271 | if (parent && (len < 5)) { |
1272 | *lenp = 5; | 1272 | *lenp = 5; |
1273 | return 255; | 1273 | return FILEID_INVALID; |
1274 | } else if (len < 3) { | 1274 | } else if (len < 3) { |
1275 | *lenp = 3; | 1275 | *lenp = 3; |
1276 | return 255; | 1276 | return FILEID_INVALID; |
1277 | } | 1277 | } |
1278 | 1278 | ||
1279 | *lenp = 3; | 1279 | *lenp = 3; |
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index dbc90994715a..3a75ca09c506 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
@@ -433,7 +433,7 @@ static int | |||
433 | ufs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 433 | ufs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
434 | { | 434 | { |
435 | loff_t pos = filp->f_pos; | 435 | loff_t pos = filp->f_pos; |
436 | struct inode *inode = filp->f_path.dentry->d_inode; | 436 | struct inode *inode = file_inode(filp); |
437 | struct super_block *sb = inode->i_sb; | 437 | struct super_block *sb = inode->i_sb; |
438 | unsigned int offset = pos & ~PAGE_CACHE_MASK; | 438 | unsigned int offset = pos & ~PAGE_CACHE_MASK; |
439 | unsigned long n = pos >> PAGE_CACHE_SHIFT; | 439 | unsigned long n = pos >> PAGE_CACHE_SHIFT; |
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index a8bd26b82ecb..f852b082a084 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c | |||
@@ -78,14 +78,14 @@ xfs_swapext( | |||
78 | goto out_put_tmp_file; | 78 | goto out_put_tmp_file; |
79 | } | 79 | } |
80 | 80 | ||
81 | if (IS_SWAPFILE(f.file->f_path.dentry->d_inode) || | 81 | if (IS_SWAPFILE(file_inode(f.file)) || |
82 | IS_SWAPFILE(tmp.file->f_path.dentry->d_inode)) { | 82 | IS_SWAPFILE(file_inode(tmp.file))) { |
83 | error = XFS_ERROR(EINVAL); | 83 | error = XFS_ERROR(EINVAL); |
84 | goto out_put_tmp_file; | 84 | goto out_put_tmp_file; |
85 | } | 85 | } |
86 | 86 | ||
87 | ip = XFS_I(f.file->f_path.dentry->d_inode); | 87 | ip = XFS_I(file_inode(f.file)); |
88 | tip = XFS_I(tmp.file->f_path.dentry->d_inode); | 88 | tip = XFS_I(file_inode(tmp.file)); |
89 | 89 | ||
90 | if (ip->i_mount != tip->i_mount) { | 90 | if (ip->i_mount != tip->i_mount) { |
91 | error = XFS_ERROR(EINVAL); | 91 | error = XFS_ERROR(EINVAL); |
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c index a83611849cee..c585bc646395 100644 --- a/fs/xfs/xfs_export.c +++ b/fs/xfs/xfs_export.c | |||
@@ -48,7 +48,7 @@ static int xfs_fileid_length(int fileid_type) | |||
48 | case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: | 48 | case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: |
49 | return 6; | 49 | return 6; |
50 | } | 50 | } |
51 | return 255; /* invalid */ | 51 | return FILEID_INVALID; |
52 | } | 52 | } |
53 | 53 | ||
54 | STATIC int | 54 | STATIC int |
@@ -90,7 +90,7 @@ xfs_fs_encode_fh( | |||
90 | len = xfs_fileid_length(fileid_type); | 90 | len = xfs_fileid_length(fileid_type); |
91 | if (*max_len < len) { | 91 | if (*max_len < len) { |
92 | *max_len = len; | 92 | *max_len = len; |
93 | return 255; | 93 | return FILEID_INVALID; |
94 | } | 94 | } |
95 | *max_len = len; | 95 | *max_len = len; |
96 | 96 | ||
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 67284edb84d7..f03bf1a456fb 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -811,7 +811,7 @@ xfs_file_fallocate( | |||
811 | loff_t offset, | 811 | loff_t offset, |
812 | loff_t len) | 812 | loff_t len) |
813 | { | 813 | { |
814 | struct inode *inode = file->f_path.dentry->d_inode; | 814 | struct inode *inode = file_inode(file); |
815 | long error; | 815 | long error; |
816 | loff_t new_size = 0; | 816 | loff_t new_size = 0; |
817 | xfs_flock64_t bf; | 817 | xfs_flock64_t bf; |
@@ -912,7 +912,7 @@ xfs_file_readdir( | |||
912 | void *dirent, | 912 | void *dirent, |
913 | filldir_t filldir) | 913 | filldir_t filldir) |
914 | { | 914 | { |
915 | struct inode *inode = filp->f_path.dentry->d_inode; | 915 | struct inode *inode = file_inode(filp); |
916 | xfs_inode_t *ip = XFS_I(inode); | 916 | xfs_inode_t *ip = XFS_I(inode); |
917 | int error; | 917 | int error; |
918 | size_t bufsize; | 918 | size_t bufsize; |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index c1c3ef88a260..d681e34c2950 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -80,7 +80,7 @@ xfs_find_handle( | |||
80 | f = fdget(hreq->fd); | 80 | f = fdget(hreq->fd); |
81 | if (!f.file) | 81 | if (!f.file) |
82 | return -EBADF; | 82 | return -EBADF; |
83 | inode = f.file->f_path.dentry->d_inode; | 83 | inode = file_inode(f.file); |
84 | } else { | 84 | } else { |
85 | error = user_lpath((const char __user *)hreq->path, &path); | 85 | error = user_lpath((const char __user *)hreq->path, &path); |
86 | if (error) | 86 | if (error) |
@@ -168,7 +168,7 @@ xfs_handle_to_dentry( | |||
168 | /* | 168 | /* |
169 | * Only allow handle opens under a directory. | 169 | * Only allow handle opens under a directory. |
170 | */ | 170 | */ |
171 | if (!S_ISDIR(parfilp->f_path.dentry->d_inode->i_mode)) | 171 | if (!S_ISDIR(file_inode(parfilp)->i_mode)) |
172 | return ERR_PTR(-ENOTDIR); | 172 | return ERR_PTR(-ENOTDIR); |
173 | 173 | ||
174 | if (hlen != sizeof(xfs_handle_t)) | 174 | if (hlen != sizeof(xfs_handle_t)) |
@@ -1334,7 +1334,7 @@ xfs_file_ioctl( | |||
1334 | unsigned int cmd, | 1334 | unsigned int cmd, |
1335 | unsigned long p) | 1335 | unsigned long p) |
1336 | { | 1336 | { |
1337 | struct inode *inode = filp->f_path.dentry->d_inode; | 1337 | struct inode *inode = file_inode(filp); |
1338 | struct xfs_inode *ip = XFS_I(inode); | 1338 | struct xfs_inode *ip = XFS_I(inode); |
1339 | struct xfs_mount *mp = ip->i_mount; | 1339 | struct xfs_mount *mp = ip->i_mount; |
1340 | void __user *arg = (void __user *)p; | 1340 | void __user *arg = (void __user *)p; |
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index 1244274a5674..63b8fc432151 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c | |||
@@ -530,7 +530,7 @@ xfs_file_compat_ioctl( | |||
530 | unsigned cmd, | 530 | unsigned cmd, |
531 | unsigned long p) | 531 | unsigned long p) |
532 | { | 532 | { |
533 | struct inode *inode = filp->f_path.dentry->d_inode; | 533 | struct inode *inode = file_inode(filp); |
534 | struct xfs_inode *ip = XFS_I(inode); | 534 | struct xfs_inode *ip = XFS_I(inode); |
535 | struct xfs_mount *mp = ip->i_mount; | 535 | struct xfs_mount *mp = ip->i_mount; |
536 | void __user *arg = (void __user *)p; | 536 | void __user *arg = (void __user *)p; |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 0530b9860359..c3a09149f793 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -111,7 +111,6 @@ extern int suid_dumpable; | |||
111 | extern int setup_arg_pages(struct linux_binprm * bprm, | 111 | extern int setup_arg_pages(struct linux_binprm * bprm, |
112 | unsigned long stack_top, | 112 | unsigned long stack_top, |
113 | int executable_stack); | 113 | int executable_stack); |
114 | extern int bprm_mm_init(struct linux_binprm *bprm); | ||
115 | extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); | 114 | extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); |
116 | extern int copy_strings_kernel(int argc, const char *const *argv, | 115 | extern int copy_strings_kernel(int argc, const char *const *argv, |
117 | struct linux_binprm *bprm); | 116 | struct linux_binprm *bprm); |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index c1754b59ddd3..1a6bb81f0fe5 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -145,6 +145,7 @@ enum dentry_d_lock_class | |||
145 | 145 | ||
146 | struct dentry_operations { | 146 | struct dentry_operations { |
147 | int (*d_revalidate)(struct dentry *, unsigned int); | 147 | int (*d_revalidate)(struct dentry *, unsigned int); |
148 | int (*d_weak_revalidate)(struct dentry *, unsigned int); | ||
148 | int (*d_hash)(const struct dentry *, const struct inode *, | 149 | int (*d_hash)(const struct dentry *, const struct inode *, |
149 | struct qstr *); | 150 | struct qstr *); |
150 | int (*d_compare)(const struct dentry *, const struct inode *, | 151 | int (*d_compare)(const struct dentry *, const struct inode *, |
@@ -192,6 +193,8 @@ struct dentry_operations { | |||
192 | #define DCACHE_GENOCIDE 0x0200 | 193 | #define DCACHE_GENOCIDE 0x0200 |
193 | #define DCACHE_SHRINK_LIST 0x0400 | 194 | #define DCACHE_SHRINK_LIST 0x0400 |
194 | 195 | ||
196 | #define DCACHE_OP_WEAK_REVALIDATE 0x0800 | ||
197 | |||
195 | #define DCACHE_NFSFS_RENAMED 0x1000 | 198 | #define DCACHE_NFSFS_RENAMED 0x1000 |
196 | /* this dentry has been "silly renamed" and has to be deleted on the last | 199 | /* this dentry has been "silly renamed" and has to be deleted on the last |
197 | * dput() */ | 200 | * dput() */ |
@@ -293,9 +296,9 @@ extern void d_move(struct dentry *, struct dentry *); | |||
293 | extern struct dentry *d_ancestor(struct dentry *, struct dentry *); | 296 | extern struct dentry *d_ancestor(struct dentry *, struct dentry *); |
294 | 297 | ||
295 | /* appendix may either be NULL or be used for transname suffixes */ | 298 | /* appendix may either be NULL or be used for transname suffixes */ |
296 | extern struct dentry *d_lookup(struct dentry *, struct qstr *); | 299 | extern struct dentry *d_lookup(const struct dentry *, const struct qstr *); |
297 | extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); | 300 | extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); |
298 | extern struct dentry *__d_lookup(struct dentry *, struct qstr *); | 301 | extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *); |
299 | extern struct dentry *__d_lookup_rcu(const struct dentry *parent, | 302 | extern struct dentry *__d_lookup_rcu(const struct dentry *parent, |
300 | const struct qstr *name, | 303 | const struct qstr *name, |
301 | unsigned *seq, struct inode *inode); | 304 | unsigned *seq, struct inode *inode); |
@@ -333,7 +336,6 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | |||
333 | extern char *__d_path(const struct path *, const struct path *, char *, int); | 336 | extern char *__d_path(const struct path *, const struct path *, char *, int); |
334 | extern char *d_absolute_path(const struct path *, char *, int); | 337 | extern char *d_absolute_path(const struct path *, char *, int); |
335 | extern char *d_path(const struct path *, char *, int); | 338 | extern char *d_path(const struct path *, char *, int); |
336 | extern char *d_path_with_unreachable(const struct path *, char *, int); | ||
337 | extern char *dentry_path_raw(struct dentry *, char *, int); | 339 | extern char *dentry_path_raw(struct dentry *, char *, int); |
338 | extern char *dentry_path(struct dentry *, char *, int); | 340 | extern char *dentry_path(struct dentry *, char *, int); |
339 | 341 | ||
diff --git a/include/linux/elf.h b/include/linux/elf.h index 8c9048e33463..40a3c0e01b2b 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
@@ -10,6 +10,10 @@ | |||
10 | Override in asm/elf.h as needed. */ | 10 | Override in asm/elf.h as needed. */ |
11 | # define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 | 11 | # define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 |
12 | #endif | 12 | #endif |
13 | #ifndef SET_PERSONALITY | ||
14 | #define SET_PERSONALITY(ex) \ | ||
15 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) | ||
16 | #endif | ||
13 | 17 | ||
14 | #if ELF_CLASS == ELFCLASS32 | 18 | #if ELF_CLASS == ELFCLASS32 |
15 | 19 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7d2e893ec3d1..4e686a099465 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -769,7 +769,6 @@ struct file { | |||
769 | } f_u; | 769 | } f_u; |
770 | struct path f_path; | 770 | struct path f_path; |
771 | #define f_dentry f_path.dentry | 771 | #define f_dentry f_path.dentry |
772 | #define f_vfsmnt f_path.mnt | ||
773 | const struct file_operations *f_op; | 772 | const struct file_operations *f_op; |
774 | 773 | ||
775 | /* | 774 | /* |
@@ -1807,7 +1806,6 @@ struct file_system_type { | |||
1807 | #define FS_HAS_SUBTYPE 4 | 1806 | #define FS_HAS_SUBTYPE 4 |
1808 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ | 1807 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ |
1809 | #define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ | 1808 | #define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ |
1810 | #define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ | ||
1811 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ | 1809 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ |
1812 | struct dentry *(*mount) (struct file_system_type *, int, | 1810 | struct dentry *(*mount) (struct file_system_type *, int, |
1813 | const char *, void *); | 1811 | const char *, void *); |
@@ -2217,6 +2215,11 @@ static inline bool execute_ok(struct inode *inode) | |||
2217 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); | 2215 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); |
2218 | } | 2216 | } |
2219 | 2217 | ||
2218 | static inline struct inode *file_inode(struct file *f) | ||
2219 | { | ||
2220 | return f->f_path.dentry->d_inode; | ||
2221 | } | ||
2222 | |||
2220 | /* | 2223 | /* |
2221 | * get_write_access() gets write permission for a file. | 2224 | * get_write_access() gets write permission for a file. |
2222 | * put_write_access() releases this write permission. | 2225 | * put_write_access() releases this write permission. |
@@ -2239,7 +2242,7 @@ static inline int get_write_access(struct inode *inode) | |||
2239 | } | 2242 | } |
2240 | static inline int deny_write_access(struct file *file) | 2243 | static inline int deny_write_access(struct file *file) |
2241 | { | 2244 | { |
2242 | struct inode *inode = file->f_path.dentry->d_inode; | 2245 | struct inode *inode = file_inode(file); |
2243 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; | 2246 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; |
2244 | } | 2247 | } |
2245 | static inline void put_write_access(struct inode * inode) | 2248 | static inline void put_write_access(struct inode * inode) |
@@ -2249,7 +2252,7 @@ static inline void put_write_access(struct inode * inode) | |||
2249 | static inline void allow_write_access(struct file *file) | 2252 | static inline void allow_write_access(struct file *file) |
2250 | { | 2253 | { |
2251 | if (file) | 2254 | if (file) |
2252 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2255 | atomic_inc(&file_inode(file)->i_writecount); |
2253 | } | 2256 | } |
2254 | #ifdef CONFIG_IMA | 2257 | #ifdef CONFIG_IMA |
2255 | static inline void i_readcount_dec(struct inode *inode) | 2258 | static inline void i_readcount_dec(struct inode *inode) |
@@ -2274,6 +2277,7 @@ static inline void i_readcount_inc(struct inode *inode) | |||
2274 | extern int do_pipe_flags(int *, int); | 2277 | extern int do_pipe_flags(int *, int); |
2275 | 2278 | ||
2276 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); | 2279 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); |
2280 | extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t); | ||
2277 | extern struct file * open_exec(const char *); | 2281 | extern struct file * open_exec(const char *); |
2278 | 2282 | ||
2279 | /* fs/dcache.c -- generic fs support functions */ | 2283 | /* fs/dcache.c -- generic fs support functions */ |
@@ -2463,7 +2467,7 @@ extern int page_symlink(struct inode *inode, const char *symname, int len); | |||
2463 | extern const struct inode_operations page_symlink_inode_operations; | 2467 | extern const struct inode_operations page_symlink_inode_operations; |
2464 | extern int generic_readlink(struct dentry *, char __user *, int); | 2468 | extern int generic_readlink(struct dentry *, char __user *, int); |
2465 | extern void generic_fillattr(struct inode *, struct kstat *); | 2469 | extern void generic_fillattr(struct inode *, struct kstat *); |
2466 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2470 | extern int vfs_getattr(struct path *, struct kstat *); |
2467 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | 2471 | void __inode_add_bytes(struct inode *inode, loff_t bytes); |
2468 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2472 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
2469 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2473 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 0fbfb4646d1b..a78680a92dba 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -244,7 +244,7 @@ static inline void fsnotify_open(struct file *file) | |||
244 | static inline void fsnotify_close(struct file *file) | 244 | static inline void fsnotify_close(struct file *file) |
245 | { | 245 | { |
246 | struct path *path = &file->f_path; | 246 | struct path *path = &file->f_path; |
247 | struct inode *inode = file->f_path.dentry->d_inode; | 247 | struct inode *inode = file_inode(file); |
248 | fmode_t mode = file->f_mode; | 248 | fmode_t mode = file->f_mode; |
249 | __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; | 249 | __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; |
250 | 250 | ||
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index eedc334fb6f5..16e4e9a643fb 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -281,7 +281,7 @@ static inline struct hstate *hstate_inode(struct inode *i) | |||
281 | 281 | ||
282 | static inline struct hstate *hstate_file(struct file *f) | 282 | static inline struct hstate *hstate_file(struct file *f) |
283 | { | 283 | { |
284 | return hstate_inode(f->f_dentry->d_inode); | 284 | return hstate_inode(file_inode(f)); |
285 | } | 285 | } |
286 | 286 | ||
287 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) | 287 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index f5a051a79273..0e62d84f9f7f 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -291,7 +291,7 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr); | |||
291 | 291 | ||
292 | static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) | 292 | static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) |
293 | { | 293 | { |
294 | return file->f_file->f_path.dentry->d_inode; | 294 | return file_inode(file->f_file); |
295 | } | 295 | } |
296 | 296 | ||
297 | static inline int __nlm_privileged_request4(const struct sockaddr *sap) | 297 | static inline int __nlm_privileged_request4(const struct sockaddr *sap) |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 023c9867ff43..e5c4f609f22c 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -477,7 +477,7 @@ static int mqueue_unlink(struct inode *dir, struct dentry *dentry) | |||
477 | static ssize_t mqueue_read_file(struct file *filp, char __user *u_data, | 477 | static ssize_t mqueue_read_file(struct file *filp, char __user *u_data, |
478 | size_t count, loff_t *off) | 478 | size_t count, loff_t *off) |
479 | { | 479 | { |
480 | struct mqueue_inode_info *info = MQUEUE_I(filp->f_path.dentry->d_inode); | 480 | struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); |
481 | char buffer[FILENT_SIZE]; | 481 | char buffer[FILENT_SIZE]; |
482 | ssize_t ret; | 482 | ssize_t ret; |
483 | 483 | ||
@@ -498,13 +498,13 @@ static ssize_t mqueue_read_file(struct file *filp, char __user *u_data, | |||
498 | if (ret <= 0) | 498 | if (ret <= 0) |
499 | return ret; | 499 | return ret; |
500 | 500 | ||
501 | filp->f_path.dentry->d_inode->i_atime = filp->f_path.dentry->d_inode->i_ctime = CURRENT_TIME; | 501 | file_inode(filp)->i_atime = file_inode(filp)->i_ctime = CURRENT_TIME; |
502 | return ret; | 502 | return ret; |
503 | } | 503 | } |
504 | 504 | ||
505 | static int mqueue_flush_file(struct file *filp, fl_owner_t id) | 505 | static int mqueue_flush_file(struct file *filp, fl_owner_t id) |
506 | { | 506 | { |
507 | struct mqueue_inode_info *info = MQUEUE_I(filp->f_path.dentry->d_inode); | 507 | struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); |
508 | 508 | ||
509 | spin_lock(&info->lock); | 509 | spin_lock(&info->lock); |
510 | if (task_tgid(current) == info->notify_owner) | 510 | if (task_tgid(current) == info->notify_owner) |
@@ -516,7 +516,7 @@ static int mqueue_flush_file(struct file *filp, fl_owner_t id) | |||
516 | 516 | ||
517 | static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab) | 517 | static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab) |
518 | { | 518 | { |
519 | struct mqueue_inode_info *info = MQUEUE_I(filp->f_path.dentry->d_inode); | 519 | struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); |
520 | int retval = 0; | 520 | int retval = 0; |
521 | 521 | ||
522 | poll_wait(filp, &info->wait_q, poll_tab); | 522 | poll_wait(filp, &info->wait_q, poll_tab); |
@@ -973,7 +973,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, | |||
973 | goto out; | 973 | goto out; |
974 | } | 974 | } |
975 | 975 | ||
976 | inode = f.file->f_path.dentry->d_inode; | 976 | inode = file_inode(f.file); |
977 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { | 977 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
978 | ret = -EBADF; | 978 | ret = -EBADF; |
979 | goto out_fput; | 979 | goto out_fput; |
@@ -1089,7 +1089,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
1089 | goto out; | 1089 | goto out; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | inode = f.file->f_path.dentry->d_inode; | 1092 | inode = file_inode(f.file); |
1093 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { | 1093 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
1094 | ret = -EBADF; | 1094 | ret = -EBADF; |
1095 | goto out_fput; | 1095 | goto out_fput; |
@@ -1249,7 +1249,7 @@ retry: | |||
1249 | goto out; | 1249 | goto out; |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | inode = f.file->f_path.dentry->d_inode; | 1252 | inode = file_inode(f.file); |
1253 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { | 1253 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
1254 | ret = -EBADF; | 1254 | ret = -EBADF; |
1255 | goto out_fput; | 1255 | goto out_fput; |
@@ -1323,7 +1323,7 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, | |||
1323 | goto out; | 1323 | goto out; |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | inode = f.file->f_path.dentry->d_inode; | 1326 | inode = file_inode(f.file); |
1327 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { | 1327 | if (unlikely(f.file->f_op != &mqueue_file_operations)) { |
1328 | ret = -EBADF; | 1328 | ret = -EBADF; |
1329 | goto out_fput; | 1329 | goto out_fput; |
@@ -193,7 +193,7 @@ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) | |||
193 | if (!is_file_hugepages(shp->shm_file)) | 193 | if (!is_file_hugepages(shp->shm_file)) |
194 | shmem_lock(shp->shm_file, 0, shp->mlock_user); | 194 | shmem_lock(shp->shm_file, 0, shp->mlock_user); |
195 | else if (shp->mlock_user) | 195 | else if (shp->mlock_user) |
196 | user_shm_unlock(shp->shm_file->f_path.dentry->d_inode->i_size, | 196 | user_shm_unlock(file_inode(shp->shm_file)->i_size, |
197 | shp->mlock_user); | 197 | shp->mlock_user); |
198 | fput (shp->shm_file); | 198 | fput (shp->shm_file); |
199 | security_shm_free(shp); | 199 | security_shm_free(shp); |
@@ -529,7 +529,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) | |||
529 | * shmid gets reported as "inode#" in /proc/pid/maps. | 529 | * shmid gets reported as "inode#" in /proc/pid/maps. |
530 | * proc-ps tools use this. Changing this will break them. | 530 | * proc-ps tools use this. Changing this will break them. |
531 | */ | 531 | */ |
532 | file->f_dentry->d_inode->i_ino = shp->shm_perm.id; | 532 | file_inode(file)->i_ino = shp->shm_perm.id; |
533 | 533 | ||
534 | ns->shm_tot += numpages; | 534 | ns->shm_tot += numpages; |
535 | error = shp->shm_perm.id; | 535 | error = shp->shm_perm.id; |
@@ -678,7 +678,7 @@ static void shm_add_rss_swap(struct shmid_kernel *shp, | |||
678 | { | 678 | { |
679 | struct inode *inode; | 679 | struct inode *inode; |
680 | 680 | ||
681 | inode = shp->shm_file->f_path.dentry->d_inode; | 681 | inode = file_inode(shp->shm_file); |
682 | 682 | ||
683 | if (is_file_hugepages(shp->shm_file)) { | 683 | if (is_file_hugepages(shp->shm_file)) { |
684 | struct address_space *mapping = inode->i_mapping; | 684 | struct address_space *mapping = inode->i_mapping; |
@@ -1042,7 +1042,8 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr, | |||
1042 | is_file_hugepages(shp->shm_file) ? | 1042 | is_file_hugepages(shp->shm_file) ? |
1043 | &shm_file_operations_huge : | 1043 | &shm_file_operations_huge : |
1044 | &shm_file_operations); | 1044 | &shm_file_operations); |
1045 | if (!file) | 1045 | err = PTR_ERR(file); |
1046 | if (IS_ERR(file)) | ||
1046 | goto out_free; | 1047 | goto out_free; |
1047 | 1048 | ||
1048 | file->private_data = sfd; | 1049 | file->private_data = sfd; |
@@ -1175,7 +1176,7 @@ SYSCALL_DEFINE1(shmdt, char __user *, shmaddr) | |||
1175 | (vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) { | 1176 | (vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) { |
1176 | 1177 | ||
1177 | 1178 | ||
1178 | size = vma->vm_file->f_path.dentry->d_inode->i_size; | 1179 | size = file_inode(vma->vm_file)->i_size; |
1179 | do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start); | 1180 | do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start); |
1180 | /* | 1181 | /* |
1181 | * We discovered the size of the shm segment, so | 1182 | * We discovered the size of the shm segment, so |
diff --git a/kernel/acct.c b/kernel/acct.c index e8b1627ab9c7..b9bd7f098ee5 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -205,7 +205,7 @@ static int acct_on(struct filename *pathname) | |||
205 | if (IS_ERR(file)) | 205 | if (IS_ERR(file)) |
206 | return PTR_ERR(file); | 206 | return PTR_ERR(file); |
207 | 207 | ||
208 | if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) { | 208 | if (!S_ISREG(file_inode(file)->i_mode)) { |
209 | filp_close(file, NULL); | 209 | filp_close(file, NULL); |
210 | return -EACCES; | 210 | return -EACCES; |
211 | } | 211 | } |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index b5c64327e712..fb2fb11fbb25 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2645,7 +2645,7 @@ static struct dentry *cgroup_lookup(struct inode *dir, struct dentry *dentry, un | |||
2645 | */ | 2645 | */ |
2646 | static inline struct cftype *__file_cft(struct file *file) | 2646 | static inline struct cftype *__file_cft(struct file *file) |
2647 | { | 2647 | { |
2648 | if (file->f_dentry->d_inode->i_fop != &cgroup_file_operations) | 2648 | if (file_inode(file)->i_fop != &cgroup_file_operations) |
2649 | return ERR_PTR(-EINVAL); | 2649 | return ERR_PTR(-EINVAL); |
2650 | return __d_cft(file->f_dentry); | 2650 | return __d_cft(file->f_dentry); |
2651 | } | 2651 | } |
@@ -3902,7 +3902,7 @@ static int cgroup_write_event_control(struct cgroup *cgrp, struct cftype *cft, | |||
3902 | 3902 | ||
3903 | /* the process need read permission on control file */ | 3903 | /* the process need read permission on control file */ |
3904 | /* AV: shouldn't we check that it's been opened for read instead? */ | 3904 | /* AV: shouldn't we check that it's been opened for read instead? */ |
3905 | ret = inode_permission(cfile->f_path.dentry->d_inode, MAY_READ); | 3905 | ret = inode_permission(file_inode(cfile), MAY_READ); |
3906 | if (ret < 0) | 3906 | if (ret < 0) |
3907 | goto fail; | 3907 | goto fail; |
3908 | 3908 | ||
@@ -5489,7 +5489,7 @@ struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id) | |||
5489 | struct inode *inode; | 5489 | struct inode *inode; |
5490 | struct cgroup_subsys_state *css; | 5490 | struct cgroup_subsys_state *css; |
5491 | 5491 | ||
5492 | inode = f->f_dentry->d_inode; | 5492 | inode = file_inode(f); |
5493 | /* check in cgroup filesystem dir */ | 5493 | /* check in cgroup filesystem dir */ |
5494 | if (inode->i_op != &cgroup_dir_inode_operations) | 5494 | if (inode->i_op != &cgroup_dir_inode_operations) |
5495 | return ERR_PTR(-EBADF); | 5495 | return ERR_PTR(-EBADF); |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 5c75791d7269..ccc457e36354 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -3691,7 +3691,7 @@ unlock: | |||
3691 | 3691 | ||
3692 | static int perf_fasync(int fd, struct file *filp, int on) | 3692 | static int perf_fasync(int fd, struct file *filp, int on) |
3693 | { | 3693 | { |
3694 | struct inode *inode = filp->f_path.dentry->d_inode; | 3694 | struct inode *inode = file_inode(filp); |
3695 | struct perf_event *event = filp->private_data; | 3695 | struct perf_event *event = filp->private_data; |
3696 | int retval; | 3696 | int retval; |
3697 | 3697 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index 4133876d8cd2..8f62b2a0f120 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -413,7 +413,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) | |||
413 | tmp->vm_next = tmp->vm_prev = NULL; | 413 | tmp->vm_next = tmp->vm_prev = NULL; |
414 | file = tmp->vm_file; | 414 | file = tmp->vm_file; |
415 | if (file) { | 415 | if (file) { |
416 | struct inode *inode = file->f_path.dentry->d_inode; | 416 | struct inode *inode = file_inode(file); |
417 | struct address_space *mapping = file->f_mapping; | 417 | struct address_space *mapping = file->f_mapping; |
418 | 418 | ||
419 | get_file(file); | 419 | get_file(file); |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 4bd4faa6323a..397db02209ed 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -76,7 +76,7 @@ static int irq_affinity_list_proc_show(struct seq_file *m, void *v) | |||
76 | static ssize_t write_irq_affinity(int type, struct file *file, | 76 | static ssize_t write_irq_affinity(int type, struct file *file, |
77 | const char __user *buffer, size_t count, loff_t *pos) | 77 | const char __user *buffer, size_t count, loff_t *pos) |
78 | { | 78 | { |
79 | unsigned int irq = (int)(long)PDE(file->f_path.dentry->d_inode)->data; | 79 | unsigned int irq = (int)(long)PDE(file_inode(file))->data; |
80 | cpumask_var_t new_value; | 80 | cpumask_var_t new_value; |
81 | int err; | 81 | int err; |
82 | 82 | ||
diff --git a/kernel/module.c b/kernel/module.c index 921bed4794e9..0925c9a71975 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2541,7 +2541,7 @@ static int copy_module_from_fd(int fd, struct load_info *info) | |||
2541 | if (err) | 2541 | if (err) |
2542 | goto out; | 2542 | goto out; |
2543 | 2543 | ||
2544 | err = vfs_getattr(file->f_vfsmnt, file->f_dentry, &stat); | 2544 | err = vfs_getattr(&file->f_path, &stat); |
2545 | if (err) | 2545 | if (err) |
2546 | goto out; | 2546 | goto out; |
2547 | 2547 | ||
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index b781e66a8f2c..afc0456f227a 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -250,7 +250,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype) | |||
250 | return PTR_ERR(file); | 250 | return PTR_ERR(file); |
251 | 251 | ||
252 | err = -EINVAL; | 252 | err = -EINVAL; |
253 | ei = PROC_I(file->f_dentry->d_inode); | 253 | ei = PROC_I(file_inode(file)); |
254 | ops = ei->ns_ops; | 254 | ops = ei->ns_ops; |
255 | if (nstype && (ops->type != nstype)) | 255 | if (nstype && (ops->type != nstype)) |
256 | goto out; | 256 | goto out; |
diff --git a/kernel/relay.c b/kernel/relay.c index e8cd2027abbd..01ab081ac53a 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -1139,7 +1139,7 @@ static ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos, | |||
1139 | if (!desc->count) | 1139 | if (!desc->count) |
1140 | return 0; | 1140 | return 0; |
1141 | 1141 | ||
1142 | mutex_lock(&filp->f_path.dentry->d_inode->i_mutex); | 1142 | mutex_lock(&file_inode(filp)->i_mutex); |
1143 | do { | 1143 | do { |
1144 | if (!relay_file_read_avail(buf, *ppos)) | 1144 | if (!relay_file_read_avail(buf, *ppos)) |
1145 | break; | 1145 | break; |
@@ -1159,7 +1159,7 @@ static ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos, | |||
1159 | *ppos = relay_file_read_end_pos(buf, read_start, ret); | 1159 | *ppos = relay_file_read_end_pos(buf, read_start, ret); |
1160 | } | 1160 | } |
1161 | } while (desc->count && ret); | 1161 | } while (desc->count && ret); |
1162 | mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex); | 1162 | mutex_unlock(&file_inode(filp)->i_mutex); |
1163 | 1163 | ||
1164 | return desc->written; | 1164 | return desc->written; |
1165 | } | 1165 | } |
diff --git a/kernel/sys.c b/kernel/sys.c index 2e18d33ca775..e10566bee399 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1794,14 +1794,14 @@ SYSCALL_DEFINE1(umask, int, mask) | |||
1794 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | 1794 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) |
1795 | { | 1795 | { |
1796 | struct fd exe; | 1796 | struct fd exe; |
1797 | struct dentry *dentry; | 1797 | struct inode *inode; |
1798 | int err; | 1798 | int err; |
1799 | 1799 | ||
1800 | exe = fdget(fd); | 1800 | exe = fdget(fd); |
1801 | if (!exe.file) | 1801 | if (!exe.file) |
1802 | return -EBADF; | 1802 | return -EBADF; |
1803 | 1803 | ||
1804 | dentry = exe.file->f_path.dentry; | 1804 | inode = file_inode(exe.file); |
1805 | 1805 | ||
1806 | /* | 1806 | /* |
1807 | * Because the original mm->exe_file points to executable file, make | 1807 | * Because the original mm->exe_file points to executable file, make |
@@ -1809,11 +1809,11 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | |||
1809 | * overall picture. | 1809 | * overall picture. |
1810 | */ | 1810 | */ |
1811 | err = -EACCES; | 1811 | err = -EACCES; |
1812 | if (!S_ISREG(dentry->d_inode->i_mode) || | 1812 | if (!S_ISREG(inode->i_mode) || |
1813 | exe.file->f_path.mnt->mnt_flags & MNT_NOEXEC) | 1813 | exe.file->f_path.mnt->mnt_flags & MNT_NOEXEC) |
1814 | goto exit; | 1814 | goto exit; |
1815 | 1815 | ||
1816 | err = inode_permission(dentry->d_inode, MAY_EXEC); | 1816 | err = inode_permission(inode, MAY_EXEC); |
1817 | if (err) | 1817 | if (err) |
1818 | goto exit; | 1818 | goto exit; |
1819 | 1819 | ||
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c index b669ca1fa103..b25115e8c7f3 100644 --- a/kernel/sysctl_binary.c +++ b/kernel/sysctl_binary.c | |||
@@ -970,7 +970,6 @@ out: | |||
970 | static ssize_t bin_intvec(struct file *file, | 970 | static ssize_t bin_intvec(struct file *file, |
971 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | 971 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
972 | { | 972 | { |
973 | mm_segment_t old_fs = get_fs(); | ||
974 | ssize_t copied = 0; | 973 | ssize_t copied = 0; |
975 | char *buffer; | 974 | char *buffer; |
976 | ssize_t result; | 975 | ssize_t result; |
@@ -983,13 +982,10 @@ static ssize_t bin_intvec(struct file *file, | |||
983 | if (oldval && oldlen) { | 982 | if (oldval && oldlen) { |
984 | unsigned __user *vec = oldval; | 983 | unsigned __user *vec = oldval; |
985 | size_t length = oldlen / sizeof(*vec); | 984 | size_t length = oldlen / sizeof(*vec); |
986 | loff_t pos = 0; | ||
987 | char *str, *end; | 985 | char *str, *end; |
988 | int i; | 986 | int i; |
989 | 987 | ||
990 | set_fs(KERNEL_DS); | 988 | result = kernel_read(file, 0, buffer, BUFSZ - 1); |
991 | result = vfs_read(file, buffer, BUFSZ - 1, &pos); | ||
992 | set_fs(old_fs); | ||
993 | if (result < 0) | 989 | if (result < 0) |
994 | goto out_kfree; | 990 | goto out_kfree; |
995 | 991 | ||
@@ -1016,7 +1012,6 @@ static ssize_t bin_intvec(struct file *file, | |||
1016 | if (newval && newlen) { | 1012 | if (newval && newlen) { |
1017 | unsigned __user *vec = newval; | 1013 | unsigned __user *vec = newval; |
1018 | size_t length = newlen / sizeof(*vec); | 1014 | size_t length = newlen / sizeof(*vec); |
1019 | loff_t pos = 0; | ||
1020 | char *str, *end; | 1015 | char *str, *end; |
1021 | int i; | 1016 | int i; |
1022 | 1017 | ||
@@ -1032,9 +1027,7 @@ static ssize_t bin_intvec(struct file *file, | |||
1032 | str += snprintf(str, end - str, "%lu\t", value); | 1027 | str += snprintf(str, end - str, "%lu\t", value); |
1033 | } | 1028 | } |
1034 | 1029 | ||
1035 | set_fs(KERNEL_DS); | 1030 | result = kernel_write(file, buffer, str - buffer, 0); |
1036 | result = vfs_write(file, buffer, str - buffer, &pos); | ||
1037 | set_fs(old_fs); | ||
1038 | if (result < 0) | 1031 | if (result < 0) |
1039 | goto out_kfree; | 1032 | goto out_kfree; |
1040 | } | 1033 | } |
@@ -1048,7 +1041,6 @@ out: | |||
1048 | static ssize_t bin_ulongvec(struct file *file, | 1041 | static ssize_t bin_ulongvec(struct file *file, |
1049 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | 1042 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
1050 | { | 1043 | { |
1051 | mm_segment_t old_fs = get_fs(); | ||
1052 | ssize_t copied = 0; | 1044 | ssize_t copied = 0; |
1053 | char *buffer; | 1045 | char *buffer; |
1054 | ssize_t result; | 1046 | ssize_t result; |
@@ -1061,13 +1053,10 @@ static ssize_t bin_ulongvec(struct file *file, | |||
1061 | if (oldval && oldlen) { | 1053 | if (oldval && oldlen) { |
1062 | unsigned long __user *vec = oldval; | 1054 | unsigned long __user *vec = oldval; |
1063 | size_t length = oldlen / sizeof(*vec); | 1055 | size_t length = oldlen / sizeof(*vec); |
1064 | loff_t pos = 0; | ||
1065 | char *str, *end; | 1056 | char *str, *end; |
1066 | int i; | 1057 | int i; |
1067 | 1058 | ||
1068 | set_fs(KERNEL_DS); | 1059 | result = kernel_read(file, 0, buffer, BUFSZ - 1); |
1069 | result = vfs_read(file, buffer, BUFSZ - 1, &pos); | ||
1070 | set_fs(old_fs); | ||
1071 | if (result < 0) | 1060 | if (result < 0) |
1072 | goto out_kfree; | 1061 | goto out_kfree; |
1073 | 1062 | ||
@@ -1094,7 +1083,6 @@ static ssize_t bin_ulongvec(struct file *file, | |||
1094 | if (newval && newlen) { | 1083 | if (newval && newlen) { |
1095 | unsigned long __user *vec = newval; | 1084 | unsigned long __user *vec = newval; |
1096 | size_t length = newlen / sizeof(*vec); | 1085 | size_t length = newlen / sizeof(*vec); |
1097 | loff_t pos = 0; | ||
1098 | char *str, *end; | 1086 | char *str, *end; |
1099 | int i; | 1087 | int i; |
1100 | 1088 | ||
@@ -1110,9 +1098,7 @@ static ssize_t bin_ulongvec(struct file *file, | |||
1110 | str += snprintf(str, end - str, "%lu\t", value); | 1098 | str += snprintf(str, end - str, "%lu\t", value); |
1111 | } | 1099 | } |
1112 | 1100 | ||
1113 | set_fs(KERNEL_DS); | 1101 | result = kernel_write(file, buffer, str - buffer, 0); |
1114 | result = vfs_write(file, buffer, str - buffer, &pos); | ||
1115 | set_fs(old_fs); | ||
1116 | if (result < 0) | 1102 | if (result < 0) |
1117 | goto out_kfree; | 1103 | goto out_kfree; |
1118 | } | 1104 | } |
@@ -1126,19 +1112,15 @@ out: | |||
1126 | static ssize_t bin_uuid(struct file *file, | 1112 | static ssize_t bin_uuid(struct file *file, |
1127 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | 1113 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
1128 | { | 1114 | { |
1129 | mm_segment_t old_fs = get_fs(); | ||
1130 | ssize_t result, copied = 0; | 1115 | ssize_t result, copied = 0; |
1131 | 1116 | ||
1132 | /* Only supports reads */ | 1117 | /* Only supports reads */ |
1133 | if (oldval && oldlen) { | 1118 | if (oldval && oldlen) { |
1134 | loff_t pos = 0; | ||
1135 | char buf[40], *str = buf; | 1119 | char buf[40], *str = buf; |
1136 | unsigned char uuid[16]; | 1120 | unsigned char uuid[16]; |
1137 | int i; | 1121 | int i; |
1138 | 1122 | ||
1139 | set_fs(KERNEL_DS); | 1123 | result = kernel_read(file, 0, buf, sizeof(buf) - 1); |
1140 | result = vfs_read(file, buf, sizeof(buf) - 1, &pos); | ||
1141 | set_fs(old_fs); | ||
1142 | if (result < 0) | 1124 | if (result < 0) |
1143 | goto out; | 1125 | goto out; |
1144 | 1126 | ||
@@ -1174,18 +1156,14 @@ out: | |||
1174 | static ssize_t bin_dn_node_address(struct file *file, | 1156 | static ssize_t bin_dn_node_address(struct file *file, |
1175 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | 1157 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
1176 | { | 1158 | { |
1177 | mm_segment_t old_fs = get_fs(); | ||
1178 | ssize_t result, copied = 0; | 1159 | ssize_t result, copied = 0; |
1179 | 1160 | ||
1180 | if (oldval && oldlen) { | 1161 | if (oldval && oldlen) { |
1181 | loff_t pos = 0; | ||
1182 | char buf[15], *nodep; | 1162 | char buf[15], *nodep; |
1183 | unsigned long area, node; | 1163 | unsigned long area, node; |
1184 | __le16 dnaddr; | 1164 | __le16 dnaddr; |
1185 | 1165 | ||
1186 | set_fs(KERNEL_DS); | 1166 | result = kernel_read(file, 0, buf, sizeof(buf) - 1); |
1187 | result = vfs_read(file, buf, sizeof(buf) - 1, &pos); | ||
1188 | set_fs(old_fs); | ||
1189 | if (result < 0) | 1167 | if (result < 0) |
1190 | goto out; | 1168 | goto out; |
1191 | 1169 | ||
@@ -1214,7 +1192,6 @@ static ssize_t bin_dn_node_address(struct file *file, | |||
1214 | } | 1192 | } |
1215 | 1193 | ||
1216 | if (newval && newlen) { | 1194 | if (newval && newlen) { |
1217 | loff_t pos = 0; | ||
1218 | __le16 dnaddr; | 1195 | __le16 dnaddr; |
1219 | char buf[15]; | 1196 | char buf[15]; |
1220 | int len; | 1197 | int len; |
@@ -1231,9 +1208,7 @@ static ssize_t bin_dn_node_address(struct file *file, | |||
1231 | le16_to_cpu(dnaddr) >> 10, | 1208 | le16_to_cpu(dnaddr) >> 10, |
1232 | le16_to_cpu(dnaddr) & 0x3ff); | 1209 | le16_to_cpu(dnaddr) & 0x3ff); |
1233 | 1210 | ||
1234 | set_fs(KERNEL_DS); | 1211 | result = kernel_write(file, buf, len, 0); |
1235 | result = vfs_write(file, buf, len, &pos); | ||
1236 | set_fs(old_fs); | ||
1237 | if (result < 0) | 1212 | if (result < 0) |
1238 | goto out; | 1213 | goto out; |
1239 | } | 1214 | } |
diff --git a/mm/cleancache.c b/mm/cleancache.c index 32e6f4136fa2..d76ba74be2d0 100644 --- a/mm/cleancache.c +++ b/mm/cleancache.c | |||
@@ -89,7 +89,7 @@ static int cleancache_get_key(struct inode *inode, | |||
89 | fhfn = sb->s_export_op->encode_fh; | 89 | fhfn = sb->s_export_op->encode_fh; |
90 | if (fhfn) { | 90 | if (fhfn) { |
91 | len = (*fhfn)(inode, &key->u.fh[0], &maxlen, NULL); | 91 | len = (*fhfn)(inode, &key->u.fh[0], &maxlen, NULL); |
92 | if (len <= 0 || len == 255) | 92 | if (len <= FILEID_ROOT || len == FILEID_INVALID) |
93 | return -1; | 93 | return -1; |
94 | if (maxlen > CLEANCACHE_KEY_MAX) | 94 | if (maxlen > CLEANCACHE_KEY_MAX) |
95 | return -1; | 95 | return -1; |
diff --git a/mm/fadvise.c b/mm/fadvise.c index 909ec558625c..7e092689a12a 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c | |||
@@ -39,7 +39,7 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) | |||
39 | if (!f.file) | 39 | if (!f.file) |
40 | return -EBADF; | 40 | return -EBADF; |
41 | 41 | ||
42 | if (S_ISFIFO(f.file->f_path.dentry->d_inode->i_mode)) { | 42 | if (S_ISFIFO(file_inode(f.file)->i_mode)) { |
43 | ret = -ESPIPE; | 43 | ret = -ESPIPE; |
44 | goto out; | 44 | goto out; |
45 | } | 45 | } |
diff --git a/mm/filemap.c b/mm/filemap.c index c610076c30e1..e1979fdca805 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1711,7 +1711,7 @@ EXPORT_SYMBOL(filemap_fault); | |||
1711 | int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 1711 | int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
1712 | { | 1712 | { |
1713 | struct page *page = vmf->page; | 1713 | struct page *page = vmf->page; |
1714 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1714 | struct inode *inode = file_inode(vma->vm_file); |
1715 | int ret = VM_FAULT_LOCKED; | 1715 | int ret = VM_FAULT_LOCKED; |
1716 | 1716 | ||
1717 | sb_start_pagefault(inode->i_sb); | 1717 | sb_start_pagefault(inode->i_sb); |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cdb64e4d238a..0a0be33bb199 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -127,7 +127,7 @@ static inline struct hugepage_subpool *subpool_inode(struct inode *inode) | |||
127 | 127 | ||
128 | static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma) | 128 | static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma) |
129 | { | 129 | { |
130 | return subpool_inode(vma->vm_file->f_dentry->d_inode); | 130 | return subpool_inode(file_inode(vma->vm_file)); |
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
@@ -2479,7 +2479,7 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2479 | address = address & huge_page_mask(h); | 2479 | address = address & huge_page_mask(h); |
2480 | pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + | 2480 | pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + |
2481 | vma->vm_pgoff; | 2481 | vma->vm_pgoff; |
2482 | mapping = vma->vm_file->f_dentry->d_inode->i_mapping; | 2482 | mapping = file_inode(vma->vm_file)->i_mapping; |
2483 | 2483 | ||
2484 | /* | 2484 | /* |
2485 | * Take the mapping lock for the duration of the table walk. As | 2485 | * Take the mapping lock for the duration of the table walk. As |
@@ -203,7 +203,7 @@ static void __remove_shared_vm_struct(struct vm_area_struct *vma, | |||
203 | struct file *file, struct address_space *mapping) | 203 | struct file *file, struct address_space *mapping) |
204 | { | 204 | { |
205 | if (vma->vm_flags & VM_DENYWRITE) | 205 | if (vma->vm_flags & VM_DENYWRITE) |
206 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 206 | atomic_inc(&file_inode(file)->i_writecount); |
207 | if (vma->vm_flags & VM_SHARED) | 207 | if (vma->vm_flags & VM_SHARED) |
208 | mapping->i_mmap_writable--; | 208 | mapping->i_mmap_writable--; |
209 | 209 | ||
@@ -576,7 +576,7 @@ static void __vma_link_file(struct vm_area_struct *vma) | |||
576 | struct address_space *mapping = file->f_mapping; | 576 | struct address_space *mapping = file->f_mapping; |
577 | 577 | ||
578 | if (vma->vm_flags & VM_DENYWRITE) | 578 | if (vma->vm_flags & VM_DENYWRITE) |
579 | atomic_dec(&file->f_path.dentry->d_inode->i_writecount); | 579 | atomic_dec(&file_inode(file)->i_writecount); |
580 | if (vma->vm_flags & VM_SHARED) | 580 | if (vma->vm_flags & VM_SHARED) |
581 | mapping->i_mmap_writable++; | 581 | mapping->i_mmap_writable++; |
582 | 582 | ||
@@ -1229,7 +1229,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
1229 | return -EAGAIN; | 1229 | return -EAGAIN; |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | inode = file ? file->f_path.dentry->d_inode : NULL; | 1232 | inode = file ? file_inode(file) : NULL; |
1233 | 1233 | ||
1234 | if (file) { | 1234 | if (file) { |
1235 | switch (flags & MAP_TYPE) { | 1235 | switch (flags & MAP_TYPE) { |
@@ -1431,7 +1431,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, | |||
1431 | int error; | 1431 | int error; |
1432 | struct rb_node **rb_link, *rb_parent; | 1432 | struct rb_node **rb_link, *rb_parent; |
1433 | unsigned long charged = 0; | 1433 | unsigned long charged = 0; |
1434 | struct inode *inode = file ? file->f_path.dentry->d_inode : NULL; | 1434 | struct inode *inode = file ? file_inode(file) : NULL; |
1435 | 1435 | ||
1436 | /* Clear old maps */ | 1436 | /* Clear old maps */ |
1437 | error = -ENOMEM; | 1437 | error = -ENOMEM; |
diff --git a/mm/nommu.c b/mm/nommu.c index da0d210fd403..e19328087534 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -943,7 +943,7 @@ static int validate_mmap_request(struct file *file, | |||
943 | */ | 943 | */ |
944 | mapping = file->f_mapping; | 944 | mapping = file->f_mapping; |
945 | if (!mapping) | 945 | if (!mapping) |
946 | mapping = file->f_path.dentry->d_inode->i_mapping; | 946 | mapping = file_inode(file)->i_mapping; |
947 | 947 | ||
948 | capabilities = 0; | 948 | capabilities = 0; |
949 | if (mapping && mapping->backing_dev_info) | 949 | if (mapping && mapping->backing_dev_info) |
@@ -952,7 +952,7 @@ static int validate_mmap_request(struct file *file, | |||
952 | if (!capabilities) { | 952 | if (!capabilities) { |
953 | /* no explicit capabilities set, so assume some | 953 | /* no explicit capabilities set, so assume some |
954 | * defaults */ | 954 | * defaults */ |
955 | switch (file->f_path.dentry->d_inode->i_mode & S_IFMT) { | 955 | switch (file_inode(file)->i_mode & S_IFMT) { |
956 | case S_IFREG: | 956 | case S_IFREG: |
957 | case S_IFBLK: | 957 | case S_IFBLK: |
958 | capabilities = BDI_CAP_MAP_COPY; | 958 | capabilities = BDI_CAP_MAP_COPY; |
@@ -987,11 +987,11 @@ static int validate_mmap_request(struct file *file, | |||
987 | !(file->f_mode & FMODE_WRITE)) | 987 | !(file->f_mode & FMODE_WRITE)) |
988 | return -EACCES; | 988 | return -EACCES; |
989 | 989 | ||
990 | if (IS_APPEND(file->f_path.dentry->d_inode) && | 990 | if (IS_APPEND(file_inode(file)) && |
991 | (file->f_mode & FMODE_WRITE)) | 991 | (file->f_mode & FMODE_WRITE)) |
992 | return -EACCES; | 992 | return -EACCES; |
993 | 993 | ||
994 | if (locks_verify_locked(file->f_path.dentry->d_inode)) | 994 | if (locks_verify_locked(file_inode(file))) |
995 | return -EAGAIN; | 995 | return -EAGAIN; |
996 | 996 | ||
997 | if (!(capabilities & BDI_CAP_MAP_DIRECT)) | 997 | if (!(capabilities & BDI_CAP_MAP_DIRECT)) |
@@ -1327,8 +1327,8 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
1327 | continue; | 1327 | continue; |
1328 | 1328 | ||
1329 | /* search for overlapping mappings on the same file */ | 1329 | /* search for overlapping mappings on the same file */ |
1330 | if (pregion->vm_file->f_path.dentry->d_inode != | 1330 | if (file_inode(pregion->vm_file) != |
1331 | file->f_path.dentry->d_inode) | 1331 | file_inode(file)) |
1332 | continue; | 1332 | continue; |
1333 | 1333 | ||
1334 | if (pregion->vm_pgoff >= pgend) | 1334 | if (pregion->vm_pgoff >= pgend) |
diff --git a/mm/shmem.c b/mm/shmem.c index 39de1d6a077a..ed2befb4952e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1294,7 +1294,7 @@ unlock: | |||
1294 | 1294 | ||
1295 | static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 1295 | static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
1296 | { | 1296 | { |
1297 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1297 | struct inode *inode = file_inode(vma->vm_file); |
1298 | int error; | 1298 | int error; |
1299 | int ret = VM_FAULT_LOCKED; | 1299 | int ret = VM_FAULT_LOCKED; |
1300 | 1300 | ||
@@ -1312,14 +1312,14 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1312 | #ifdef CONFIG_NUMA | 1312 | #ifdef CONFIG_NUMA |
1313 | static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) | 1313 | static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) |
1314 | { | 1314 | { |
1315 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1315 | struct inode *inode = file_inode(vma->vm_file); |
1316 | return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol); | 1316 | return mpol_set_shared_policy(&SHMEM_I(inode)->policy, vma, mpol); |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, | 1319 | static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, |
1320 | unsigned long addr) | 1320 | unsigned long addr) |
1321 | { | 1321 | { |
1322 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 1322 | struct inode *inode = file_inode(vma->vm_file); |
1323 | pgoff_t index; | 1323 | pgoff_t index; |
1324 | 1324 | ||
1325 | index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | 1325 | index = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
@@ -1329,7 +1329,7 @@ static struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, | |||
1329 | 1329 | ||
1330 | int shmem_lock(struct file *file, int lock, struct user_struct *user) | 1330 | int shmem_lock(struct file *file, int lock, struct user_struct *user) |
1331 | { | 1331 | { |
1332 | struct inode *inode = file->f_path.dentry->d_inode; | 1332 | struct inode *inode = file_inode(file); |
1333 | struct shmem_inode_info *info = SHMEM_I(inode); | 1333 | struct shmem_inode_info *info = SHMEM_I(inode); |
1334 | int retval = -ENOMEM; | 1334 | int retval = -ENOMEM; |
1335 | 1335 | ||
@@ -1464,7 +1464,7 @@ shmem_write_end(struct file *file, struct address_space *mapping, | |||
1464 | 1464 | ||
1465 | static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor) | 1465 | static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc, read_actor_t actor) |
1466 | { | 1466 | { |
1467 | struct inode *inode = filp->f_path.dentry->d_inode; | 1467 | struct inode *inode = file_inode(filp); |
1468 | struct address_space *mapping = inode->i_mapping; | 1468 | struct address_space *mapping = inode->i_mapping; |
1469 | pgoff_t index; | 1469 | pgoff_t index; |
1470 | unsigned long offset; | 1470 | unsigned long offset; |
@@ -1807,7 +1807,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) | |||
1807 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, | 1807 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, |
1808 | loff_t len) | 1808 | loff_t len) |
1809 | { | 1809 | { |
1810 | struct inode *inode = file->f_path.dentry->d_inode; | 1810 | struct inode *inode = file_inode(file); |
1811 | struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); | 1811 | struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); |
1812 | struct shmem_falloc shmem_falloc; | 1812 | struct shmem_falloc shmem_falloc; |
1813 | pgoff_t start, index, end; | 1813 | pgoff_t start, index, end; |
@@ -2350,7 +2350,7 @@ static int shmem_encode_fh(struct inode *inode, __u32 *fh, int *len, | |||
2350 | { | 2350 | { |
2351 | if (*len < 3) { | 2351 | if (*len < 3) { |
2352 | *len = 3; | 2352 | *len = 3; |
2353 | return 255; | 2353 | return FILEID_INVALID; |
2354 | } | 2354 | } |
2355 | 2355 | ||
2356 | if (inode_unhashed(inode)) { | 2356 | if (inode_unhashed(inode)) { |
@@ -2879,6 +2879,16 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); | |||
2879 | 2879 | ||
2880 | /* common code */ | 2880 | /* common code */ |
2881 | 2881 | ||
2882 | static char *shmem_dname(struct dentry *dentry, char *buffer, int buflen) | ||
2883 | { | ||
2884 | return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)", | ||
2885 | dentry->d_name.name); | ||
2886 | } | ||
2887 | |||
2888 | static struct dentry_operations anon_ops = { | ||
2889 | .d_dname = shmem_dname | ||
2890 | }; | ||
2891 | |||
2882 | /** | 2892 | /** |
2883 | * shmem_file_setup - get an unlinked file living in tmpfs | 2893 | * shmem_file_setup - get an unlinked file living in tmpfs |
2884 | * @name: name for dentry (to be seen in /proc/<pid>/maps | 2894 | * @name: name for dentry (to be seen in /proc/<pid>/maps |
@@ -2887,15 +2897,14 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); | |||
2887 | */ | 2897 | */ |
2888 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) | 2898 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) |
2889 | { | 2899 | { |
2890 | int error; | 2900 | struct file *res; |
2891 | struct file *file; | ||
2892 | struct inode *inode; | 2901 | struct inode *inode; |
2893 | struct path path; | 2902 | struct path path; |
2894 | struct dentry *root; | 2903 | struct super_block *sb; |
2895 | struct qstr this; | 2904 | struct qstr this; |
2896 | 2905 | ||
2897 | if (IS_ERR(shm_mnt)) | 2906 | if (IS_ERR(shm_mnt)) |
2898 | return (void *)shm_mnt; | 2907 | return ERR_CAST(shm_mnt); |
2899 | 2908 | ||
2900 | if (size < 0 || size > MAX_LFS_FILESIZE) | 2909 | if (size < 0 || size > MAX_LFS_FILESIZE) |
2901 | return ERR_PTR(-EINVAL); | 2910 | return ERR_PTR(-EINVAL); |
@@ -2903,18 +2912,19 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags | |||
2903 | if (shmem_acct_size(flags, size)) | 2912 | if (shmem_acct_size(flags, size)) |
2904 | return ERR_PTR(-ENOMEM); | 2913 | return ERR_PTR(-ENOMEM); |
2905 | 2914 | ||
2906 | error = -ENOMEM; | 2915 | res = ERR_PTR(-ENOMEM); |
2907 | this.name = name; | 2916 | this.name = name; |
2908 | this.len = strlen(name); | 2917 | this.len = strlen(name); |
2909 | this.hash = 0; /* will go */ | 2918 | this.hash = 0; /* will go */ |
2910 | root = shm_mnt->mnt_root; | 2919 | sb = shm_mnt->mnt_sb; |
2911 | path.dentry = d_alloc(root, &this); | 2920 | path.dentry = d_alloc_pseudo(sb, &this); |
2912 | if (!path.dentry) | 2921 | if (!path.dentry) |
2913 | goto put_memory; | 2922 | goto put_memory; |
2923 | d_set_d_op(path.dentry, &anon_ops); | ||
2914 | path.mnt = mntget(shm_mnt); | 2924 | path.mnt = mntget(shm_mnt); |
2915 | 2925 | ||
2916 | error = -ENOSPC; | 2926 | res = ERR_PTR(-ENOSPC); |
2917 | inode = shmem_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0, flags); | 2927 | inode = shmem_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0, flags); |
2918 | if (!inode) | 2928 | if (!inode) |
2919 | goto put_dentry; | 2929 | goto put_dentry; |
2920 | 2930 | ||
@@ -2923,23 +2933,23 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags | |||
2923 | clear_nlink(inode); /* It is unlinked */ | 2933 | clear_nlink(inode); /* It is unlinked */ |
2924 | #ifndef CONFIG_MMU | 2934 | #ifndef CONFIG_MMU |
2925 | error = ramfs_nommu_expand_for_mapping(inode, size); | 2935 | error = ramfs_nommu_expand_for_mapping(inode, size); |
2936 | res = ERR_PTR(error); | ||
2926 | if (error) | 2937 | if (error) |
2927 | goto put_dentry; | 2938 | goto put_dentry; |
2928 | #endif | 2939 | #endif |
2929 | 2940 | ||
2930 | error = -ENFILE; | 2941 | res = alloc_file(&path, FMODE_WRITE | FMODE_READ, |
2931 | file = alloc_file(&path, FMODE_WRITE | FMODE_READ, | ||
2932 | &shmem_file_operations); | 2942 | &shmem_file_operations); |
2933 | if (!file) | 2943 | if (IS_ERR(res)) |
2934 | goto put_dentry; | 2944 | goto put_dentry; |
2935 | 2945 | ||
2936 | return file; | 2946 | return res; |
2937 | 2947 | ||
2938 | put_dentry: | 2948 | put_dentry: |
2939 | path_put(&path); | 2949 | path_put(&path); |
2940 | put_memory: | 2950 | put_memory: |
2941 | shmem_unacct_size(flags, size); | 2951 | shmem_unacct_size(flags, size); |
2942 | return ERR_PTR(error); | 2952 | return res; |
2943 | } | 2953 | } |
2944 | EXPORT_SYMBOL_GPL(shmem_file_setup); | 2954 | EXPORT_SYMBOL_GPL(shmem_file_setup); |
2945 | 2955 | ||
diff --git a/mm/swapfile.c b/mm/swapfile.c index c72c648f750c..a1f7772a01fc 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1774,7 +1774,7 @@ static int swap_show(struct seq_file *swap, void *v) | |||
1774 | len = seq_path(swap, &file->f_path, " \t\n\\"); | 1774 | len = seq_path(swap, &file->f_path, " \t\n\\"); |
1775 | seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", | 1775 | seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", |
1776 | len < 40 ? 40 - len : 1, " ", | 1776 | len < 40 ? 40 - len : 1, " ", |
1777 | S_ISBLK(file->f_path.dentry->d_inode->i_mode) ? | 1777 | S_ISBLK(file_inode(file)->i_mode) ? |
1778 | "partition" : "file\t", | 1778 | "partition" : "file\t", |
1779 | si->pages << (PAGE_SHIFT - 10), | 1779 | si->pages << (PAGE_SHIFT - 10), |
1780 | si->inuse_pages << (PAGE_SHIFT - 10), | 1780 | si->inuse_pages << (PAGE_SHIFT - 10), |
diff --git a/net/atm/proc.c b/net/atm/proc.c index b4e75340b162..6ac35ff0d6b9 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c | |||
@@ -385,7 +385,7 @@ static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, | |||
385 | page = get_zeroed_page(GFP_KERNEL); | 385 | page = get_zeroed_page(GFP_KERNEL); |
386 | if (!page) | 386 | if (!page) |
387 | return -ENOMEM; | 387 | return -ENOMEM; |
388 | dev = PDE(file->f_path.dentry->d_inode)->data; | 388 | dev = PDE(file_inode(file))->data; |
389 | if (!dev->ops->proc_read) | 389 | if (!dev->ops->proc_read) |
390 | length = -EINVAL; | 390 | length = -EINVAL; |
391 | else { | 391 | else { |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 8acce01b6dab..80e271d9e64b 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -344,7 +344,7 @@ struct net *get_net_ns_by_fd(int fd) | |||
344 | if (IS_ERR(file)) | 344 | if (IS_ERR(file)) |
345 | return ERR_CAST(file); | 345 | return ERR_CAST(file); |
346 | 346 | ||
347 | ei = PROC_I(file->f_dentry->d_inode); | 347 | ei = PROC_I(file_inode(file)); |
348 | if (ei->ns_ops == &netns_operations) | 348 | if (ei->ns_ops == &netns_operations) |
349 | net = get_net(ei->ns); | 349 | net = get_net(ei->ns); |
350 | else | 350 | else |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 75e33a7048f8..5852b249054f 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -657,7 +657,7 @@ static int clusterip_proc_release(struct inode *inode, struct file *file) | |||
657 | static ssize_t clusterip_proc_write(struct file *file, const char __user *input, | 657 | static ssize_t clusterip_proc_write(struct file *file, const char __user *input, |
658 | size_t size, loff_t *ofs) | 658 | size_t size, loff_t *ofs) |
659 | { | 659 | { |
660 | struct clusterip_config *c = PDE(file->f_path.dentry->d_inode)->data; | 660 | struct clusterip_config *c = PDE(file_inode(file))->data; |
661 | #define PROC_WRITELEN 10 | 661 | #define PROC_WRITELEN 10 |
662 | char buffer[PROC_WRITELEN+1]; | 662 | char buffer[PROC_WRITELEN+1]; |
663 | unsigned long nodenum; | 663 | unsigned long nodenum; |
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index 31bf233dae97..d9cad315229d 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c | |||
@@ -540,7 +540,7 @@ static ssize_t | |||
540 | recent_mt_proc_write(struct file *file, const char __user *input, | 540 | recent_mt_proc_write(struct file *file, const char __user *input, |
541 | size_t size, loff_t *loff) | 541 | size_t size, loff_t *loff) |
542 | { | 542 | { |
543 | const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); | 543 | const struct proc_dir_entry *pde = PDE(file_inode(file)); |
544 | struct recent_table *t = pde->data; | 544 | struct recent_table *t = pde->data; |
545 | struct recent_entry *e; | 545 | struct recent_entry *e; |
546 | char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; | 546 | char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 3d55e0c713e2..8097b4f3ead4 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -809,7 +809,7 @@ static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid) | |||
809 | 809 | ||
810 | struct sock *netlink_getsockbyfilp(struct file *filp) | 810 | struct sock *netlink_getsockbyfilp(struct file *filp) |
811 | { | 811 | { |
812 | struct inode *inode = filp->f_path.dentry->d_inode; | 812 | struct inode *inode = file_inode(filp); |
813 | struct sock *sock; | 813 | struct sock *sock; |
814 | 814 | ||
815 | if (!S_ISSOCK(inode->i_mode)) | 815 | if (!S_ISSOCK(inode->i_mode)) |
diff --git a/net/socket.c b/net/socket.c index ee0d029e5130..88f759adf3af 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -369,16 +369,15 @@ struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) | |||
369 | 369 | ||
370 | file = alloc_file(&path, FMODE_READ | FMODE_WRITE, | 370 | file = alloc_file(&path, FMODE_READ | FMODE_WRITE, |
371 | &socket_file_ops); | 371 | &socket_file_ops); |
372 | if (unlikely(!file)) { | 372 | if (unlikely(IS_ERR(file))) { |
373 | /* drop dentry, keep inode */ | 373 | /* drop dentry, keep inode */ |
374 | ihold(path.dentry->d_inode); | 374 | ihold(path.dentry->d_inode); |
375 | path_put(&path); | 375 | path_put(&path); |
376 | return ERR_PTR(-ENFILE); | 376 | return file; |
377 | } | 377 | } |
378 | 378 | ||
379 | sock->file = file; | 379 | sock->file = file; |
380 | file->f_flags = O_RDWR | (flags & O_NONBLOCK); | 380 | file->f_flags = O_RDWR | (flags & O_NONBLOCK); |
381 | file->f_pos = 0; | ||
382 | file->private_data = sock; | 381 | file->private_data = sock; |
383 | return file; | 382 | return file; |
384 | } | 383 | } |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 6ea29f4ed6c0..5257d2982ba5 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -620,7 +620,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
620 | const void *p, *end; | 620 | const void *p, *end; |
621 | void *buf; | 621 | void *buf; |
622 | struct gss_upcall_msg *gss_msg; | 622 | struct gss_upcall_msg *gss_msg; |
623 | struct rpc_pipe *pipe = RPC_I(filp->f_dentry->d_inode)->pipe; | 623 | struct rpc_pipe *pipe = RPC_I(file_inode(filp))->pipe; |
624 | struct gss_cl_ctx *ctx; | 624 | struct gss_cl_ctx *ctx; |
625 | uid_t id; | 625 | uid_t id; |
626 | kuid_t uid; | 626 | kuid_t uid; |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 9afa4393c217..f3897d10f649 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -755,7 +755,7 @@ static ssize_t cache_read(struct file *filp, char __user *buf, size_t count, | |||
755 | { | 755 | { |
756 | struct cache_reader *rp = filp->private_data; | 756 | struct cache_reader *rp = filp->private_data; |
757 | struct cache_request *rq; | 757 | struct cache_request *rq; |
758 | struct inode *inode = filp->f_path.dentry->d_inode; | 758 | struct inode *inode = file_inode(filp); |
759 | int err; | 759 | int err; |
760 | 760 | ||
761 | if (count == 0) | 761 | if (count == 0) |
@@ -886,7 +886,7 @@ static ssize_t cache_write(struct file *filp, const char __user *buf, | |||
886 | struct cache_detail *cd) | 886 | struct cache_detail *cd) |
887 | { | 887 | { |
888 | struct address_space *mapping = filp->f_mapping; | 888 | struct address_space *mapping = filp->f_mapping; |
889 | struct inode *inode = filp->f_path.dentry->d_inode; | 889 | struct inode *inode = file_inode(filp); |
890 | ssize_t ret = -EINVAL; | 890 | ssize_t ret = -EINVAL; |
891 | 891 | ||
892 | if (!cd->cache_parse) | 892 | if (!cd->cache_parse) |
@@ -1454,7 +1454,7 @@ static ssize_t write_flush(struct file *file, const char __user *buf, | |||
1454 | static ssize_t cache_read_procfs(struct file *filp, char __user *buf, | 1454 | static ssize_t cache_read_procfs(struct file *filp, char __user *buf, |
1455 | size_t count, loff_t *ppos) | 1455 | size_t count, loff_t *ppos) |
1456 | { | 1456 | { |
1457 | struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data; | 1457 | struct cache_detail *cd = PDE(file_inode(filp))->data; |
1458 | 1458 | ||
1459 | return cache_read(filp, buf, count, ppos, cd); | 1459 | return cache_read(filp, buf, count, ppos, cd); |
1460 | } | 1460 | } |
@@ -1462,14 +1462,14 @@ static ssize_t cache_read_procfs(struct file *filp, char __user *buf, | |||
1462 | static ssize_t cache_write_procfs(struct file *filp, const char __user *buf, | 1462 | static ssize_t cache_write_procfs(struct file *filp, const char __user *buf, |
1463 | size_t count, loff_t *ppos) | 1463 | size_t count, loff_t *ppos) |
1464 | { | 1464 | { |
1465 | struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data; | 1465 | struct cache_detail *cd = PDE(file_inode(filp))->data; |
1466 | 1466 | ||
1467 | return cache_write(filp, buf, count, ppos, cd); | 1467 | return cache_write(filp, buf, count, ppos, cd); |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) | 1470 | static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) |
1471 | { | 1471 | { |
1472 | struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data; | 1472 | struct cache_detail *cd = PDE(file_inode(filp))->data; |
1473 | 1473 | ||
1474 | return cache_poll(filp, wait, cd); | 1474 | return cache_poll(filp, wait, cd); |
1475 | } | 1475 | } |
@@ -1477,7 +1477,7 @@ static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) | |||
1477 | static long cache_ioctl_procfs(struct file *filp, | 1477 | static long cache_ioctl_procfs(struct file *filp, |
1478 | unsigned int cmd, unsigned long arg) | 1478 | unsigned int cmd, unsigned long arg) |
1479 | { | 1479 | { |
1480 | struct inode *inode = filp->f_path.dentry->d_inode; | 1480 | struct inode *inode = file_inode(filp); |
1481 | struct cache_detail *cd = PDE(inode)->data; | 1481 | struct cache_detail *cd = PDE(inode)->data; |
1482 | 1482 | ||
1483 | return cache_ioctl(inode, filp, cmd, arg, cd); | 1483 | return cache_ioctl(inode, filp, cmd, arg, cd); |
@@ -1546,7 +1546,7 @@ static int release_flush_procfs(struct inode *inode, struct file *filp) | |||
1546 | static ssize_t read_flush_procfs(struct file *filp, char __user *buf, | 1546 | static ssize_t read_flush_procfs(struct file *filp, char __user *buf, |
1547 | size_t count, loff_t *ppos) | 1547 | size_t count, loff_t *ppos) |
1548 | { | 1548 | { |
1549 | struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data; | 1549 | struct cache_detail *cd = PDE(file_inode(filp))->data; |
1550 | 1550 | ||
1551 | return read_flush(filp, buf, count, ppos, cd); | 1551 | return read_flush(filp, buf, count, ppos, cd); |
1552 | } | 1552 | } |
@@ -1555,7 +1555,7 @@ static ssize_t write_flush_procfs(struct file *filp, | |||
1555 | const char __user *buf, | 1555 | const char __user *buf, |
1556 | size_t count, loff_t *ppos) | 1556 | size_t count, loff_t *ppos) |
1557 | { | 1557 | { |
1558 | struct cache_detail *cd = PDE(filp->f_path.dentry->d_inode)->data; | 1558 | struct cache_detail *cd = PDE(file_inode(filp))->data; |
1559 | 1559 | ||
1560 | return write_flush(filp, buf, count, ppos, cd); | 1560 | return write_flush(filp, buf, count, ppos, cd); |
1561 | } | 1561 | } |
@@ -1686,7 +1686,7 @@ EXPORT_SYMBOL_GPL(cache_destroy_net); | |||
1686 | static ssize_t cache_read_pipefs(struct file *filp, char __user *buf, | 1686 | static ssize_t cache_read_pipefs(struct file *filp, char __user *buf, |
1687 | size_t count, loff_t *ppos) | 1687 | size_t count, loff_t *ppos) |
1688 | { | 1688 | { |
1689 | struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private; | 1689 | struct cache_detail *cd = RPC_I(file_inode(filp))->private; |
1690 | 1690 | ||
1691 | return cache_read(filp, buf, count, ppos, cd); | 1691 | return cache_read(filp, buf, count, ppos, cd); |
1692 | } | 1692 | } |
@@ -1694,14 +1694,14 @@ static ssize_t cache_read_pipefs(struct file *filp, char __user *buf, | |||
1694 | static ssize_t cache_write_pipefs(struct file *filp, const char __user *buf, | 1694 | static ssize_t cache_write_pipefs(struct file *filp, const char __user *buf, |
1695 | size_t count, loff_t *ppos) | 1695 | size_t count, loff_t *ppos) |
1696 | { | 1696 | { |
1697 | struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private; | 1697 | struct cache_detail *cd = RPC_I(file_inode(filp))->private; |
1698 | 1698 | ||
1699 | return cache_write(filp, buf, count, ppos, cd); | 1699 | return cache_write(filp, buf, count, ppos, cd); |
1700 | } | 1700 | } |
1701 | 1701 | ||
1702 | static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait) | 1702 | static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait) |
1703 | { | 1703 | { |
1704 | struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private; | 1704 | struct cache_detail *cd = RPC_I(file_inode(filp))->private; |
1705 | 1705 | ||
1706 | return cache_poll(filp, wait, cd); | 1706 | return cache_poll(filp, wait, cd); |
1707 | } | 1707 | } |
@@ -1709,7 +1709,7 @@ static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait) | |||
1709 | static long cache_ioctl_pipefs(struct file *filp, | 1709 | static long cache_ioctl_pipefs(struct file *filp, |
1710 | unsigned int cmd, unsigned long arg) | 1710 | unsigned int cmd, unsigned long arg) |
1711 | { | 1711 | { |
1712 | struct inode *inode = filp->f_dentry->d_inode; | 1712 | struct inode *inode = file_inode(filp); |
1713 | struct cache_detail *cd = RPC_I(inode)->private; | 1713 | struct cache_detail *cd = RPC_I(inode)->private; |
1714 | 1714 | ||
1715 | return cache_ioctl(inode, filp, cmd, arg, cd); | 1715 | return cache_ioctl(inode, filp, cmd, arg, cd); |
@@ -1778,7 +1778,7 @@ static int release_flush_pipefs(struct inode *inode, struct file *filp) | |||
1778 | static ssize_t read_flush_pipefs(struct file *filp, char __user *buf, | 1778 | static ssize_t read_flush_pipefs(struct file *filp, char __user *buf, |
1779 | size_t count, loff_t *ppos) | 1779 | size_t count, loff_t *ppos) |
1780 | { | 1780 | { |
1781 | struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private; | 1781 | struct cache_detail *cd = RPC_I(file_inode(filp))->private; |
1782 | 1782 | ||
1783 | return read_flush(filp, buf, count, ppos, cd); | 1783 | return read_flush(filp, buf, count, ppos, cd); |
1784 | } | 1784 | } |
@@ -1787,7 +1787,7 @@ static ssize_t write_flush_pipefs(struct file *filp, | |||
1787 | const char __user *buf, | 1787 | const char __user *buf, |
1788 | size_t count, loff_t *ppos) | 1788 | size_t count, loff_t *ppos) |
1789 | { | 1789 | { |
1790 | struct cache_detail *cd = RPC_I(filp->f_path.dentry->d_inode)->private; | 1790 | struct cache_detail *cd = RPC_I(file_inode(filp))->private; |
1791 | 1791 | ||
1792 | return write_flush(filp, buf, count, ppos, cd); | 1792 | return write_flush(filp, buf, count, ppos, cd); |
1793 | } | 1793 | } |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index fd10981ea792..7b9b40224a27 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -284,7 +284,7 @@ out: | |||
284 | static ssize_t | 284 | static ssize_t |
285 | rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset) | 285 | rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset) |
286 | { | 286 | { |
287 | struct inode *inode = filp->f_path.dentry->d_inode; | 287 | struct inode *inode = file_inode(filp); |
288 | struct rpc_pipe *pipe; | 288 | struct rpc_pipe *pipe; |
289 | struct rpc_pipe_msg *msg; | 289 | struct rpc_pipe_msg *msg; |
290 | int res = 0; | 290 | int res = 0; |
@@ -328,7 +328,7 @@ out_unlock: | |||
328 | static ssize_t | 328 | static ssize_t |
329 | rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *offset) | 329 | rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *offset) |
330 | { | 330 | { |
331 | struct inode *inode = filp->f_path.dentry->d_inode; | 331 | struct inode *inode = file_inode(filp); |
332 | int res; | 332 | int res; |
333 | 333 | ||
334 | mutex_lock(&inode->i_mutex); | 334 | mutex_lock(&inode->i_mutex); |
@@ -342,7 +342,7 @@ rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *of | |||
342 | static unsigned int | 342 | static unsigned int |
343 | rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) | 343 | rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) |
344 | { | 344 | { |
345 | struct inode *inode = filp->f_path.dentry->d_inode; | 345 | struct inode *inode = file_inode(filp); |
346 | struct rpc_inode *rpci = RPC_I(inode); | 346 | struct rpc_inode *rpci = RPC_I(inode); |
347 | unsigned int mask = POLLOUT | POLLWRNORM; | 347 | unsigned int mask = POLLOUT | POLLWRNORM; |
348 | 348 | ||
@@ -360,7 +360,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) | |||
360 | static long | 360 | static long |
361 | rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 361 | rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
362 | { | 362 | { |
363 | struct inode *inode = filp->f_path.dentry->d_inode; | 363 | struct inode *inode = file_inode(filp); |
364 | struct rpc_pipe *pipe; | 364 | struct rpc_pipe *pipe; |
365 | int len; | 365 | int len; |
366 | 366 | ||
@@ -830,7 +830,7 @@ static int rpc_rmdir_depopulate(struct dentry *dentry, | |||
830 | * responses to upcalls. They will result in calls to @msg->downcall. | 830 | * responses to upcalls. They will result in calls to @msg->downcall. |
831 | * | 831 | * |
832 | * The @private argument passed here will be available to all these methods | 832 | * The @private argument passed here will be available to all these methods |
833 | * from the file pointer, via RPC_I(file->f_dentry->d_inode)->private. | 833 | * from the file pointer, via RPC_I(file_inode(file))->private. |
834 | */ | 834 | */ |
835 | struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name, | 835 | struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name, |
836 | void *private, struct rpc_pipe *pipe) | 836 | void *private, struct rpc_pipe *pipe) |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index b6f4b994eb35..d0f6545b0010 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -99,7 +99,7 @@ unsigned int unix_tot_inflight; | |||
99 | struct sock *unix_get_socket(struct file *filp) | 99 | struct sock *unix_get_socket(struct file *filp) |
100 | { | 100 | { |
101 | struct sock *u_sock = NULL; | 101 | struct sock *u_sock = NULL; |
102 | struct inode *inode = filp->f_path.dentry->d_inode; | 102 | struct inode *inode = file_inode(filp); |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * Socket ? | 105 | * Socket ? |
diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c index 60f0c76a27d3..859abdaac1ea 100644 --- a/security/apparmor/domain.c +++ b/security/apparmor/domain.c | |||
@@ -349,8 +349,8 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm) | |||
349 | unsigned int state; | 349 | unsigned int state; |
350 | struct file_perms perms = {}; | 350 | struct file_perms perms = {}; |
351 | struct path_cond cond = { | 351 | struct path_cond cond = { |
352 | bprm->file->f_path.dentry->d_inode->i_uid, | 352 | file_inode(bprm->file)->i_uid, |
353 | bprm->file->f_path.dentry->d_inode->i_mode | 353 | file_inode(bprm->file)->i_mode |
354 | }; | 354 | }; |
355 | const char *name = NULL, *target = NULL, *info = NULL; | 355 | const char *name = NULL, *target = NULL, *info = NULL; |
356 | int error = cap_bprm_set_creds(bprm); | 356 | int error = cap_bprm_set_creds(bprm); |
diff --git a/security/apparmor/file.c b/security/apparmor/file.c index cd21ec5b90af..fdaa50cb1876 100644 --- a/security/apparmor/file.c +++ b/security/apparmor/file.c | |||
@@ -449,8 +449,8 @@ int aa_file_perm(int op, struct aa_profile *profile, struct file *file, | |||
449 | u32 request) | 449 | u32 request) |
450 | { | 450 | { |
451 | struct path_cond cond = { | 451 | struct path_cond cond = { |
452 | .uid = file->f_path.dentry->d_inode->i_uid, | 452 | .uid = file_inode(file)->i_uid, |
453 | .mode = file->f_path.dentry->d_inode->i_mode | 453 | .mode = file_inode(file)->i_mode |
454 | }; | 454 | }; |
455 | 455 | ||
456 | return aa_path_perm(op, profile, &file->f_path, PATH_DELEGATE_DELETED, | 456 | return aa_path_perm(op, profile, &file->f_path, PATH_DELEGATE_DELETED, |
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 8c2a7f6b35e2..b21830eced41 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
@@ -379,7 +379,7 @@ static int apparmor_file_open(struct file *file, const struct cred *cred) | |||
379 | struct aa_profile *profile; | 379 | struct aa_profile *profile; |
380 | int error = 0; | 380 | int error = 0; |
381 | 381 | ||
382 | if (!mediated_filesystem(file->f_path.dentry->d_inode)) | 382 | if (!mediated_filesystem(file_inode(file))) |
383 | return 0; | 383 | return 0; |
384 | 384 | ||
385 | /* If in exec, permission is handled by bprm hooks. | 385 | /* If in exec, permission is handled by bprm hooks. |
@@ -394,7 +394,7 @@ static int apparmor_file_open(struct file *file, const struct cred *cred) | |||
394 | 394 | ||
395 | profile = aa_cred_profile(cred); | 395 | profile = aa_cred_profile(cred); |
396 | if (!unconfined(profile)) { | 396 | if (!unconfined(profile)) { |
397 | struct inode *inode = file->f_path.dentry->d_inode; | 397 | struct inode *inode = file_inode(file); |
398 | struct path_cond cond = { inode->i_uid, inode->i_mode }; | 398 | struct path_cond cond = { inode->i_uid, inode->i_mode }; |
399 | 399 | ||
400 | error = aa_path_perm(OP_OPEN, profile, &file->f_path, 0, | 400 | error = aa_path_perm(OP_OPEN, profile, &file->f_path, 0, |
@@ -432,7 +432,7 @@ static int common_file_perm(int op, struct file *file, u32 mask) | |||
432 | BUG_ON(!fprofile); | 432 | BUG_ON(!fprofile); |
433 | 433 | ||
434 | if (!file->f_path.mnt || | 434 | if (!file->f_path.mnt || |
435 | !mediated_filesystem(file->f_path.dentry->d_inode)) | 435 | !mediated_filesystem(file_inode(file))) |
436 | return 0; | 436 | return 0; |
437 | 437 | ||
438 | profile = __aa_current_profile(); | 438 | profile = __aa_current_profile(); |
diff --git a/security/commoncap.c b/security/commoncap.c index 7ee08c756d6b..c44b6fe6648e 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -440,7 +440,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c | |||
440 | if (!file_caps_enabled) | 440 | if (!file_caps_enabled) |
441 | return 0; | 441 | return 0; |
442 | 442 | ||
443 | if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) | 443 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) |
444 | return 0; | 444 | return 0; |
445 | 445 | ||
446 | dentry = dget(bprm->file->f_dentry); | 446 | dentry = dget(bprm->file->f_dentry); |
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index d9030b29d84d..1c03e8f1e0e1 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c | |||
@@ -140,12 +140,12 @@ int ima_must_measure(struct inode *inode, int mask, int function) | |||
140 | int ima_collect_measurement(struct integrity_iint_cache *iint, | 140 | int ima_collect_measurement(struct integrity_iint_cache *iint, |
141 | struct file *file) | 141 | struct file *file) |
142 | { | 142 | { |
143 | struct inode *inode = file->f_dentry->d_inode; | 143 | struct inode *inode = file_inode(file); |
144 | const char *filename = file->f_dentry->d_name.name; | 144 | const char *filename = file->f_dentry->d_name.name; |
145 | int result = 0; | 145 | int result = 0; |
146 | 146 | ||
147 | if (!(iint->flags & IMA_COLLECTED)) { | 147 | if (!(iint->flags & IMA_COLLECTED)) { |
148 | u64 i_version = file->f_dentry->d_inode->i_version; | 148 | u64 i_version = file_inode(file)->i_version; |
149 | 149 | ||
150 | iint->ima_xattr.type = IMA_XATTR_DIGEST; | 150 | iint->ima_xattr.type = IMA_XATTR_DIGEST; |
151 | result = ima_calc_file_hash(file, iint->ima_xattr.digest); | 151 | result = ima_calc_file_hash(file, iint->ima_xattr.digest); |
@@ -182,7 +182,7 @@ void ima_store_measurement(struct integrity_iint_cache *iint, | |||
182 | const char *op = "add_template_measure"; | 182 | const char *op = "add_template_measure"; |
183 | const char *audit_cause = "ENOMEM"; | 183 | const char *audit_cause = "ENOMEM"; |
184 | int result = -ENOMEM; | 184 | int result = -ENOMEM; |
185 | struct inode *inode = file->f_dentry->d_inode; | 185 | struct inode *inode = file_inode(file); |
186 | struct ima_template_entry *entry; | 186 | struct ima_template_entry *entry; |
187 | int violation = 0; | 187 | int violation = 0; |
188 | 188 | ||
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index b691e0f3830c..a02e0791cf15 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c | |||
@@ -66,7 +66,7 @@ int ima_calc_file_hash(struct file *file, char *digest) | |||
66 | file->f_mode |= FMODE_READ; | 66 | file->f_mode |= FMODE_READ; |
67 | read = 1; | 67 | read = 1; |
68 | } | 68 | } |
69 | i_size = i_size_read(file->f_dentry->d_inode); | 69 | i_size = i_size_read(file_inode(file)); |
70 | while (offset < i_size) { | 70 | while (offset < i_size) { |
71 | int rbuf_len; | 71 | int rbuf_len; |
72 | 72 | ||
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 5b14a0946d6e..3b3b7e6bf8da 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
@@ -126,7 +126,7 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint, | |||
126 | */ | 126 | */ |
127 | void ima_file_free(struct file *file) | 127 | void ima_file_free(struct file *file) |
128 | { | 128 | { |
129 | struct inode *inode = file->f_dentry->d_inode; | 129 | struct inode *inode = file_inode(file); |
130 | struct integrity_iint_cache *iint; | 130 | struct integrity_iint_cache *iint; |
131 | 131 | ||
132 | if (!iint_initialized || !S_ISREG(inode->i_mode)) | 132 | if (!iint_initialized || !S_ISREG(inode->i_mode)) |
@@ -142,7 +142,7 @@ void ima_file_free(struct file *file) | |||
142 | static int process_measurement(struct file *file, const char *filename, | 142 | static int process_measurement(struct file *file, const char *filename, |
143 | int mask, int function) | 143 | int mask, int function) |
144 | { | 144 | { |
145 | struct inode *inode = file->f_dentry->d_inode; | 145 | struct inode *inode = file_inode(file); |
146 | struct integrity_iint_cache *iint; | 146 | struct integrity_iint_cache *iint; |
147 | char *pathbuf = NULL; | 147 | char *pathbuf = NULL; |
148 | const char *pathname = NULL; | 148 | const char *pathname = NULL; |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index ef26e9611ffb..84b591711eec 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1528,7 +1528,7 @@ static int file_has_perm(const struct cred *cred, | |||
1528 | u32 av) | 1528 | u32 av) |
1529 | { | 1529 | { |
1530 | struct file_security_struct *fsec = file->f_security; | 1530 | struct file_security_struct *fsec = file->f_security; |
1531 | struct inode *inode = file->f_path.dentry->d_inode; | 1531 | struct inode *inode = file_inode(file); |
1532 | struct common_audit_data ad; | 1532 | struct common_audit_data ad; |
1533 | u32 sid = cred_sid(cred); | 1533 | u32 sid = cred_sid(cred); |
1534 | int rc; | 1534 | int rc; |
@@ -1957,7 +1957,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
1957 | struct task_security_struct *new_tsec; | 1957 | struct task_security_struct *new_tsec; |
1958 | struct inode_security_struct *isec; | 1958 | struct inode_security_struct *isec; |
1959 | struct common_audit_data ad; | 1959 | struct common_audit_data ad; |
1960 | struct inode *inode = bprm->file->f_path.dentry->d_inode; | 1960 | struct inode *inode = file_inode(bprm->file); |
1961 | int rc; | 1961 | int rc; |
1962 | 1962 | ||
1963 | rc = cap_bprm_set_creds(bprm); | 1963 | rc = cap_bprm_set_creds(bprm); |
@@ -2929,7 +2929,7 @@ static void selinux_inode_getsecid(const struct inode *inode, u32 *secid) | |||
2929 | static int selinux_revalidate_file_permission(struct file *file, int mask) | 2929 | static int selinux_revalidate_file_permission(struct file *file, int mask) |
2930 | { | 2930 | { |
2931 | const struct cred *cred = current_cred(); | 2931 | const struct cred *cred = current_cred(); |
2932 | struct inode *inode = file->f_path.dentry->d_inode; | 2932 | struct inode *inode = file_inode(file); |
2933 | 2933 | ||
2934 | /* file_mask_to_av won't add FILE__WRITE if MAY_APPEND is set */ | 2934 | /* file_mask_to_av won't add FILE__WRITE if MAY_APPEND is set */ |
2935 | if ((file->f_flags & O_APPEND) && (mask & MAY_WRITE)) | 2935 | if ((file->f_flags & O_APPEND) && (mask & MAY_WRITE)) |
@@ -2941,7 +2941,7 @@ static int selinux_revalidate_file_permission(struct file *file, int mask) | |||
2941 | 2941 | ||
2942 | static int selinux_file_permission(struct file *file, int mask) | 2942 | static int selinux_file_permission(struct file *file, int mask) |
2943 | { | 2943 | { |
2944 | struct inode *inode = file->f_path.dentry->d_inode; | 2944 | struct inode *inode = file_inode(file); |
2945 | struct file_security_struct *fsec = file->f_security; | 2945 | struct file_security_struct *fsec = file->f_security; |
2946 | struct inode_security_struct *isec = inode->i_security; | 2946 | struct inode_security_struct *isec = inode->i_security; |
2947 | u32 sid = current_sid(); | 2947 | u32 sid = current_sid(); |
@@ -3218,7 +3218,7 @@ static int selinux_file_open(struct file *file, const struct cred *cred) | |||
3218 | struct inode_security_struct *isec; | 3218 | struct inode_security_struct *isec; |
3219 | 3219 | ||
3220 | fsec = file->f_security; | 3220 | fsec = file->f_security; |
3221 | isec = file->f_path.dentry->d_inode->i_security; | 3221 | isec = file_inode(file)->i_security; |
3222 | /* | 3222 | /* |
3223 | * Save inode label and policy sequence number | 3223 | * Save inode label and policy sequence number |
3224 | * at open-time so that selinux_file_permission | 3224 | * at open-time so that selinux_file_permission |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 3a6e8731646c..ff427733c290 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -202,7 +202,7 @@ static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf, | |||
202 | { | 202 | { |
203 | char tmpbuf[TMPBUFLEN]; | 203 | char tmpbuf[TMPBUFLEN]; |
204 | ssize_t length; | 204 | ssize_t length; |
205 | ino_t ino = filp->f_path.dentry->d_inode->i_ino; | 205 | ino_t ino = file_inode(filp)->i_ino; |
206 | int handle_unknown = (ino == SEL_REJECT_UNKNOWN) ? | 206 | int handle_unknown = (ino == SEL_REJECT_UNKNOWN) ? |
207 | security_get_reject_unknown() : !security_get_allow_unknown(); | 207 | security_get_reject_unknown() : !security_get_allow_unknown(); |
208 | 208 | ||
@@ -671,7 +671,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
671 | 671 | ||
672 | static ssize_t selinux_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) | 672 | static ssize_t selinux_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) |
673 | { | 673 | { |
674 | ino_t ino = file->f_path.dentry->d_inode->i_ino; | 674 | ino_t ino = file_inode(file)->i_ino; |
675 | char *data; | 675 | char *data; |
676 | ssize_t rv; | 676 | ssize_t rv; |
677 | 677 | ||
@@ -1042,8 +1042,7 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, | |||
1042 | ssize_t length; | 1042 | ssize_t length; |
1043 | ssize_t ret; | 1043 | ssize_t ret; |
1044 | int cur_enforcing; | 1044 | int cur_enforcing; |
1045 | struct inode *inode = filep->f_path.dentry->d_inode; | 1045 | unsigned index = file_inode(filep)->i_ino & SEL_INO_MASK; |
1046 | unsigned index = inode->i_ino & SEL_INO_MASK; | ||
1047 | const char *name = filep->f_path.dentry->d_name.name; | 1046 | const char *name = filep->f_path.dentry->d_name.name; |
1048 | 1047 | ||
1049 | mutex_lock(&sel_mutex); | 1048 | mutex_lock(&sel_mutex); |
@@ -1077,8 +1076,7 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf, | |||
1077 | char *page = NULL; | 1076 | char *page = NULL; |
1078 | ssize_t length; | 1077 | ssize_t length; |
1079 | int new_value; | 1078 | int new_value; |
1080 | struct inode *inode = filep->f_path.dentry->d_inode; | 1079 | unsigned index = file_inode(filep)->i_ino & SEL_INO_MASK; |
1081 | unsigned index = inode->i_ino & SEL_INO_MASK; | ||
1082 | const char *name = filep->f_path.dentry->d_name.name; | 1080 | const char *name = filep->f_path.dentry->d_name.name; |
1083 | 1081 | ||
1084 | mutex_lock(&sel_mutex); | 1082 | mutex_lock(&sel_mutex); |
@@ -1486,13 +1484,11 @@ static int sel_make_avc_files(struct dentry *dir) | |||
1486 | static ssize_t sel_read_initcon(struct file *file, char __user *buf, | 1484 | static ssize_t sel_read_initcon(struct file *file, char __user *buf, |
1487 | size_t count, loff_t *ppos) | 1485 | size_t count, loff_t *ppos) |
1488 | { | 1486 | { |
1489 | struct inode *inode; | ||
1490 | char *con; | 1487 | char *con; |
1491 | u32 sid, len; | 1488 | u32 sid, len; |
1492 | ssize_t ret; | 1489 | ssize_t ret; |
1493 | 1490 | ||
1494 | inode = file->f_path.dentry->d_inode; | 1491 | sid = file_inode(file)->i_ino&SEL_INO_MASK; |
1495 | sid = inode->i_ino&SEL_INO_MASK; | ||
1496 | ret = security_sid_to_context(sid, &con, &len); | 1492 | ret = security_sid_to_context(sid, &con, &len); |
1497 | if (ret) | 1493 | if (ret) |
1498 | return ret; | 1494 | return ret; |
@@ -1553,7 +1549,7 @@ static inline u32 sel_ino_to_perm(unsigned long ino) | |||
1553 | static ssize_t sel_read_class(struct file *file, char __user *buf, | 1549 | static ssize_t sel_read_class(struct file *file, char __user *buf, |
1554 | size_t count, loff_t *ppos) | 1550 | size_t count, loff_t *ppos) |
1555 | { | 1551 | { |
1556 | unsigned long ino = file->f_path.dentry->d_inode->i_ino; | 1552 | unsigned long ino = file_inode(file)->i_ino; |
1557 | char res[TMPBUFLEN]; | 1553 | char res[TMPBUFLEN]; |
1558 | ssize_t len = snprintf(res, sizeof(res), "%d", sel_ino_to_class(ino)); | 1554 | ssize_t len = snprintf(res, sizeof(res), "%d", sel_ino_to_class(ino)); |
1559 | return simple_read_from_buffer(buf, count, ppos, res, len); | 1555 | return simple_read_from_buffer(buf, count, ppos, res, len); |
@@ -1567,7 +1563,7 @@ static const struct file_operations sel_class_ops = { | |||
1567 | static ssize_t sel_read_perm(struct file *file, char __user *buf, | 1563 | static ssize_t sel_read_perm(struct file *file, char __user *buf, |
1568 | size_t count, loff_t *ppos) | 1564 | size_t count, loff_t *ppos) |
1569 | { | 1565 | { |
1570 | unsigned long ino = file->f_path.dentry->d_inode->i_ino; | 1566 | unsigned long ino = file_inode(file)->i_ino; |
1571 | char res[TMPBUFLEN]; | 1567 | char res[TMPBUFLEN]; |
1572 | ssize_t len = snprintf(res, sizeof(res), "%d", sel_ino_to_perm(ino)); | 1568 | ssize_t len = snprintf(res, sizeof(res), "%d", sel_ino_to_perm(ino)); |
1573 | return simple_read_from_buffer(buf, count, ppos, res, len); | 1569 | return simple_read_from_buffer(buf, count, ppos, res, len); |
@@ -1584,7 +1580,7 @@ static ssize_t sel_read_policycap(struct file *file, char __user *buf, | |||
1584 | int value; | 1580 | int value; |
1585 | char tmpbuf[TMPBUFLEN]; | 1581 | char tmpbuf[TMPBUFLEN]; |
1586 | ssize_t length; | 1582 | ssize_t length; |
1587 | unsigned long i_ino = file->f_path.dentry->d_inode->i_ino; | 1583 | unsigned long i_ino = file_inode(file)->i_ino; |
1588 | 1584 | ||
1589 | value = security_policycap_supported(i_ino & SEL_INO_MASK); | 1585 | value = security_policycap_supported(i_ino & SEL_INO_MASK); |
1590 | length = scnprintf(tmpbuf, TMPBUFLEN, "%d", value); | 1586 | length = scnprintf(tmpbuf, TMPBUFLEN, "%d", value); |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 38be92ce901e..fa64740abb59 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -456,7 +456,7 @@ static int smack_sb_umount(struct vfsmount *mnt, int flags) | |||
456 | */ | 456 | */ |
457 | static int smack_bprm_set_creds(struct linux_binprm *bprm) | 457 | static int smack_bprm_set_creds(struct linux_binprm *bprm) |
458 | { | 458 | { |
459 | struct inode *inode = bprm->file->f_path.dentry->d_inode; | 459 | struct inode *inode = file_inode(bprm->file); |
460 | struct task_smack *bsp = bprm->cred->security; | 460 | struct task_smack *bsp = bprm->cred->security; |
461 | struct inode_smack *isp; | 461 | struct inode_smack *isp; |
462 | int rc; | 462 | int rc; |
@@ -1187,21 +1187,15 @@ static int smack_mmap_file(struct file *file, | |||
1187 | char *msmack; | 1187 | char *msmack; |
1188 | char *osmack; | 1188 | char *osmack; |
1189 | struct inode_smack *isp; | 1189 | struct inode_smack *isp; |
1190 | struct dentry *dp; | ||
1191 | int may; | 1190 | int may; |
1192 | int mmay; | 1191 | int mmay; |
1193 | int tmay; | 1192 | int tmay; |
1194 | int rc; | 1193 | int rc; |
1195 | 1194 | ||
1196 | if (file == NULL || file->f_dentry == NULL) | 1195 | if (file == NULL) |
1197 | return 0; | ||
1198 | |||
1199 | dp = file->f_dentry; | ||
1200 | |||
1201 | if (dp->d_inode == NULL) | ||
1202 | return 0; | 1196 | return 0; |
1203 | 1197 | ||
1204 | isp = dp->d_inode->i_security; | 1198 | isp = file_inode(file)->i_security; |
1205 | if (isp->smk_mmap == NULL) | 1199 | if (isp->smk_mmap == NULL) |
1206 | return 0; | 1200 | return 0; |
1207 | msmack = isp->smk_mmap; | 1201 | msmack = isp->smk_mmap; |
@@ -1359,7 +1353,7 @@ static int smack_file_receive(struct file *file) | |||
1359 | */ | 1353 | */ |
1360 | static int smack_file_open(struct file *file, const struct cred *cred) | 1354 | static int smack_file_open(struct file *file, const struct cred *cred) |
1361 | { | 1355 | { |
1362 | struct inode_smack *isp = file->f_path.dentry->d_inode->i_security; | 1356 | struct inode_smack *isp = file_inode(file)->i_security; |
1363 | 1357 | ||
1364 | file->f_security = isp->smk_inode; | 1358 | file->f_security = isp->smk_inode; |
1365 | 1359 | ||
diff --git a/security/tomoyo/securityfs_if.c b/security/tomoyo/securityfs_if.c index 8592f2fc6ebb..fcf32783b66b 100644 --- a/security/tomoyo/securityfs_if.c +++ b/security/tomoyo/securityfs_if.c | |||
@@ -135,7 +135,7 @@ static const struct file_operations tomoyo_self_operations = { | |||
135 | */ | 135 | */ |
136 | static int tomoyo_open(struct inode *inode, struct file *file) | 136 | static int tomoyo_open(struct inode *inode, struct file *file) |
137 | { | 137 | { |
138 | const int key = ((u8 *) file->f_path.dentry->d_inode->i_private) | 138 | const int key = ((u8 *) file_inode(file)->i_private) |
139 | - ((u8 *) NULL); | 139 | - ((u8 *) NULL); |
140 | return tomoyo_open_control(key, file); | 140 | return tomoyo_open_control(key, file); |
141 | } | 141 | } |
diff --git a/sound/core/info.c b/sound/core/info.c index 6b368d25073b..5bb97e7d325a 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -496,7 +496,7 @@ static long snd_info_entry_ioctl(struct file *file, unsigned int cmd, | |||
496 | 496 | ||
497 | static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) | 497 | static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) |
498 | { | 498 | { |
499 | struct inode *inode = file->f_path.dentry->d_inode; | 499 | struct inode *inode = file_inode(file); |
500 | struct snd_info_private_data *data; | 500 | struct snd_info_private_data *data; |
501 | struct snd_info_entry *entry; | 501 | struct snd_info_entry *entry; |
502 | 502 | ||
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 09b4286c65f9..71ae86ca64ac 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1586,7 +1586,7 @@ static struct file *snd_pcm_file_fd(int fd, int *fput_needed) | |||
1586 | file = fget_light(fd, fput_needed); | 1586 | file = fget_light(fd, fput_needed); |
1587 | if (!file) | 1587 | if (!file) |
1588 | return NULL; | 1588 | return NULL; |
1589 | inode = file->f_path.dentry->d_inode; | 1589 | inode = file_inode(file); |
1590 | if (!S_ISCHR(inode->i_mode) || | 1590 | if (!S_ISCHR(inode->i_mode) || |
1591 | imajor(inode) != snd_major) { | 1591 | imajor(inode) != snd_major) { |
1592 | fput_light(file, *fput_needed); | 1592 | fput_light(file, *fput_needed); |
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index 536c4c0514d3..11ff7c55240c 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c | |||
@@ -642,7 +642,7 @@ static int mixer_ioctl(unsigned int cmd, unsigned long arg) | |||
642 | 642 | ||
643 | static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 643 | static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
644 | { | 644 | { |
645 | int minor = iminor(file->f_path.dentry->d_inode); | 645 | int minor = iminor(file_inode(file)); |
646 | int ret; | 646 | int ret; |
647 | 647 | ||
648 | if (cmd == OSS_GETVERSION) { | 648 | if (cmd == OSS_GETVERSION) { |
@@ -1012,7 +1012,7 @@ static int dsp_write(const char __user *buf, size_t len) | |||
1012 | 1012 | ||
1013 | static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off) | 1013 | static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off) |
1014 | { | 1014 | { |
1015 | int minor = iminor(file->f_path.dentry->d_inode); | 1015 | int minor = iminor(file_inode(file)); |
1016 | if (minor == dev.dsp_minor) | 1016 | if (minor == dev.dsp_minor) |
1017 | return dsp_read(buf, count); | 1017 | return dsp_read(buf, count); |
1018 | else | 1018 | else |
@@ -1021,7 +1021,7 @@ static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_ | |||
1021 | 1021 | ||
1022 | static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off) | 1022 | static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off) |
1023 | { | 1023 | { |
1024 | int minor = iminor(file->f_path.dentry->d_inode); | 1024 | int minor = iminor(file_inode(file)); |
1025 | if (minor == dev.dsp_minor) | 1025 | if (minor == dev.dsp_minor) |
1026 | return dsp_write(buf, count); | 1026 | return dsp_write(buf, count); |
1027 | else | 1027 | else |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 7c7793a0eb25..e7780349cc55 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -143,7 +143,7 @@ static int get_mixer_levels(void __user * arg) | |||
143 | 143 | ||
144 | static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 144 | static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
145 | { | 145 | { |
146 | int dev = iminor(file->f_path.dentry->d_inode); | 146 | int dev = iminor(file_inode(file)); |
147 | int ret = -EINVAL; | 147 | int ret = -EINVAL; |
148 | 148 | ||
149 | /* | 149 | /* |
@@ -176,7 +176,7 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof | |||
176 | 176 | ||
177 | static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 177 | static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
178 | { | 178 | { |
179 | int dev = iminor(file->f_path.dentry->d_inode); | 179 | int dev = iminor(file_inode(file)); |
180 | int ret = -EINVAL; | 180 | int ret = -EINVAL; |
181 | 181 | ||
182 | mutex_lock(&soundcard_mutex); | 182 | mutex_lock(&soundcard_mutex); |
@@ -333,7 +333,7 @@ static int sound_mixer_ioctl(int mixdev, unsigned int cmd, void __user *arg) | |||
333 | static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 333 | static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
334 | { | 334 | { |
335 | int len = 0, dtype; | 335 | int len = 0, dtype; |
336 | int dev = iminor(file->f_dentry->d_inode); | 336 | int dev = iminor(file_inode(file)); |
337 | long ret = -EINVAL; | 337 | long ret = -EINVAL; |
338 | void __user *p = (void __user *)arg; | 338 | void __user *p = (void __user *)arg; |
339 | 339 | ||
@@ -406,7 +406,7 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
406 | 406 | ||
407 | static unsigned int sound_poll(struct file *file, poll_table * wait) | 407 | static unsigned int sound_poll(struct file *file, poll_table * wait) |
408 | { | 408 | { |
409 | struct inode *inode = file->f_path.dentry->d_inode; | 409 | struct inode *inode = file_inode(file); |
410 | int dev = iminor(inode); | 410 | int dev = iminor(inode); |
411 | 411 | ||
412 | DEB(printk("sound_poll(dev=%d)\n", dev)); | 412 | DEB(printk("sound_poll(dev=%d)\n", dev)); |
@@ -431,7 +431,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) | |||
431 | int dev_class; | 431 | int dev_class; |
432 | unsigned long size; | 432 | unsigned long size; |
433 | struct dma_buffparms *dmap = NULL; | 433 | struct dma_buffparms *dmap = NULL; |
434 | int dev = iminor(file->f_path.dentry->d_inode); | 434 | int dev = iminor(file_inode(file)); |
435 | 435 | ||
436 | dev_class = dev & 0x0f; | 436 | dev_class = dev & 0x0f; |
437 | dev >>= 4; | 437 | dev >>= 4; |
diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c index 37711a5d0d6b..e14903468051 100644 --- a/sound/sound_firmware.c +++ b/sound/sound_firmware.c | |||
@@ -19,7 +19,7 @@ static int do_mod_firmware_load(const char *fn, char **fp) | |||
19 | printk(KERN_INFO "Unable to load '%s'.\n", fn); | 19 | printk(KERN_INFO "Unable to load '%s'.\n", fn); |
20 | return 0; | 20 | return 0; |
21 | } | 21 | } |
22 | l = i_size_read(filp->f_path.dentry->d_inode); | 22 | l = i_size_read(file_inode(filp)); |
23 | if (l <= 0 || l > 131072) | 23 | if (l <= 0 || l > 131072) |
24 | { | 24 | { |
25 | printk(KERN_INFO "Invalid firmware '%s'\n", fn); | 25 | printk(KERN_INFO "Invalid firmware '%s'\n", fn); |