diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/fs.h | 9 | ||||
| -rw-r--r-- | include/linux/fsnotify.h | 2 | ||||
| -rw-r--r-- | include/linux/hugetlb.h | 2 | ||||
| -rw-r--r-- | include/linux/lockd/lockd.h | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7617ee04f066..3ab69777b4d8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -2217,6 +2217,11 @@ static inline bool execute_ok(struct inode *inode) | |||
| 2217 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); | 2217 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); |
| 2218 | } | 2218 | } |
| 2219 | 2219 | ||
| 2220 | static inline struct inode *file_inode(struct file *f) | ||
| 2221 | { | ||
| 2222 | return f->f_path.dentry->d_inode; | ||
| 2223 | } | ||
| 2224 | |||
| 2220 | /* | 2225 | /* |
| 2221 | * get_write_access() gets write permission for a file. | 2226 | * get_write_access() gets write permission for a file. |
| 2222 | * put_write_access() releases this write permission. | 2227 | * put_write_access() releases this write permission. |
| @@ -2239,7 +2244,7 @@ static inline int get_write_access(struct inode *inode) | |||
| 2239 | } | 2244 | } |
| 2240 | static inline int deny_write_access(struct file *file) | 2245 | static inline int deny_write_access(struct file *file) |
| 2241 | { | 2246 | { |
| 2242 | struct inode *inode = file->f_path.dentry->d_inode; | 2247 | struct inode *inode = file_inode(file); |
| 2243 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; | 2248 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; |
| 2244 | } | 2249 | } |
| 2245 | static inline void put_write_access(struct inode * inode) | 2250 | static inline void put_write_access(struct inode * inode) |
| @@ -2249,7 +2254,7 @@ static inline void put_write_access(struct inode * inode) | |||
| 2249 | static inline void allow_write_access(struct file *file) | 2254 | static inline void allow_write_access(struct file *file) |
| 2250 | { | 2255 | { |
| 2251 | if (file) | 2256 | if (file) |
| 2252 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2257 | atomic_inc(&file_inode(file)->i_writecount); |
| 2253 | } | 2258 | } |
| 2254 | #ifdef CONFIG_IMA | 2259 | #ifdef CONFIG_IMA |
| 2255 | static inline void i_readcount_dec(struct inode *inode) | 2260 | static inline void i_readcount_dec(struct inode *inode) |
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 0c80d3f57a5b..70832951f97c 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) |
