@@ -153,7 +153,7 @@ static int get_nr_threads(struct task_struct *tsk)
153153 return count ;
154154}
155155
156- static int proc_cwd_link (struct inode * inode , struct dentry * * dentry , struct vfsmount * * mnt )
156+ static int proc_cwd_link (struct inode * inode , struct path * path )
157157{
158158 struct task_struct * task = get_proc_task (inode );
159159 struct fs_struct * fs = NULL ;
@@ -165,16 +165,16 @@ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfs
165165 }
166166 if (fs ) {
167167 read_lock (& fs -> lock );
168- * mnt = mntget ( fs -> pwd . mnt ) ;
169- * dentry = dget ( fs -> pwd . dentry );
168+ * path = fs -> pwd ;
169+ path_get ( & fs -> pwd );
170170 read_unlock (& fs -> lock );
171171 result = 0 ;
172172 put_fs_struct (fs );
173173 }
174174 return result ;
175175}
176176
177- static int proc_root_link (struct inode * inode , struct dentry * * dentry , struct vfsmount * * mnt )
177+ static int proc_root_link (struct inode * inode , struct path * path )
178178{
179179 struct task_struct * task = get_proc_task (inode );
180180 struct fs_struct * fs = NULL ;
@@ -186,8 +186,8 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
186186 }
187187 if (fs ) {
188188 read_lock (& fs -> lock );
189- * mnt = mntget ( fs -> root . mnt ) ;
190- * dentry = dget ( fs -> root . dentry );
189+ * path = fs -> root ;
190+ path_get ( & fs -> root );
191191 read_unlock (& fs -> lock );
192192 result = 0 ;
193193 put_fs_struct (fs );
@@ -1170,34 +1170,30 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
11701170 if (!proc_fd_access_allowed (inode ))
11711171 goto out ;
11721172
1173- error = PROC_I (inode )-> op .proc_get_link (inode , & nd -> path .dentry ,
1174- & nd -> path .mnt );
1173+ error = PROC_I (inode )-> op .proc_get_link (inode , & nd -> path );
11751174 nd -> last_type = LAST_BIND ;
11761175out :
11771176 return ERR_PTR (error );
11781177}
11791178
1180- static int do_proc_readlink (struct dentry * dentry , struct vfsmount * mnt ,
1181- char __user * buffer , int buflen )
1179+ static int do_proc_readlink (struct path * path , char __user * buffer , int buflen )
11821180{
1183- struct inode * inode ;
11841181 char * tmp = (char * )__get_free_page (GFP_TEMPORARY );
1185- char * path ;
1182+ char * pathname ;
11861183 int len ;
11871184
11881185 if (!tmp )
11891186 return - ENOMEM ;
11901187
1191- inode = dentry -> d_inode ;
1192- path = d_path (dentry , mnt , tmp , PAGE_SIZE );
1193- len = PTR_ERR (path );
1194- if (IS_ERR (path ))
1188+ pathname = d_path (path -> dentry , path -> mnt , tmp , PAGE_SIZE );
1189+ len = PTR_ERR (pathname );
1190+ if (IS_ERR (pathname ))
11951191 goto out ;
1196- len = tmp + PAGE_SIZE - 1 - path ;
1192+ len = tmp + PAGE_SIZE - 1 - pathname ;
11971193
11981194 if (len > buflen )
11991195 len = buflen ;
1200- if (copy_to_user (buffer , path , len ))
1196+ if (copy_to_user (buffer , pathname , len ))
12011197 len = - EFAULT ;
12021198 out :
12031199 free_page ((unsigned long )tmp );
@@ -1208,20 +1204,18 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
12081204{
12091205 int error = - EACCES ;
12101206 struct inode * inode = dentry -> d_inode ;
1211- struct dentry * de ;
1212- struct vfsmount * mnt = NULL ;
1207+ struct path path ;
12131208
12141209 /* Are we allowed to snoop on the tasks file descriptors? */
12151210 if (!proc_fd_access_allowed (inode ))
12161211 goto out ;
12171212
1218- error = PROC_I (inode )-> op .proc_get_link (inode , & de , & mnt );
1213+ error = PROC_I (inode )-> op .proc_get_link (inode , & path );
12191214 if (error )
12201215 goto out ;
12211216
1222- error = do_proc_readlink (de , mnt , buffer , buflen );
1223- dput (de );
1224- mntput (mnt );
1217+ error = do_proc_readlink (& path , buffer , buflen );
1218+ path_put (& path );
12251219out :
12261220 return error ;
12271221}
@@ -1448,8 +1442,7 @@ static unsigned name_to_int(struct dentry *dentry)
14481442
14491443#define PROC_FDINFO_MAX 64
14501444
1451- static int proc_fd_info (struct inode * inode , struct dentry * * dentry ,
1452- struct vfsmount * * mnt , char * info )
1445+ static int proc_fd_info (struct inode * inode , struct path * path , char * info )
14531446{
14541447 struct task_struct * task = get_proc_task (inode );
14551448 struct files_struct * files = NULL ;
@@ -1468,10 +1461,10 @@ static int proc_fd_info(struct inode *inode, struct dentry **dentry,
14681461 spin_lock (& files -> file_lock );
14691462 file = fcheck_files (files , fd );
14701463 if (file ) {
1471- if (mnt )
1472- * mnt = mntget ( file -> f_path . mnt ) ;
1473- if ( dentry )
1474- * dentry = dget ( file -> f_path . dentry );
1464+ if (path ) {
1465+ * path = file -> f_path ;
1466+ path_get ( & file -> f_path );
1467+ }
14751468 if (info )
14761469 snprintf (info , PROC_FDINFO_MAX ,
14771470 "pos:\t%lli\n"
@@ -1488,10 +1481,9 @@ static int proc_fd_info(struct inode *inode, struct dentry **dentry,
14881481 return - ENOENT ;
14891482}
14901483
1491- static int proc_fd_link (struct inode * inode , struct dentry * * dentry ,
1492- struct vfsmount * * mnt )
1484+ static int proc_fd_link (struct inode * inode , struct path * path )
14931485{
1494- return proc_fd_info (inode , dentry , mnt , NULL );
1486+ return proc_fd_info (inode , path , NULL );
14951487}
14961488
14971489static int tid_fd_revalidate (struct dentry * dentry , struct nameidata * nd )
@@ -1685,7 +1677,7 @@ static ssize_t proc_fdinfo_read(struct file *file, char __user *buf,
16851677 size_t len , loff_t * ppos )
16861678{
16871679 char tmp [PROC_FDINFO_MAX ];
1688- int err = proc_fd_info (file -> f_path .dentry -> d_inode , NULL , NULL , tmp );
1680+ int err = proc_fd_info (file -> f_path .dentry -> d_inode , NULL , tmp );
16891681 if (!err )
16901682 err = simple_read_from_buffer (buf , len , ppos , tmp , strlen (tmp ));
16911683 return err ;
0 commit comments