diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 23:16:07 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 23:16:07 -0500 |
| commit | d895cb1af15c04c522a25c79cc429076987c089b (patch) | |
| tree | 895dc9157e28f603d937a58be664e4e440d5530c /fs/proc | |
| parent | 9626357371b519f2b955fef399647181034a77fe (diff) | |
| parent | d3d009cb965eae7e002ea5badf603ea8f4c34915 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile (part one) from Al Viro:
"Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
locking violations, etc.
The most visible changes here are death of FS_REVAL_DOT (replaced with
"has ->d_weak_revalidate()") and a new helper getting from struct file
to inode. Some bits of preparation to xattr method interface changes.
Misc patches by various people sent this cycle *and* ocfs2 fixes from
several cycles ago that should've been upstream right then.
PS: the next vfs pile will be xattr stuff."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
saner proc_get_inode() calling conventions
proc: avoid extra pde_put() in proc_fill_super()
fs: change return values from -EACCES to -EPERM
fs/exec.c: make bprm_mm_init() static
ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
ocfs2: fix possible use-after-free with AIO
ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
target: writev() on single-element vector is pointless
export kernel_write(), convert open-coded instances
fs: encode_fh: return FILEID_INVALID if invalid fid_type
kill f_vfsmnt
vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
nfsd: handle vfs_getattr errors in acl protocol
switch vfs_getattr() to struct path
default SET_PERSONALITY() in linux/elf.h
ceph: prepopulate inodes only when request is aborted
d_hash_and_lookup(): export, switch open-coded instances
9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
9p: split dropping the acls from v9fs_set_create_acl()
...
Diffstat (limited to 'fs/proc')
| -rw-r--r-- | fs/proc/base.c | 45 | ||||
| -rw-r--r-- | fs/proc/generic.c | 31 | ||||
| -rw-r--r-- | fs/proc/inode.c | 43 | ||||
| -rw-r--r-- | fs/proc/nommu.c | 2 | ||||
| -rw-r--r-- | fs/proc/proc_net.c | 2 | ||||
| -rw-r--r-- | fs/proc/proc_sysctl.c | 4 | ||||
| -rw-r--r-- | fs/proc/task_mmu.c | 6 | ||||
| -rw-r--r-- | fs/proc/task_nommu.c | 2 |
8 files changed, 67 insertions, 68 deletions
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; |
