Use struct path in struct nameidata
Subsystems (33)
cover Use struct path in struct nameidata
Hi Andrew,
Could you please consider these patches for -mm ? These patches apply on 2.6.23-mm1 and are mostly a repost of earlier patches.
Patches 1 to 11 have been Acked by Christoph Hellwig.
Patch 12 is another instance where (vfsmnt, dentry) to path conversion is possible.
Patch 13 is a patch which renames d_path to print_path and fixes comments as suggested by Christoph.
Compile and boot tested on x86, x86_64 and powerpc.
Regards,
Bharata.
PATCH 1/13 Don't touch fs_struct in drivers
From: Jan Blunck <[email protected]>
The sound drivers and the pnpbios core test for current->root != NULL. This test seems to be unnecessary since we always have rootfs mounted before initializing the drivers.
--- drivers/pnp/pnpbios/core.c | 2 -- sound/core/seq/seq_clientmgr.c | 4 ++-- sound/core/seq/seq_device.c | 3 --- sound/core/sound.c | 4 ---- sound/core/timer.c | 2 -- sound/ppc/daca.c | 5 ++--- sound/ppc/tumbler.c | 5 ++--- 7 files changed, 6 insertions(+), 19 deletions(-)
drivers/pnp/pnpbios/core.c +0 -2
@@ -105,8 +105,6 @@ static int pnp_dock_event(int dock, struchar *argv[3 ], **envp, *buf, *scratch;int i =0 , value; -if (!current->fs->root) -return -EAGAIN ;if (!(envp =kcalloc (20 ,sizeof (char *),GFP_KERNEL )))return -ENOMEM ;if (!(buf =kzalloc (256 ,GFP_KERNEL ))) {
sound/core/seq/seq_clientmgr.c +2 -2
@@ -152,13 +152,13 @@ struct snd_seq_client *snd_seq_client_us }spin_unlock_irqrestore (&clients_lock, flags);#ifdef CONFIG_KMOD -if (!in_interrupt () && current->fs->root) { +if (!in_interrupt ()) {static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS ];static char card_requested[SNDRV_CARDS ];if (clientid <SNDRV_SEQ_GLOBAL_CLIENTS ) {int idx; -if (! client_requested[clientid] && current->fs->root) { +if (!client_requested[clientid]) { client_requested[clientid] =1 ;for (idx =0 ; idx <15 ; idx++) {if (seq_client_load[idx] <0 )
sound/core/seq/seq_device.c +0 -3
@@ -150,9 +150,6 @@ void snd_seq_device_load_drivers(void)if (snd_seq_in_init)return ; -if (! current->fs->root) -return ; -mutex_lock (&ops_mutex);list_for_each_entry (ops, &opslist, list) { if (! (ops->driver & DRIVER_LOADED) &&
sound/core/sound.c +0 -4
@@ -72,8 +72,6 @@ static DEFINE_MUTEX(sound_mutex);*/ void snd_request_card (int card) { -if (! current->fs->root) -return ;if (snd_card_locked (card))return ;if (card <0 || card >= cards_limit)
@@ -87,8 +85,6 @@ static void snd_request_other(int minor) {char *str; -if (! current->fs->root) -return ;switch (minor) {case SNDRV_MINOR_SEQUENCER : str ="snd-seq" ;break ;case SNDRV_MINOR_TIMER : str ="snd-timer" ;break ;
sound/core/timer.c +0 -2
@@ -148,8 +148,6 @@ static struct snd_timer *snd_timer_find(static void snd_timer_request (struct snd_timer_id *tid) { -if (! current->fs->root) -return ;switch (tid->dev_class) {case SNDRV_TIMER_CLASS_GLOBAL :if (tid->device < timer_limit)
sound/ppc/daca.c +2 -3
@@ -246,9 +246,8 @@ int __init snd_pmac_daca_init(struct sndstruct pmac_daca *mix;#ifdef CONFIG_KMOD -if (current->fs->root) -request_module ("i2c-powermac" ); -#endif /* CONFIG_KMOD */ +request_module ("i2c-powermac" ); +#endif /* CONFIG_KMOD */ mix =kzalloc (sizeof (*mix),GFP_KERNEL );if (! mix)
sound/ppc/tumbler.c +2 -3
@@ -1327,9 +1327,8 @@ int __init snd_pmac_tumbler_init(structchar *chipname;#ifdef CONFIG_KMOD -if (current->fs->root) -request_module ("i2c-powermac" ); -#endif /* CONFIG_KMOD */ +request_module ("i2c-powermac" ); +#endif /* CONFIG_KMOD */ mix =kzalloc (sizeof (*mix),GFP_KERNEL );if (! mix)
PATCH 2/13 Don't touch fs_struct in usermodehelper
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
This test seems to be unnecessary since we always have rootfs mounted before calling a usermodehelper.
--- kernel/kmod.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
kernel/kmod.c +1 -4
@@ -173,10 +173,7 @@ static int ____call_usermodehelper(void*/ set_user_nice (current,0 ); - retval = -EPERM ; -if (current->fs->root) - retval =kernel_execve (sub_info->path, - sub_info->argv, sub_info->envp); + retval =kernel_execve (sub_info->path, sub_info->argv, sub_info->envp);/* Exec failed? */ sub_info->retval = retval;
PATCH 3/13 Remove path_release_on_umount()
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
path_release_on_umount() should only be called from sys_umount(). I merged the function into sys_umount() instead of having in in namei.c.
--- fs/namei.c | 10 ---------- fs/namespace.c | 4 +++- include/linux/namei.h | 1 - 3 files changed, 3 insertions(+), 12 deletions(-)
fs/namei.c +0 -10
@@ -368,16 +368,6 @@ void path_release(struct nameidata *nd)mntput (nd->mnt); } -/* -* umount() mustn't call path_release()/mntput() as that would clear -* mnt_expiry_mark -*/ -void path_release_on_umount (struct nameidata *nd) -{ -dput (nd->dentry); -mntput_no_expire (nd->mnt); -} -/** * release_open_intent - free up open intent resources * @nd: pointer to nameidata
fs/namespace.c +3 -1
@@ -988,7 +988,9 @@ asmlinkage long sys_umount(char __user * retval =do_umount (nd.mnt, flags); dput_and_out: -path_release_on_umount (&nd); +/* we mustn't call path_put() as that would clear mnt_expiry_mark */ +dput (nd.dentry); +mntput_no_expire (nd.mnt); out:return retval; }
include/linux/namei.h +0 -1
@@ -73,7 +73,6 @@ extern int FASTCALL(path_lookup(const chextern int vfs_path_lookup (struct dentry *,struct vfsmount *,const char *,unsigned int ,struct nameidata *);extern void path_release (struct nameidata *); -extern void path_release_on_umount (struct nameidata *);extern int __user_path_lookup_open (const char __user *,unsigned lookup_flags,struct nameidata *nd,int open_flags);extern int path_lookup_open (int dfd,const char *name,unsigned lookup_flags,struct nameidata *,int open_flags);
PATCH 4/13 Move struct path into its own header
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
Move the definition of struct path into its own header file for further patches.
--- include/linux/namei.h | 6 +----- include/linux/path.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-)
include/linux/namei.h +1 -5
@@ -4,6 +4,7 @@#include <linux/dcache.h> #include <linux/linkage.h> #include <linux/mount.h> +#include <linux/path.h> struct vfsmount ;
@@ -30,11 +31,6 @@ struct nameidata { } intent; }; -struct path { -struct vfsmount *mnt; -struct dentry *dentry; -}; -/* * Type of the last component on LOOKUP_PARENT */
include/linux/path.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _LINUX_PATH_H +#define _LINUX_PATH_H + +struct dentry ; +struct vfsmount ; + +struct path { +struct vfsmount *mnt; +struct dentry *dentry; +}; + +#endif /* _LINUX_PATH_H */
PATCH 5/13 Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.
--- arch/alpha/kernel/osf_sys.c | 2 arch/mips/kernel/sysirix.c | 6 arch/parisc/hpux/sys_hpux.c | 2 arch/powerpc/platforms/cell/spufs/inode.c | 18 +- arch/sparc64/solaris/fs.c | 8 arch/um/drivers/mconsole_kern.c | 6 drivers/md/dm-table.c | 2 drivers/mtd/mtdsuper.c | 10 - fs/afs/mntpt.c | 22 +- fs/autofs4/root.c | 3 fs/block_dev.c | 4 fs/coda/pioctl.c | 2 fs/compat.c | 4 fs/configfs/symlink.c | 4 fs/dquot.c | 7 fs/ecryptfs/dentry.c | 12 - fs/ecryptfs/inode.c | 24 +- fs/ecryptfs/main.c | 4 fs/exec.c | 4 fs/ext3/super.c | 4 fs/ext4/super.c | 4 fs/gfs2/ops_fstype.c | 5 fs/inotify_user.c | 2 fs/namei.c | 258 +++++++++++++++--------------- fs/namespace.c | 195 ++++++++++++---------- fs/nfs/dir.c | 2 fs/nfs/namespace.c | 27 +-- fs/nfs/nfs4proc.c | 15 - fs/nfsctl.c | 2 fs/nfsd/export.c | 35 ++-- fs/nfsd/nfs4recover.c | 36 ++-- fs/nfsd/nfs4state.c | 2 fs/open.c | 51 +++-- fs/proc/base.c | 3 fs/proc/proc_net.c | 10 - fs/proc/proc_sysctl.c | 2 fs/reiserfs/super.c | 6 fs/revoke.c | 2 fs/stat.c | 13 - fs/unionfs/inode.c | 12 - fs/unionfs/main.c | 10 - fs/unionfs/super.c | 18 +- fs/utimes.c | 4 fs/xattr.c | 24 +- fs/xfs/linux-2.6/xfs_ioctl.c | 6 include/linux/namei.h | 3 kernel/audit_tree.c | 12 - kernel/auditfilter.c | 11 - net/sunrpc/rpc_pipe.c | 5 net/unix/af_unix.c | 30 +-- security/selinux/hooks.c | 4 51 files changed, 488 insertions(+), 469 deletions(-)
arch/alpha/kernel/osf_sys.c +1 -1
@@ -260,7 +260,7 @@ osf_statfs(char __user *path, struct osf retval =user_path_walk (path, &nd);if (!retval) { - retval =do_osf_statfs (nd.dentry, buffer, bufsiz); + retval =do_osf_statfs (nd.path.dentry, buffer, bufsiz);path_release (&nd); }return retval;
arch/mips/kernel/sysirix.c +3 -3
@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __if (error) goto out; - error =vfs_statfs (nd.dentry, &kbuf); + error =vfs_statfs (nd.path.dentry, &kbuf);if (error) goto dput_and_out;
@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user error =user_path_walk (fname, &nd);if (error) goto out; - error =vfs_statfs (nd.dentry, &kbuf); + error =vfs_statfs (nd.path.dentry, &kbuf);if (error) goto dput_and_out;
@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __use error =user_path_walk (fname, &nd);if (error) goto out; - error =vfs_statfs (nd.dentry, &kbuf); + error =vfs_statfs (nd.path.dentry, &kbuf);if (error) goto dput_and_out;
arch/parisc/hpux/sys_hpux.c +1 -1
@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char _ error =user_path_walk (path, &nd);if (!error) {struct hpux_statfs tmp; - error =vfs_statfs_hpux (nd.dentry, &tmp); + error =vfs_statfs_hpux (nd.path.dentry, &tmp);if (!error &©_to_user (buf, &tmp,sizeof (tmp))) error = -EFAULT ;path_release (&nd);
arch/powerpc/platforms/cell/spufs/inode.c +10 -8
@@ -1,3 +1,4 @@ +/* * SPU file system *
@@ -578,7 +579,7 @@ long spufs_create(struct nameidata *nd, ret = -EINVAL ;/* check if we are on spufs */ -if (nd->dentry->d_sb->s_type != &spufs_type) +if (nd->path.dentry->d_sb->s_type != &spufs_type) goto out;/* don't accept undefined flags */
@@ -586,9 +587,9 @@ long spufs_create(struct nameidata *nd, goto out;/* only threads can be underneath a gang */ -if (nd->dentry != nd->dentry->d_sb->s_root) { +if (nd->path.dentry != nd->path.dentry->d_sb->s_root) {if ((flags &SPU_CREATE_GANG ) || - !SPUFS_I (nd->dentry->d_inode)->i_gang) + !SPUFS_I (nd->path.dentry->d_inode)->i_gang) goto out; }
@@ -604,16 +605,17 @@ long spufs_create(struct nameidata *nd, mode &= ~current->fs->umask;if (flags &SPU_CREATE_GANG ) -return spufs_create_gang (nd->dentry->d_inode, - dentry, nd->mnt, mode); +return spufs_create_gang (nd->path.dentry->d_inode, + dentry, nd->path.mnt, mode);else -return spufs_create_context (nd->dentry->d_inode, - dentry, nd->mnt, flags, mode, filp); +return spufs_create_context (nd->path.dentry->d_inode, + dentry, nd->path.mnt, flags, mode, + filp); out_dput:dput (dentry); out_dir: -mutex_unlock (&nd->dentry->d_inode->i_mutex); +mutex_unlock (&nd->path.dentry->d_inode->i_mutex); out:return ret; }
arch/sparc64/solaris/fs.c +4 -4
@@ -434,8 +434,8 @@ asmlinkage int solaris_statvfs(u32 path, error =user_path_walk (A (path),&nd);if (!error) { -struct inode * inode = nd.dentry->d_inode; - error =report_statvfs (nd.mnt, inode, buf); +struct inode *inode = nd.path.dentry->d_inode; + error =report_statvfs (nd.path.mnt, inode, buf);path_release (&nd); }return error;
@@ -464,8 +464,8 @@ asmlinkage int solaris_statvfs64(u32 patlock_kernel (); error =user_path_walk (A (path), &nd);if (!error) { -struct inode * inode = nd.dentry->d_inode; - error =report_statvfs64 (nd.mnt, inode, buf); +struct inode *inode = nd.path.dentry->d_inode; + error =report_statvfs64 (nd.path.mnt, inode, buf);path_release (&nd); }unlock_kernel ();
arch/um/drivers/mconsole_kern.c +3 -3
@@ -143,8 +143,8 @@ void mconsole_proc(struct mc_request *re }up_write (&super->s_umount); - nd.dentry = super->s_root; - nd.mnt =NULL ; + nd.path.dentry = super->s_root; + nd.path.mnt =NULL ; nd.flags =O_RDONLY +1 ; nd.last_type =LAST_ROOT ;
@@ -157,7 +157,7 @@ void mconsole_proc(struct mc_request *re goto out_kill; } - file =dentry_open (nd.dentry, nd.mnt,O_RDONLY ); + file =dentry_open (nd.path.dentry, nd.path.mnt,O_RDONLY );if (IS_ERR (file)) {mconsole_reply (req,"Failed to open file" ,1 ,0 ); goto out_kill;
drivers/md/dm-table.c +1 -1
@@ -355,7 +355,7 @@ static int lookup_device(const char *patif ((r =path_lookup (path,LOOKUP_FOLLOW , &nd)))return r; - inode = nd.dentry->d_inode; + inode = nd.path.dentry->d_inode;if (!inode) { r = -ENOENT ; goto out;
drivers/mtd/mtdsuper.c +5 -5
@@ -184,25 +184,25 @@ int get_sb_mtd(struct file_system_type * ret =path_lookup (dev_name,LOOKUP_FOLLOW , &nd);DEBUG (1 ,"MTDSB: path_lookup() returned %d, inode %p\n" , - ret, nd.dentry ? nd.dentry->d_inode :NULL ); + ret, nd.path.dentry ? nd.path.dentry->d_inode :NULL );if (ret)return ret; ret = -EINVAL ; -if (!S_ISBLK (nd.dentry->d_inode->i_mode)) +if (!S_ISBLK (nd.path.dentry->d_inode->i_mode)) goto out; -if (nd.mnt->mnt_flags &MNT_NODEV ) { +if (nd.path.mnt->mnt_flags &MNT_NODEV ) { ret = -EACCES ; goto out; } -if (imajor (nd.dentry->d_inode) !=MTD_BLOCK_MAJOR ) +if (imajor (nd.path.dentry->d_inode) !=MTD_BLOCK_MAJOR ) goto not_an_MTD_device; - mtdnr =iminor (nd.dentry->d_inode); + mtdnr =iminor (nd.path.dentry->d_inode);path_release (&nd); return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
fs/afs/mntpt.c +11 -11
@@ -218,14 +218,14 @@ static void *afs_mntpt_follow_link(struc_enter ("%p{%s},{%s:%p{%s},}" , dentry, dentry->d_name.name, - nd->mnt->mnt_devname, + nd->path.mnt->mnt_devname, dentry, - nd->dentry->d_name.name); + nd->path.dentry->d_name.name); -dput (nd->dentry); - nd->dentry =dget (dentry); +dput (nd->path.dentry); + nd->path.dentry =dget (dentry); - newmnt =afs_mntpt_do_automount (nd->dentry); + newmnt =afs_mntpt_do_automount (nd->path.dentry);if (IS_ERR (newmnt)) {path_release (nd);return (void *)newmnt;
@@ -235,17 +235,17 @@ static void *afs_mntpt_follow_link(struc err =do_add_mount (newmnt, nd,MNT_SHRINKABLE , &afs_vfsmounts);switch (err) {case 0 : -dput (nd->dentry); -mntput (nd->mnt); - nd->mnt = newmnt; - nd->dentry =dget (newmnt->mnt_root); +dput (nd->path.dentry); +mntput (nd->path.mnt); + nd->path.mnt = newmnt; + nd->path.dentry =dget (newmnt->mnt_root);schedule_delayed_work (&afs_mntpt_expiry_timer, afs_mntpt_expiry_timeout *HZ );break ;case -EBUSY :/* someone else made a mount here whilst we were busy */ -while (d_mountpoint (nd->dentry) && -follow_down (&nd->mnt, &nd->dentry)) +while (d_mountpoint (nd->path.dentry) && +follow_down (&nd->path.mnt, &nd->path.dentry)) ; err =0 ;default :
fs/autofs4/root.c +2 -1
@@ -526,7 +526,8 @@ static void *autofs4_follow_link(struct* so we don't need to follow the mount. */ if (d_mountpoint (dentry)) { -if (!autofs4_follow_mount (&nd->mnt, &nd->dentry)) { +if (!autofs4_follow_mount (&nd->path.mnt, + &nd->path.dentry)) { status = -ENOENT ; goto out_error; }
fs/block_dev.c +2 -2
@@ -1403,12 +1403,12 @@ struct block_device *lookup_bdev(const cif (error)return ERR_PTR (error); - inode = nd.dentry->d_inode; + inode = nd.path.dentry->d_inode; error = -ENOTBLK ;if (!S_ISBLK (inode->i_mode)) goto fail; error = -EACCES ; -if (nd.mnt->mnt_flags &MNT_NODEV ) +if (nd.path.mnt->mnt_flags &MNT_NODEV ) goto fail; error = -ENOMEM ; bdev =bd_acquire (inode);
fs/coda/pioctl.c +1 -1
@@ -75,7 +75,7 @@ static int coda_pioctl(struct inode * inif ( error ) {return error; }else { - target_inode = nd.dentry->d_inode; + target_inode = nd.path.dentry->d_inode; }/* return if it is not a Coda inode */
fs/compat.c +2 -2
@@ -241,7 +241,7 @@ asmlinkage long compat_sys_statfs(const error =user_path_walk (path, &nd);if (!error) {struct kstatfs tmp; - error =vfs_statfs (nd.dentry, &tmp); + error =vfs_statfs (nd.path.dentry, &tmp);if (!error) error =put_compat_statfs (buf, &tmp);path_release (&nd);
@@ -309,7 +309,7 @@ asmlinkage long compat_sys_statfs64(cons error =user_path_walk (path, &nd);if (!error) {struct kstatfs tmp; - error =vfs_statfs (nd.dentry, &tmp); + error =vfs_statfs (nd.path.dentry, &tmp);if (!error) error =put_compat_statfs64 (buf, &tmp);path_release (&nd);
fs/configfs/symlink.c +2 -2
@@ -99,8 +99,8 @@ static int get_target(const char *symnam ret =path_lookup (symname,LOOKUP_FOLLOW |LOOKUP_DIRECTORY , nd);if (!ret) { -if (nd->dentry->d_sb == configfs_sb) { - *target =configfs_get_config_item (nd->dentry); +if (nd->path.dentry->d_sb == configfs_sb) { + *target =configfs_get_config_item (nd->path.dentry);if (!*target) { ret = -ENOENT ;path_release (nd);
fs/dquot.c +4 -3
@@ -1620,14 +1620,15 @@ int vfs_quota_on(struct super_block *sb, error =path_lookup (path,LOOKUP_FOLLOW , &nd);if (error <0 )return error; - error =security_quota_on (nd.dentry); + error =security_quota_on (nd.path.dentry);if (error) goto out_path;/* Quota file not on the same filesystem? */ -if (nd.mnt->mnt_sb != sb) +if (nd.path.mnt->mnt_sb != sb) error = -EXDEV ;else - error =vfs_quota_on_inode (nd.dentry->d_inode, type, format_id); + error =vfs_quota_on_inode (nd.path.dentry->d_inode, type, + format_id); out_path:path_release (&nd);return error;
fs/ecryptfs/dentry.c +6 -6
@@ -51,13 +51,13 @@ static int ecryptfs_d_revalidate(structif (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) goto out; - dentry_save = nd->dentry; - vfsmount_save = nd->mnt; - nd->dentry = lower_dentry; - nd->mnt = lower_mnt; + dentry_save = nd->path.dentry; + vfsmount_save = nd->path.mnt; + nd->path.dentry = lower_dentry; + nd->path.mnt = lower_mnt; rc = lower_dentry->d_op->d_revalidate (lower_dentry, nd); - nd->dentry = dentry_save; - nd->mnt = vfsmount_save; + nd->path.dentry = dentry_save; + nd->path.mnt = vfsmount_save;if (dentry->d_inode) {struct inode *lower_inode =ecryptfs_inode_to_lower (dentry->d_inode);
fs/ecryptfs/inode.c +12 -12
@@ -77,13 +77,13 @@ ecryptfs_create_underlying_file(struct istruct vfsmount *vfsmount_save;int rc; - dentry_save = nd->dentry; - vfsmount_save = nd->mnt; - nd->dentry = lower_dentry; - nd->mnt = lower_mnt; + dentry_save = nd->path.dentry; + vfsmount_save = nd->path.mnt; + nd->path.dentry = lower_dentry; + nd->path.mnt = lower_mnt; rc =vfs_create (lower_dir_inode, lower_dentry, mode, nd); - nd->dentry = dentry_save; - nd->mnt = vfsmount_save; + nd->path.dentry = dentry_save; + nd->path.mnt = vfsmount_save;return rc; }
@@ -833,14 +833,14 @@ ecryptfs_permission(struct inode *inode,int rc;if (nd) { -struct vfsmount *vfsmnt_save = nd->mnt; -struct dentry *dentry_save = nd->dentry; +struct vfsmount *vfsmnt_save = nd->path.mnt; +struct dentry *dentry_save = nd->path.dentry; - nd->mnt =ecryptfs_dentry_to_lower_mnt (nd->dentry); - nd->dentry =ecryptfs_dentry_to_lower (nd->dentry); + nd->path.mnt =ecryptfs_dentry_to_lower_mnt (nd->path.dentry); + nd->path.dentry =ecryptfs_dentry_to_lower (nd->path.dentry); rc =permission (ecryptfs_inode_to_lower (inode), mask, nd); - nd->mnt = vfsmnt_save; - nd->dentry = dentry_save; + nd->path.mnt = vfsmnt_save; + nd->path.dentry = dentry_save; }else rc =permission (ecryptfs_inode_to_lower (inode), mask,NULL );return rc;
fs/ecryptfs/main.c +2 -2
@@ -519,8 +519,8 @@ static int ecryptfs_read_super(struct suecryptfs_printk (KERN_WARNING ,"path_lookup() failed\n" ); goto out; } - lower_root = nd.dentry; - lower_mnt = nd.mnt; + lower_root = nd.path.dentry; + lower_mnt = nd.path.mnt;ecryptfs_set_superblock_lower (sb, lower_root->d_sb); sb->s_maxbytes = lower_root->d_sb->s_maxbytes;ecryptfs_set_dentry_lower (sb->s_root, lower_root);
fs/exec.c +2 -2
@@ -112,7 +112,7 @@ asmlinkage long sys_uselib(const char __ goto out; error = -EINVAL ; -if (!S_ISREG (nd.dentry->d_inode->i_mode)) +if (!S_ISREG (nd.path.dentry->d_inode->i_mode)) goto exit; error =vfs_permission (&nd,MAY_READ |MAY_EXEC );
@@ -653,7 +653,7 @@ struct file *open_exec(const char *name) file =ERR_PTR (err);if (!err) { -struct inode *inode = nd.dentry->d_inode; +struct inode *inode = nd.path.dentry->d_inode; file =ERR_PTR (-EACCES );if (S_ISREG (inode->i_mode)) {int err =vfs_permission (&nd,MAY_EXEC );
fs/ext3/super.c +2 -2
@@ -2735,12 +2735,12 @@ static int ext3_quota_on(struct super_blif (err)return err;/* Quotafile not on the same filesystem? */ -if (nd.mnt->mnt_sb != sb) { +if (nd.path.mnt->mnt_sb != sb) {path_release (&nd);return -EXDEV ; }/* Quotafile not of fs root? */ -if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) +if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)printk (KERN_WARNING "EXT3-fs: Quota file not on filesystem root. " "Journalled quota will not work.\n" );
fs/ext4/super.c +2 -2
@@ -2938,12 +2938,12 @@ static int ext4_quota_on(struct super_blif (err)return err;/* Quotafile not on the same filesystem? */ -if (nd.mnt->mnt_sb != sb) { +if (nd.path.mnt->mnt_sb != sb) {path_release (&nd);return -EXDEV ; }/* Quotafile not of fs root? */ -if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) +if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)printk (KERN_WARNING "EXT4-fs: Quota file not on filesystem root. " "Journalled quota will not work.\n" );
fs/gfs2/ops_fstype.c +3 -2
@@ -821,12 +821,13 @@ static struct super_block* get_gfs2_sb(c dev_name); goto out; } - error =vfs_getattr (nd.mnt, nd.dentry, &stat); + error =vfs_getattr (nd.path.mnt, nd.path.dentry, &stat); fstype =get_fs_type ("gfs2" );list_for_each_entry (s, &fstype->fs_supers, s_instances) {if ((S_ISBLK (stat.mode) && s->s_dev == stat.rdev) || - (S_ISDIR (stat.mode) && s == nd.dentry->d_inode->i_sb)) { + (S_ISDIR (stat.mode) && + s == nd.path.dentry->d_inode->i_sb)) { sb = s; goto free_nd; }
fs/inotify_user.c +1 -1
@@ -640,7 +640,7 @@ asmlinkage long sys_inotify_add_watch(in goto fput_and_out;/* inode held in place by reference to nd; dev by fget on fd */ - inode = nd.dentry->d_inode; + inode = nd.path.dentry->d_inode; dev = filp->private_data;mutex_lock (&dev->up_mutex);
fs/namei.c +132 -126
656 lines not on this page · raw message
fs/namespace.c +104 -91
420 lines not on this page · raw message
fs/nfs/dir.c +1 -1
@@ -941,7 +941,7 @@ static int is_atomic_open(struct inode *if (nd->flags &LOOKUP_DIRECTORY )return 0 ;/* Are we trying to write to a read only partition? */ -if (__mnt_is_readonly (nd->mnt) && +if (__mnt_is_readonly (nd->path.mnt) && (nd->intent.open.flags & (O_CREAT |O_TRUNC |FMODE_WRITE )))return 0 ;return 1 ;
fs/nfs/namespace.c +15 -12
@@ -107,38 +107,40 @@ static void * nfs_follow_mountpoint(struBUG_ON (IS_ROOT (dentry));dprintk ("%s: enter\n" , __FUNCTION__); -dput (nd->dentry); - nd->dentry =dget (dentry); +dput (nd->path.dentry); + nd->path.dentry =dget (dentry);/* Look it up again */ - parent =dget_parent (nd->dentry); + parent =dget_parent (nd->path.dentry); err = server->nfs_client->rpc_ops->lookup (parent->d_inode, - &nd->dentry->d_name, + &nd->path.dentry->d_name, &fh, &fattr);dput (parent);if (err !=0 ) goto out_err;if (fattr.valid &NFS_ATTR_FATTR_V4_REFERRAL ) - mnt =nfs_do_refmount (nd->mnt, nd->dentry); + mnt =nfs_do_refmount (nd->path.mnt, nd->path.dentry);else - mnt =nfs_do_submount (nd->mnt, nd->dentry, &fh, &fattr); + mnt =nfs_do_submount (nd->path.mnt, nd->path.dentry, &fh, + &fattr); err =PTR_ERR (mnt);if (IS_ERR (mnt)) goto out_err;mntget (mnt); - err =do_add_mount (mnt, nd, nd->mnt->mnt_flags|MNT_SHRINKABLE , &nfs_automount_list); + err =do_add_mount (mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE , + &nfs_automount_list);if (err <0 ) {mntput (mnt);if (err == -EBUSY ) goto out_follow; goto out_err; } -mntput (nd->mnt); -dput (nd->dentry); - nd->mnt = mnt; - nd->dentry =dget (mnt->mnt_root); +mntput (nd->path.mnt); +dput (nd->path.dentry); + nd->path.mnt = mnt; + nd->path.dentry =dget (mnt->mnt_root);schedule_delayed_work (&nfs_automount_task, nfs_mountpoint_expiry_timeout); out:dprintk ("%s: done, returned %d\n" , __FUNCTION__, err);
@@ -149,7 +151,8 @@ out_err:path_release (nd); goto out; out_follow: -while (d_mountpoint (nd->dentry) &&follow_down (&nd->mnt, &nd->dentry)) +while (d_mountpoint (nd->path.dentry) && +follow_down (&nd->path.mnt, &nd->path.dentry)) ; err =0 ; goto out;
fs/nfs/nfs4proc.c +3 -12
@@ -1372,10 +1372,7 @@ out_close:struct dentry *nfs4_atomic_open (struct inode *dir,struct dentry *dentry,struct nameidata *nd) { -struct path path = { - .mnt = nd->mnt, - .dentry = dentry, - }; +struct path path = nd->path;struct iattr attr;struct rpc_cred *cred;struct nfs4_state *state;
@@ -1414,10 +1411,7 @@ nfs4_atomic_open(struct inode *dir, struint nfs4_open_revalidate (struct inode *dir,struct dentry *dentry,int openflags,struct nameidata *nd) { -struct path path = { - .mnt = nd->mnt, - .dentry = dentry, - }; +struct path path = nd->path;struct rpc_cred *cred;struct nfs4_state *state;
@@ -1866,10 +1860,7 @@ static int nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, int flags, struct nameidata *nd) { - struct path path = { - .mnt = nd->mnt, - .dentry = dentry, - }; + struct path path = nd->path;struct nfs4_state *state;struct rpc_cred *cred;int status =0 ;
fs/nfsctl.c +1 -1
@@ -41,7 +41,7 @@ static struct file *do_open(char *name, error =may_open (&nd,MAY_WRITE ,FMODE_WRITE );if (!error) -return dentry_open (nd.dentry, nd.mnt, flags); +return dentry_open (nd.path.dentry, nd.path.mnt, flags);path_release (&nd);return ERR_PTR (error);
fs/nfsd/export.c +18 -17
@@ -169,8 +169,8 @@ static int expkey_parse(struct cache_det goto out;dprintk ("Found the path %s\n" , buf); - key.ek_mnt = nd.mnt; - key.ek_dentry = nd.dentry; + key.ek_mnt = nd.path.mnt; + key.ek_dentry = nd.path.dentry; ek =svc_expkey_update (&key, ek);if (ek)
@@ -507,7 +507,7 @@ static int svc_export_parse(struct cachestruct svc_export exp, *expp;int an_int; - nd.dentry =NULL ; + nd.path.dentry =NULL ; exp.ex_path =NULL ;/* fs locations */
@@ -547,8 +547,8 @@ static int svc_export_parse(struct cache exp.h.flags =0 ; exp.ex_client = dom; - exp.ex_mnt = nd.mnt; - exp.ex_dentry = nd.dentry; + exp.ex_mnt = nd.path.mnt; + exp.ex_dentry = nd.path.dentry; exp.ex_path =kstrdup (buf,GFP_KERNEL ); err = -ENOMEM ;if (!exp.ex_path)
@@ -610,7 +610,7 @@ static int svc_export_parse(struct cache goto out; } - err =check_export (nd.dentry->d_inode, exp.ex_flags, + err =check_export (nd.path.dentry->d_inode, exp.ex_flags, exp.ex_uuid);if (err) goto out; }
@@ -629,7 +629,7 @@ static int svc_export_parse(struct cachenfsd4_fslocs_free (&exp.ex_fslocs);kfree (exp.ex_uuid);kfree (exp.ex_path); -if (nd.dentry) +if (nd.path.dentry)path_release (&nd); out_no_path:if (dom)
@@ -1030,7 +1030,7 @@ exp_export(struct nfsctl_export *nxp) goto out_unlock; err = -EINVAL ; - exp =exp_get_by_name (clp, nd.mnt, nd.dentry,NULL ); + exp =exp_get_by_name (clp, nd.path.mnt, nd.path.dentry,NULL );memset (&new,0 ,sizeof (new));
@@ -1038,7 +1038,8 @@ exp_export(struct nfsctl_export *nxp)if ((nxp->ex_flags &NFSEXP_FSID ) && (!IS_ERR (fsid_key =exp_get_fsid_key (clp, nxp->ex_dev))) && fsid_key->ek_mnt && - (fsid_key->ek_mnt != nd.mnt || fsid_key->ek_dentry != nd.dentry) ) + (fsid_key->ek_mnt != nd.path.mnt || + fsid_key->ek_dentry != nd.path.dentry)) goto finish;if (!IS_ERR (exp)) {
@@ -1054,7 +1055,7 @@ exp_export(struct nfsctl_export *nxp) goto finish; } - err =check_export (nd.dentry->d_inode, nxp->ex_flags,NULL ); + err =check_export (nd.path.dentry->d_inode, nxp->ex_flags,NULL );if (err) goto finish; err = -ENOMEM ;
@@ -1067,8 +1068,8 @@ exp_export(struct nfsctl_export *nxp)if (!new.ex_path) goto finish; new.ex_client = clp; - new.ex_mnt = nd.mnt; - new.ex_dentry = nd.dentry; + new.ex_mnt = nd.path.mnt; + new.ex_dentry = nd.path.dentry; new.ex_flags = nxp->ex_flags; new.ex_anon_uid = nxp->ex_anon_uid; new.ex_anon_gid = nxp->ex_anon_gid;
@@ -1148,7 +1149,7 @@ exp_unexport(struct nfsctl_export *nxp) goto out_domain; err = -EINVAL ; - exp =exp_get_by_name (dom, nd.mnt, nd.dentry,NULL ); + exp =exp_get_by_name (dom, nd.path.mnt, nd.path.dentry,NULL );path_release (&nd);if (IS_ERR (exp)) goto out_domain;
@@ -1185,12 +1186,12 @@ exp_rootfh(svc_client *clp, char *path,printk ("nfsd: exp_rootfh path not found %s" , path);return err; } - inode = nd.dentry->d_inode; + inode = nd.path.dentry->d_inode;dprintk ("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n" , - path, nd.dentry, clp->name, + path, nd.path.dentry, clp->name, inode->i_sb->s_id, inode->i_ino); - exp =exp_parent (clp, nd.mnt, nd.dentry,NULL ); + exp =exp_parent (clp, nd.path.mnt, nd.path.dentry,NULL );if (IS_ERR (exp)) { err =PTR_ERR (exp); goto out;
@@ -1200,7 +1201,7 @@ exp_rootfh(svc_client *clp, char *path,* fh must be initialized before calling fh_compose */ fh_init (&fh, maxsize); -if (fh_compose (&fh, exp, nd.dentry,NULL )) +if (fh_compose (&fh, exp, nd.path.dentry,NULL )) err = -EINVAL ;else err =0 ;
fs/nfsd/nfs4recover.c +18 -18
@@ -122,9 +122,9 @@ out_no_tfm:static void nfsd4_sync_rec_dir (void ) { -mutex_lock (&rec_dir.dentry->d_inode->i_mutex); -nfsd_sync_dir (rec_dir.dentry); -mutex_unlock (&rec_dir.dentry->d_inode->i_mutex); +mutex_lock (&rec_dir.path.dentry->d_inode->i_mutex); +nfsd_sync_dir (rec_dir.path.dentry); +mutex_unlock (&rec_dir.path.dentry->d_inode->i_mutex); }int
@@ -144,9 +144,9 @@ nfsd4_create_clid_dir(struct nfs4_clientnfs4_save_user (&uid, &gid);/* lock the parent */ -mutex_lock (&rec_dir.dentry->d_inode->i_mutex); +mutex_lock (&rec_dir.path.dentry->d_inode->i_mutex); - dentry =lookup_one_len (dname, rec_dir.dentry,HEXDIR_LEN -1 ); + dentry =lookup_one_len (dname, rec_dir.path.dentry,HEXDIR_LEN -1 );if (IS_ERR (dentry)) { status =PTR_ERR (dentry); goto out_unlock;
@@ -156,15 +156,15 @@ nfsd4_create_clid_dir(struct nfs4_clientdprintk ("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n" ); goto out_put; } - status =mnt_want_write (rec_dir.mnt); + status =mnt_want_write (rec_dir.path.mnt);if (status) goto out_put; - status =vfs_mkdir (rec_dir.dentry->d_inode, dentry,S_IRWXU ); -mnt_drop_write (rec_dir.mnt); + status =vfs_mkdir (rec_dir.path.dentry->d_inode, dentry,S_IRWXU ); +mnt_drop_write (rec_dir.path.mnt); out_put:dput (dentry); out_unlock: -mutex_unlock (&rec_dir.dentry->d_inode->i_mutex); +mutex_unlock (&rec_dir.path.dentry->d_inode->i_mutex);if (status ==0 ) { clp->cl_firststate =1 ;nfsd4_sync_rec_dir ();
@@ -227,7 +227,7 @@ nfsd4_list_rec_dir(struct dentry *dir, rnfs4_save_user (&uid, &gid); - filp =dentry_open (dget (dir),mntget (rec_dir.mnt),O_RDONLY ); + filp =dentry_open (dget (dir),mntget (rec_dir.path.mnt),O_RDONLY ); status =PTR_ERR (filp);if (IS_ERR (filp)) goto out;
@@ -292,9 +292,9 @@ nfsd4_unlink_clid_dir(char *name, int nadprintk ("NFSD: nfsd4_unlink_clid_dir. name %.*s\n" , namlen, name); -mutex_lock (&rec_dir.dentry->d_inode->i_mutex); - dentry =lookup_one_len (name, rec_dir.dentry, namlen); -mutex_unlock (&rec_dir.dentry->d_inode->i_mutex); +mutex_lock (&rec_dir.path.dentry->d_inode->i_mutex); + dentry =lookup_one_len (name, rec_dir.path.dentry, namlen); +mutex_unlock (&rec_dir.path.dentry->d_inode->i_mutex);if (IS_ERR (dentry)) { status =PTR_ERR (dentry);return status;
@@ -303,7 +303,7 @@ nfsd4_unlink_clid_dir(char *name, int naif (!dentry->d_inode) goto out; - status =nfsd4_clear_clid_dir (rec_dir.dentry, dentry); + status =nfsd4_clear_clid_dir (rec_dir.path.dentry, dentry); out:dput (dentry);return status;
@@ -353,12 +353,12 @@ nfsd4_recdir_purge_old(void) {if (!rec_dir_init)return ; - status =nfsd4_list_rec_dir (rec_dir.dentry, purge_old); + status =nfsd4_list_rec_dir (rec_dir.path.dentry, purge_old);if (status ==0 )nfsd4_sync_rec_dir ();if (status)printk ("nfsd4: failed to purge old clients from recovery" -" directory %s\n" , rec_dir.dentry->d_name.name); +" directory %s\n" , rec_dir.path.dentry->d_name.name);return ; }
@@ -379,10 +379,10 @@ intnfsd4_recdir_load (void) {int status; - status =nfsd4_list_rec_dir (rec_dir.dentry, load_recdir); + status =nfsd4_list_rec_dir (rec_dir.path.dentry, load_recdir);if (status)printk ("nfsd4: failed loading clients from recovery" -" directory %s\n" , rec_dir.dentry->d_name.name); +" directory %s\n" , rec_dir.path.dentry->d_name.name);return status; }
fs/nfsd/nfs4state.c +1 -1
@@ -3326,7 +3326,7 @@ nfs4_reset_recoverydir(char *recdir)if (status)return status; status = -ENOTDIR ; -if (S_ISDIR (nd.dentry->d_inode->i_mode)) { +if (S_ISDIR (nd.path.dentry->d_inode->i_mode)) {nfs4_set_recdir (recdir); status =0 ; }
fs/open.c +26 -25
162 lines not on this page · raw message
fs/proc/base.c +2 -1
@@ -1039,7 +1039,8 @@ static void *proc_pid_follow_link(structif (!proc_fd_access_allowed (inode)) goto out; - error =PROC_I (inode)->op.proc_get_link (inode, &nd->dentry, &nd->mnt); + error =PROC_I (inode)->op.proc_get_link (inode, &nd->path.dentry, + &nd->path.mnt); nd->last_type =LAST_BIND ; out:return ERR_PTR (error);
fs/proc/proc_net.c +5 -5
@@ -92,11 +92,11 @@ static void *proc_net_follow_link(structif (!shadow)return ERR_PTR (-ENOENT ); -dput (nd->dentry); +dput (nd->path.dentry);/* My dentry count is 1 and that should be enough as the * shadow dentry is thrown away immediately. */ - nd->dentry = shadow; + nd->path.dentry = shadow;return NULL ; }
@@ -106,12 +106,12 @@ static struct dentry *proc_net_lookup(ststruct net *net = current->nsproxy->net_ns;struct dentry *shadow; - shadow =proc_net_shadow_dentry (nd->dentry, net->proc_net); + shadow =proc_net_shadow_dentry (nd->path.dentry, net->proc_net);if (!shadow)return ERR_PTR (-ENOENT ); -dput (nd->dentry); - nd->dentry = shadow; +dput (nd->path.dentry); + nd->path.dentry = shadow;return shadow->d_inode->i_op->lookup (shadow->d_inode, dentry, nd); }
fs/proc/proc_sysctl.c +1 -1
@@ -405,7 +405,7 @@ static int proc_sys_permission(struct inif (!nd || !depth) goto out; - dentry = nd->dentry; + dentry = nd->path.dentry; table =do_proc_sys_lookup (dentry->d_parent, &dentry->d_name, &head);/* If the entry does not exist deny permission */
fs/reiserfs/super.c +3 -3
@@ -1997,12 +1997,12 @@ static int reiserfs_quota_on(struct supeif (err)return err;/* Quotafile not on the same filesystem? */ -if (nd.mnt->mnt_sb != sb) { +if (nd.path.mnt->mnt_sb != sb) {path_release (&nd);return -EXDEV ; }/* We must not pack tails for quota files on reiserfs for quota IO to work */ -if (!REISERFS_I (nd.dentry->d_inode)->i_flags & i_nopack_mask) { +if (!REISERFS_I (nd.path.dentry->d_inode)->i_flags & i_nopack_mask) {reiserfs_warning (sb,"reiserfs: Quota file must have tail packing disabled." );path_release (&nd);
@@ -2015,7 +2015,7 @@ static int reiserfs_quota_on(struct supereturn vfs_quota_on (sb, type, format_id, path); }/* Quotafile not of fs root? */ -if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) +if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)reiserfs_warning (sb,"reiserfs: Quota file not on filesystem root. " "Journalled quota will not work." );
fs/revoke.c +1 -1
@@ -649,7 +649,7 @@ asmlinkage long sys_revokeat(int dfd, co err =__user_walk_fd (dfd, filename,0 , &nd);if (!err) { - err =do_revoke (nd.dentry->d_inode,NULL ); + err =do_revoke (nd.path.dentry->d_inode,NULL );path_release (&nd); }return err;
fs/stat.c +7 -6
@@ -62,7 +62,7 @@ int vfs_stat_fd(int dfd, char __user *na error =__user_walk_fd (dfd, name,LOOKUP_FOLLOW , &nd);if (!error) { - error =vfs_getattr (nd.mnt, nd.dentry, stat); + error =vfs_getattr (nd.path.mnt, nd.path.dentry, stat);path_release (&nd); }return error;
@@ -82,7 +82,7 @@ int vfs_lstat_fd(int dfd, char __user *n error =__user_walk_fd (dfd, name,0 , &nd);if (!error) { - error =vfs_getattr (nd.mnt, nd.dentry, stat); + error =vfs_getattr (nd.path.mnt, nd.path.dentry, stat);path_release (&nd); }return error;
@@ -302,14 +302,15 @@ asmlinkage long sys_readlinkat(int dfd, error =__user_walk_fd (dfd, path,0 , &nd);if (!error) { -struct inode * inode = nd.dentry->d_inode; +struct inode *inode = nd.path.dentry->d_inode; error = -EINVAL ;if (inode->i_op && inode->i_op->readlink) { - error =security_inode_readlink (nd.dentry); + error =security_inode_readlink (nd.path.dentry);if (!error) { -touch_atime (nd.mnt, nd.dentry); - error = inode->i_op->readlink (nd.dentry, buf, bufsiz); +touch_atime (nd.path.mnt, nd.path.dentry); + error = inode->i_op->readlink (nd.path.dentry, + buf, bufsiz); } }path_release (&nd);
fs/unionfs/inode.c +4 -8
@@ -168,10 +168,8 @@ static struct dentry *unionfs_lookup(strunionfs_read_lock (dentry->d_sb);/* save the dentry & vfsmnt from namei */ -if (nd) { - path_save.dentry = nd->dentry; - path_save.mnt = nd->mnt; - } +if (nd) + path_save = nd->path;/* * unionfs_lookup_backend returns a locked dentry upon success,
@@ -180,10 +178,8 @@ static struct dentry *unionfs_lookup(str ret =unionfs_lookup_backend (dentry, nd,INTERPOSE_LOOKUP );/* restore the dentry & vfsmnt in namei */ -if (nd) { - nd->dentry = path_save.dentry; - nd->mnt = path_save.mnt; - } +if (nd) + nd->path = path_save;if (!IS_ERR (ret)) {if (ret) dentry = ret;
fs/unionfs/main.c +5 -5
@@ -227,11 +227,11 @@ void unionfs_reinterpose(struct dentry *int check_branch (struct nameidata *nd) {/* XXX: remove in ODF code -- stacking unions allowed there */ -if (!strcmp (nd->dentry->d_sb->s_type->name,UNIONFS_NAME )) +if (!strcmp (nd->path.dentry->d_sb->s_type->name,UNIONFS_NAME ))return -EINVAL ; -if (!nd->dentry->d_inode) +if (!nd->path.dentry->d_inode)return -ENOENT ; -if (!S_ISDIR (nd->dentry->d_inode->i_mode)) +if (!S_ISDIR (nd->path.dentry->d_inode->i_mode))return -ENOTDIR ;return 0 ; }
@@ -372,8 +372,8 @@ static int parse_dirs_option(struct supe goto out; } - lower_root_info->lower_paths[bindex].dentry = nd.dentry; - lower_root_info->lower_paths[bindex].mnt = nd.mnt; + lower_root_info->lower_paths[bindex].dentry = nd.path.dentry; + lower_root_info->lower_paths[bindex].mnt = nd.path.mnt;set_branchperms (sb, bindex, perms);set_branch_count (sb, bindex,0 );
fs/unionfs/super.c +9 -9
@@ -202,8 +202,8 @@ static noinline int do_remount_mode_opti goto out; }for (idx =0 ; idx < cur_branches; idx++) -if (nd.mnt == new_lower_paths[idx].mnt && - nd.dentry == new_lower_paths[idx].dentry) +if (nd.path.mnt == new_lower_paths[idx].mnt && + nd.path.dentry == new_lower_paths[idx].dentry)break ;path_release (&nd);/* no longer needed */ if (idx == cur_branches) {
@@ -245,8 +245,8 @@ static noinline int do_remount_del_optio goto out; }for (idx =0 ; idx < cur_branches; idx++) -if (nd.mnt == new_lower_paths[idx].mnt && - nd.dentry == new_lower_paths[idx].dentry) +if (nd.path.mnt == new_lower_paths[idx].mnt && + nd.path.dentry == new_lower_paths[idx].dentry)break ;path_release (&nd);/* no longer needed */ if (idx == cur_branches) {
@@ -329,8 +329,8 @@ static noinline int do_remount_add_optio goto out; }for (idx =0 ; idx < cur_branches; idx++) -if (nd.mnt == new_lower_paths[idx].mnt && - nd.dentry == new_lower_paths[idx].dentry) +if (nd.path.mnt == new_lower_paths[idx].mnt && + nd.path.dentry == new_lower_paths[idx].dentry)break ;path_release (&nd);/* no longer needed */ if (idx == cur_branches) {
@@ -392,10 +392,10 @@ found_insertion_point:memmove (&new_lower_paths[idx+1 ], &new_lower_paths[idx], (cur_branches - idx) *sizeof (struct path )); } - new_lower_paths[idx].dentry = nd.dentry; - new_lower_paths[idx].mnt = nd.mnt; + new_lower_paths[idx].dentry = nd.path.dentry; + new_lower_paths[idx].mnt = nd.path.mnt; - new_data[idx].sb = nd.dentry->d_sb; + new_data[idx].sb = nd.path.dentry->d_sb;atomic_set (&new_data[idx].open_files,0 ); new_data[idx].branchperms = perms; new_data[idx].branch_id = ++*high_branch_id;/* assign new branch ID */
fs/utimes.c +2 -2
@@ -86,8 +86,8 @@ long do_utimes(int dfd, char __user *filif (error) goto out; - dentry = nd.dentry; - mnt = nd.mnt; + dentry = nd.path.dentry; + mnt = nd.path.mnt; } inode = dentry->d_inode;
fs/xattr.c +12 -12
@@ -234,11 +234,11 @@ sys_setxattr(char __user *path, char __u error =user_path_walk (path, &nd);if (error)return error; - error =mnt_want_write (nd.mnt); + error =mnt_want_write (nd.path.mnt);if (error)return error; - error =setxattr (nd.dentry, name, value, size, flags); -mnt_drop_write (nd.mnt); + error =setxattr (nd.path.dentry, name, value, size, flags); +mnt_drop_write (nd.path.mnt);path_release (&nd);return error; }
@@ -253,11 +253,11 @@ sys_lsetxattr(char __user *path, char __ error =user_path_walk_link (path, &nd);if (error)return error; - error =mnt_want_write (nd.mnt); + error =mnt_want_write (nd.path.mnt);if (error)return error; - error =setxattr (nd.dentry, name, value, size, flags); -mnt_drop_write (nd.mnt); + error =setxattr (nd.path.dentry, name, value, size, flags); +mnt_drop_write (nd.path.mnt);path_release (&nd);return error; }
@@ -332,7 +332,7 @@ sys_getxattr(char __user *path, char __u error =user_path_walk (path, &nd);if (error)return error; - error =getxattr (nd.dentry, name, value, size); + error =getxattr (nd.path.dentry, name, value, size);path_release (&nd);return error; }
@@ -347,7 +347,7 @@ sys_lgetxattr(char __user *path, char __ error =user_path_walk_link (path, &nd);if (error)return error; - error =getxattr (nd.dentry, name, value, size); + error =getxattr (nd.path.dentry, name, value, size);path_release (&nd);return error; }
@@ -406,7 +406,7 @@ sys_listxattr(char __user *path, char __ error =user_path_walk (path, &nd);if (error)return error; - error =listxattr (nd.dentry, list, size); + error =listxattr (nd.path.dentry, list, size);path_release (&nd);return error; }
@@ -420,7 +420,7 @@ sys_llistxattr(char __user *path, char _ error =user_path_walk_link (path, &nd);if (error)return error; - error =listxattr (nd.dentry, list, size); + error =listxattr (nd.path.dentry, list, size);path_release (&nd);return error; }
@@ -467,7 +467,7 @@ sys_removexattr(char __user *path, char error =user_path_walk (path, &nd);if (error)return error; - error =removexattr (nd.dentry, name); + error =removexattr (nd.path.dentry, name);path_release (&nd);return error; }
@@ -481,7 +481,7 @@ sys_lremovexattr(char __user *path, char error =user_path_walk_link (path, &nd);if (error)return error; - error =removexattr (nd.dentry, name); + error =removexattr (nd.path.dentry, name);path_release (&nd);return error; }
fs/xfs/linux-2.6/xfs_ioctl.c +3 -3
@@ -92,9 +92,9 @@ xfs_find_handle(if (error)return error; -ASSERT (nd.dentry); -ASSERT (nd.dentry->d_inode); - inode =igrab (nd.dentry->d_inode); +ASSERT (nd.path.dentry); +ASSERT (nd.path.dentry->d_inode); + inode =igrab (nd.path.dentry->d_inode);path_release (&nd);break ; }
include/linux/namei.h +1 -2
@@ -17,8 +17,7 @@ struct open_intent {enum {MAX_NESTED_LINKS =8 };struct nameidata { -struct dentry *dentry; -struct vfsmount *mnt; +struct path path;struct qstr last;unsigned int flags;int last_type;
kernel/audit_tree.c +6 -6
@@ -549,7 +549,7 @@ void audit_trim_trees(void)if (err) goto skip_it; - root_mnt =collect_mounts (nd.mnt, nd.dentry); + root_mnt =collect_mounts (nd.path.mnt, nd.path.dentry);path_release (&nd);if (!root_mnt) goto skip_it;
@@ -583,17 +583,17 @@ skip_it:static int is_under (struct vfsmount *mnt,struct dentry *dentry,struct nameidata *nd) { -if (mnt != nd->mnt) { +if (mnt != nd->path.mnt) {for (;;) {if (mnt->mnt_parent == mnt)return 0 ; -if (mnt->mnt_parent == nd->mnt) +if (mnt->mnt_parent == nd->path.mnt)break ; mnt = mnt->mnt_parent; } dentry = mnt->mnt_mountpoint; } -return is_subdir (dentry, nd->dentry); +return is_subdir (dentry, nd->path.dentry); }int audit_make_tree (struct audit_krule *rule,char *pathname,u32 op)
@@ -641,7 +641,7 @@ int audit_add_tree_rule(struct audit_kru err =path_lookup (tree->pathname,0 , &nd);if (err) goto Err; - mnt =collect_mounts (nd.mnt, nd.dentry); + mnt =collect_mounts (nd.path.mnt, nd.path.dentry);path_release (&nd);if (!mnt) { err = -ENOMEM ;
@@ -701,7 +701,7 @@ int audit_tag_tree(char *old, char *new) err =path_lookup (new,0 , &nd);if (err)return err; - tagged =collect_mounts (nd.mnt, nd.dentry); + tagged =collect_mounts (nd.path.mnt, nd.path.dentry);path_release (&nd);if (!tagged)return -ENOMEM ;
kernel/auditfilter.c +6 -5
@@ -167,8 +167,8 @@ static struct audit_parent *audit_init_pinotify_init_watch (&parent->wdata);/* grab a ref so inotify watch hangs around until we take audit_filter_mutex */ get_inotify_watch (&parent->wdata); - wd =inotify_add_watch (audit_ih, &parent->wdata, ndp->dentry->d_inode, -AUDIT_IN_WATCH ); + wd =inotify_add_watch (audit_ih, &parent->wdata, + ndp->path.dentry->d_inode,AUDIT_IN_WATCH );if (wd <0 ) {audit_free_parent (&parent->wdata);return ERR_PTR (wd);
@@ -1205,8 +1205,8 @@ static int audit_add_watch(struct audit_/* update watch filter fields */ if (ndw) { - watch->dev = ndw->dentry->d_inode->i_sb->s_dev; - watch->ino = ndw->dentry->d_inode->i_ino; + watch->dev = ndw->path.dentry->d_inode->i_sb->s_dev; + watch->ino = ndw->path.dentry->d_inode->i_ino; }/* The audit_filter_mutex must not be held during inotify calls because
@@ -1216,7 +1216,8 @@ static int audit_add_watch(struct audit_*/ mutex_unlock (&audit_filter_mutex); -if (inotify_find_watch (audit_ih, ndp->dentry->d_inode, &i_watch) <0 ) { +if (inotify_find_watch (audit_ih, ndp->path.dentry->d_inode, + &i_watch) <0 ) { parent =audit_init_parent (ndp);if (IS_ERR (parent)) {/* caller expects mutex locked */
net/sunrpc/rpc_pipe.c +3 -2
@@ -657,7 +657,8 @@ rpc_lookup_negative(char *path, struct nif ((error =rpc_lookup_parent (path, nd)) !=0 )return ERR_PTR (error); - dentry =rpc_lookup_create (nd->dentry, nd->last.name, nd->last.len,1 ); + dentry =rpc_lookup_create (nd->path.dentry, nd->last.name, nd->last.len, +1 );if (IS_ERR (dentry))rpc_release_path (nd);return dentry;
@@ -675,7 +676,7 @@ rpc_mkdir(char *path, struct rpc_clnt *r dentry =rpc_lookup_negative (path, &nd);if (IS_ERR (dentry))return dentry; - dir = nd.dentry->d_inode; + dir = nd.path.dentry->d_inode;if ((error =__rpc_mkdir (dir, dentry)) !=0 ) goto err_dput;RPC_I (dentry->d_inode)->private = rpc_client;
net/unix/af_unix.c +15 -15
@@ -734,7 +734,7 @@ static struct sock *unix_find_other(struif (err) goto fail; - err =mnt_want_write (nd.mnt); + err =mnt_want_write (nd.path.mnt);if (err) goto put_path_fail;
@@ -743,17 +743,17 @@ static struct sock *unix_find_other(stru goto mnt_drop_write_fail; err = -ECONNREFUSED ; -if (!S_ISSOCK (nd.dentry->d_inode->i_mode)) +if (!S_ISSOCK (nd.path.dentry->d_inode->i_mode)) goto mnt_drop_write_fail; - u=unix_find_socket_byinode (nd.dentry->d_inode); + u=unix_find_socket_byinode (nd.path.dentry->d_inode);if (!u) goto mnt_drop_write_fail;if (u->sk_type == type) -touch_atime (nd.mnt, nd.dentry); +touch_atime (nd.path.mnt, nd.path.dentry);path_release (&nd); -mnt_drop_write (nd.mnt); +mnt_drop_write (nd.path.mnt); err=-EPROTOTYPE ;if (u->sk_type != type) {
@@ -774,7 +774,7 @@ static struct sock *unix_find_other(strureturn u; mnt_drop_write_fail: -mnt_drop_write (nd.mnt); +mnt_drop_write (nd.path.mnt); put_path_fail:path_release (&nd); fail:
@@ -846,16 +846,16 @@ static int unix_bind(struct socket *sock*/ mode =S_IFSOCK | (SOCK_INODE (sock)->i_mode & ~current->fs->umask); - err =mnt_want_write (nd.mnt); + err =mnt_want_write (nd.path.mnt);if (err) goto out_mknod_dput; - err =vfs_mknod (nd.dentry->d_inode, dentry, mode,0 ); -mnt_drop_write (nd.mnt); + err =vfs_mknod (nd.path.dentry->d_inode, dentry, mode,0 ); +mnt_drop_write (nd.path.mnt);if (err) goto out_mknod_dput; -mutex_unlock (&nd.dentry->d_inode->i_mutex); -dput (nd.dentry); - nd.dentry = dentry; +mutex_unlock (&nd.path.dentry->d_inode->i_mutex); +dput (nd.path.dentry); + nd.path.dentry = dentry; addr->hash =UNIX_HASH_SIZE ; }
@@ -873,8 +873,8 @@ static int unix_bind(struct socket *sock list = &unix_socket_table[addr->hash]; }else { list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE -1 )]; - u->dentry = nd.dentry; - u->mnt = nd.mnt; + u->dentry = nd.path.dentry; + u->mnt = nd.path.mnt; } err =0 ;
@@ -892,7 +892,7 @@ out: out_mknod_dput:dput (dentry); out_mknod_unlock: -mutex_unlock (&nd.dentry->d_inode->i_mutex); +mutex_unlock (&nd.path.dentry->d_inode->i_mutex);path_release (&nd); out_mknod_parent:if (err==-EEXIST )
security/selinux/hooks.c +2 -2
@@ -2091,10 +2091,10 @@ static int selinux_mount(char * dev_namereturn rc;if (flags &MS_REMOUNT ) -return superblock_has_perm (current, nd->mnt->mnt_sb, +return superblock_has_perm (current, nd->path.mnt->mnt_sb,FILESYSTEM__REMOUNT ,NULL );else -return dentry_has_perm (current, nd->mnt, nd->dentry, +return dentry_has_perm (current, nd->path.mnt, nd->path.dentry,FILE__MOUNTON ); }
PATCH 6/13 Introduce path_put()
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
* Add path_put() functions for releasing a reference to the dentry and vfsmount of a struct path in the right order
* Switch from path_release(nd) to path_put(&nd->path)
* Rename dput_path() to path_put_conditional()
--- arch/alpha/kernel/osf_sys.c | 2 arch/mips/kernel/sysirix.c | 6 +- arch/parisc/hpux/sys_hpux.c | 2 arch/powerpc/platforms/cell/spufs/syscalls.c | 2 arch/sparc64/solaris/fs.c | 4 - drivers/md/dm-table.c | 2 drivers/mtd/mtdsuper.c | 4 - fs/afs/mntpt.c | 2 fs/autofs4/root.c | 2 fs/block_dev.c | 2 fs/coda/pioctl.c | 4 - fs/compat.c | 4 - fs/configfs/symlink.c | 4 - fs/dquot.c | 2 fs/ecryptfs/main.c | 2 fs/exec.c | 4 - fs/ext3/super.c | 4 - fs/ext4/super.c | 4 - fs/gfs2/ops_fstype.c | 2 fs/inotify_user.c | 4 - fs/namei.c | 56 ++++++++++++++------------- fs/namespace.c | 20 ++++----- fs/nfs/namespace.c | 2 fs/nfsctl.c | 2 fs/nfsd/export.c | 10 ++-- fs/nfsd/nfs4recover.c | 2 fs/nfsd/nfs4state.c | 2 fs/open.c | 22 +++++----- fs/proc/base.c | 2 fs/reiserfs/super.c | 8 +-- fs/revoke.c | 2 fs/stat.c | 6 +- fs/unionfs/main.c | 2 fs/unionfs/super.c | 12 ++--- fs/utimes.c | 2 fs/xattr.c | 16 +++---- fs/xfs/linux-2.6/xfs_ioctl.c | 2 include/linux/namei.h | 7 --- include/linux/path.h | 2 kernel/audit_tree.c | 16 +++---- kernel/auditfilter.c | 4 - net/sunrpc/rpc_pipe.c | 2 net/unix/af_unix.c | 6 +- 43 files changed, 134 insertions(+), 133 deletions(-)
arch/alpha/kernel/osf_sys.c +1 -1
@@ -261,7 +261,7 @@ osf_statfs(char __user *path, struct osf retval =user_path_walk (path, &nd);if (!retval) { retval =do_osf_statfs (nd.path.dentry, buffer, bufsiz); -path_release (&nd); +path_put (&nd.path); }return retval; }
arch/mips/kernel/sysirix.c +3 -3
@@ -711,7 +711,7 @@ asmlinkage int irix_statfs(const char __ } dput_and_out: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -1385,7 +1385,7 @@ asmlinkage int irix_statvfs(char __user error |=__put_user (0 , &buf->f_fstr[i]); dput_and_out: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -1636,7 +1636,7 @@ asmlinkage int irix_statvfs64(char __use error |=__put_user (0 , &buf->f_fstr[i]); dput_and_out: -path_release (&nd); +path_put (&nd.path); out:return error; }
arch/parisc/hpux/sys_hpux.c +1 -1
@@ -222,7 +222,7 @@ asmlinkage long hpux_statfs(const char _ error =vfs_statfs_hpux (nd.path.dentry, &tmp);if (!error &©_to_user (buf, &tmp,sizeof (tmp))) error = -EFAULT ; -path_release (&nd); +path_put (&nd.path); }return error; }
arch/powerpc/platforms/cell/spufs/syscalls.c +1 -1
@@ -73,7 +73,7 @@ static long do_spu_create(const char __u LOOKUP_OPEN|LOOKUP_CREATE, &nd);if (!ret) { ret =spufs_create (&nd, flags, mode, neighbor); -path_release (&nd); +path_put (&nd.path); }putname (tmp); }
arch/sparc64/solaris/fs.c +2 -2
@@ -436,7 +436,7 @@ asmlinkage int solaris_statvfs(u32 path,if (!error) {struct inode *inode = nd.path.dentry->d_inode; error =report_statvfs (nd.path.mnt, inode, buf); -path_release (&nd); +path_put (&nd.path); }return error; }
@@ -466,7 +466,7 @@ asmlinkage int solaris_statvfs64(u32 patif (!error) {struct inode *inode = nd.path.dentry->d_inode; error =report_statvfs64 (nd.path.mnt, inode, buf); -path_release (&nd); +path_put (&nd.path); }unlock_kernel ();return error;
drivers/md/dm-table.c +1 -1
@@ -369,7 +369,7 @@ static int lookup_device(const char *pat *dev = inode->i_rdev; out: -path_release (&nd); +path_put (&nd.path);return r; }
drivers/mtd/mtdsuper.c +2 -2
@@ -203,7 +203,7 @@ int get_sb_mtd(struct file_system_type * goto not_an_MTD_device; mtdnr =iminor (nd.path.dentry->d_inode); -path_release (&nd); +path_put (&nd.path);return get_sb_mtd_nr (fs_type, flags, dev_name, data, mtdnr, fill_super, mnt);
@@ -214,7 +214,7 @@ not_an_MTD_device:"MTD: Attempt to mount non-MTD device \"%s\"\n" , dev_name); out: -path_release (&nd); +path_put (&nd.path);return ret; }
fs/afs/mntpt.c +1 -1
@@ -227,7 +227,7 @@ static void *afs_mntpt_follow_link(struc newmnt =afs_mntpt_do_automount (nd->path.dentry);if (IS_ERR (newmnt)) { -path_release (nd); +path_put (&nd->path);return (void *)newmnt; }
fs/autofs4/root.c +1 -1
@@ -541,7 +541,7 @@ done:return NULL ; out_error: -path_release (nd); +path_put (&nd->path);return ERR_PTR (status); }
fs/block_dev.c +1 -1
@@ -1415,7 +1415,7 @@ struct block_device *lookup_bdev(const cif (!bdev) goto fail; out: -path_release (&nd); +path_put (&nd.path);return bdev; fail: bdev =ERR_PTR (error);
fs/coda/pioctl.c +2 -2
@@ -80,7 +80,7 @@ static int coda_pioctl(struct inode * in/* return if it is not a Coda inode */ if ( target_inode->i_sb != inode->i_sb ) { -path_release (&nd); +path_put (&nd.path);return -EINVAL ; }
@@ -89,7 +89,7 @@ static int coda_pioctl(struct inode * in error =venus_pioctl (inode->i_sb, &(cnp->c_fid), cmd, &data); -path_release (&nd); +path_put (&nd.path);return error; }
fs/compat.c +2 -2
@@ -244,7 +244,7 @@ asmlinkage long compat_sys_statfs(const error =vfs_statfs (nd.path.dentry, &tmp);if (!error) error =put_compat_statfs (buf, &tmp); -path_release (&nd); +path_put (&nd.path); }return error; }
@@ -312,7 +312,7 @@ asmlinkage long compat_sys_statfs64(cons error =vfs_statfs (nd.path.dentry, &tmp);if (!error) error =put_compat_statfs64 (buf, &tmp); -path_release (&nd); +path_put (&nd.path); }return error; }
fs/configfs/symlink.c +2 -2
@@ -103,7 +103,7 @@ static int get_target(const char *symnam *target =configfs_get_config_item (nd->path.dentry);if (!*target) { ret = -ENOENT ; -path_release (nd); +path_put (&nd->path); } }else ret = -EPERM ;
@@ -141,7 +141,7 @@ int configfs_symlink(struct inode *dir, ret =create_link (parent_item, target_item, dentry);config_item_put (target_item); -path_release (&nd); +path_put (&nd.path); out_put:config_item_put (parent_item);
fs/dquot.c +1 -1
@@ -1630,7 +1630,7 @@ int vfs_quota_on(struct super_block *sb, error =vfs_quota_on_inode (nd.path.dentry->d_inode, type, format_id); out_path: -path_release (&nd); +path_put (&nd.path);return error; }
fs/ecryptfs/main.c +1 -1
@@ -531,7 +531,7 @@ static int ecryptfs_read_super(struct su rc =0 ; goto out; out_free: -path_release (&nd); +path_put (&nd.path); out:return rc; }
fs/exec.c +2 -2
@@ -148,7 +148,7 @@ out:return error; exit:release_open_intent (&nd); -path_release (&nd); +path_put (&nd.path); goto out; }
@@ -672,7 +672,7 @@ out: } }release_open_intent (&nd); -path_release (&nd); +path_put (&nd.path); } goto out; }
fs/ext3/super.c +2 -2
@@ -2736,7 +2736,7 @@ static int ext3_quota_on(struct super_blreturn err;/* Quotafile not on the same filesystem? */ if (nd.path.mnt->mnt_sb != sb) { -path_release (&nd); +path_put (&nd.path);return -EXDEV ; }/* Quotafile not of fs root? */
@@ -2744,7 +2744,7 @@ static int ext3_quota_on(struct super_blprintk (KERN_WARNING "EXT3-fs: Quota file not on filesystem root. " "Journalled quota will not work.\n" ); -path_release (&nd); +path_put (&nd.path);return vfs_quota_on (sb, type, format_id, path); }
fs/ext4/super.c +2 -2
@@ -2939,7 +2939,7 @@ static int ext4_quota_on(struct super_blreturn err;/* Quotafile not on the same filesystem? */ if (nd.path.mnt->mnt_sb != sb) { -path_release (&nd); +path_put (&nd.path);return -EXDEV ; }/* Quotafile not of fs root? */
@@ -2947,7 +2947,7 @@ static int ext4_quota_on(struct super_blprintk (KERN_WARNING "EXT4-fs: Quota file not on filesystem root. " "Journalled quota will not work.\n" ); -path_release (&nd); +path_put (&nd.path);return vfs_quota_on (sb, type, format_id, path); }
fs/gfs2/ops_fstype.c +1 -1
@@ -837,7 +837,7 @@ static struct super_block* get_gfs2_sb(c "mount point %s\n", dev_name); free_nd: -path_release (&nd); +path_put (&nd.path); out:return sb; }
fs/inotify_user.c +2 -2
@@ -352,7 +352,7 @@ static int find_inode(const char __user/* you can only watch an inode if you have read permissions on it */ error =vfs_permission (nd,MAY_READ );if (error) -path_release (nd); +path_put (&nd->path);return error; }
@@ -649,7 +649,7 @@ asmlinkage long sys_inotify_add_watch(in ret =create_watch (dev, inode, mask);mutex_unlock (&dev->up_mutex); -path_release (&nd); +path_put (&nd.path); fput_and_out:fput_light (filp, fput_needed);return ret;
fs/namei.c +31 -25
170 lines not on this page · raw message
fs/namespace.c +10 -10
@@ -1323,7 +1323,7 @@ static int do_loopback(struct nameidata out:up_write (&namespace_sem); -path_release (&old_nd); +path_put (&old_nd.path);return err; }
@@ -1462,8 +1462,8 @@ out1: out:up_write (&namespace_sem);if (!err) -path_release (&parent_nd); -path_release (&old_nd); +path_put (&parent_nd.path); +path_put (&old_nd.path);return err; }
@@ -1902,7 +1902,7 @@ long do_mount(char *dev_name, char *dir_ retval =do_new_mount (&nd, type_page, flags, mnt_flags, dev_name, data_page); dput_out: -path_release (&nd); +path_put (&nd.path);return retval; }
@@ -2158,7 +2158,7 @@ asmlinkage long sys_pivot_root(const cha error =security_sb_pivotroot (&old_nd, &new_nd);if (error) { -path_release (&old_nd); +path_put (&old_nd.path); goto out1; }
@@ -2221,15 +2221,15 @@ asmlinkage long sys_pivot_root(const chachroot_fs_refs (&user_nd, &new_nd);security_sb_post_pivotroot (&user_nd, &new_nd); error =0 ; -path_release (&root_parent); -path_release (&parent_nd); +path_put (&root_parent.path); +path_put (&parent_nd.path); out2:mutex_unlock (&old_nd.path.dentry->d_inode->i_mutex);up_write (&namespace_sem); -path_release (&user_nd); -path_release (&old_nd); +path_put (&user_nd.path); +path_put (&old_nd.path); out1: -path_release (&new_nd); +path_put (&new_nd.path); out0:unlock_kernel ();return error;
fs/nfs/namespace.c +1 -1
@@ -148,7 +148,7 @@ out:dprintk ("<-- nfs_follow_mountpoint() = %d\n" , err);return ERR_PTR (err); out_err: -path_release (nd); +path_put (&nd->path); goto out; out_follow: while (d_mountpoint(nd->path.dentry) &&
fs/nfsctl.c +1 -1
@@ -43,7 +43,7 @@ static struct file *do_open(char *name,if (!error)return dentry_open (nd.path.dentry, nd.path.mnt, flags); -path_release (&nd); +path_put (&nd.path);return ERR_PTR (error); }
fs/nfsd/export.c +5 -5
@@ -177,7 +177,7 @@ static int expkey_parse(struct cache_detcache_put (&ek->h, &svc_expkey_cache); else err = -ENOMEM ; -path_release (&nd); +path_put (&nd.path); }cache_flush (); out:
@@ -630,7 +630,7 @@ static int svc_export_parse(struct cachekfree (exp.ex_uuid);kfree (exp.ex_path);if (nd.path.dentry) -path_release (&nd); +path_put (&nd.path); out_no_path:if (dom)auth_domain_put (dom);
@@ -1098,7 +1098,7 @@ finish:cache_put (&fsid_key->h, &svc_expkey_cache);if (clp)auth_domain_put (clp); -path_release (&nd); +path_put (&nd.path); out_unlock:exp_writeunlock (); out:
@@ -1150,7 +1150,7 @@ exp_unexport(struct nfsctl_export *nxp) err = -EINVAL ; exp =exp_get_by_name (dom, nd.path.mnt, nd.path.dentry,NULL ); -path_release (&nd); +path_put (&nd.path);if (IS_ERR (exp)) goto out_domain;
@@ -1209,7 +1209,7 @@ exp_rootfh(svc_client *clp, char *path,fh_put (&fh);exp_put (exp); out: -path_release (&nd); +path_put (&nd.path);return err; }
fs/nfsd/nfs4recover.c +1 -1
@@ -421,5 +421,5 @@ nfsd4_shutdown_recdir(void)if (!rec_dir_init)return ; rec_dir_init =0 ; -path_release (&rec_dir); +path_put (&rec_dir.path); }
fs/nfsd/nfs4state.c +1 -1
@@ -3330,7 +3330,7 @@ nfs4_reset_recoverydir(char *recdir)nfs4_set_recdir (recdir); status =0 ; } -path_release (&nd); +path_put (&nd.path);return status; }
fs/open.c +11 -11
@@ -130,7 +130,7 @@ asmlinkage long sys_statfs(const char __ error =vfs_statfs_native (nd.path.dentry, &tmp);if (!error &©_to_user (buf, &tmp,sizeof (tmp))) error = -EFAULT ; -path_release (&nd); +path_put (&nd.path); }return error; }
@@ -149,7 +149,7 @@ asmlinkage long sys_statfs64(const char error =vfs_statfs64 (nd.path.dentry, &tmp);if (!error &©_to_user (buf, &tmp,sizeof (tmp))) error = -EFAULT ; -path_release (&nd); +path_put (&nd.path); }return error; }
@@ -279,7 +279,7 @@ put_write_and_out: mnt_drop_write_and_out:mnt_drop_write (nd.path.mnt); dput_and_out: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -473,7 +473,7 @@ asmlinkage long sys_faccessat(int dfd, c res = -EROFS ; out_path_release: -path_release (&nd); +path_put (&nd.path); out: current->fsuid = old_fsuid; current->fsgid = old_fsgid;
@@ -504,7 +504,7 @@ asmlinkage long sys_chdir(const char __uset_fs_pwd (current->fs, nd.path.mnt, nd.path.dentry); dput_and_out: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -560,7 +560,7 @@ asmlinkage long sys_chroot(const char __set_fs_altroot (); error =0 ; dput_and_out: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -636,7 +636,7 @@ asmlinkage long sys_fchmodat(int dfd, co out_drop_write:mnt_drop_write (nd.path.mnt); dput_and_out: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -693,7 +693,7 @@ asmlinkage long sys_chown(const char __u error =chown_common (nd.path.dentry, user, group);mnt_drop_write (nd.path.mnt); out_release: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -718,7 +718,7 @@ asmlinkage long sys_fchownat(int dfd, co error =chown_common (nd.path.dentry, user, group);mnt_drop_write (nd.path.mnt); out_release: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -737,7 +737,7 @@ asmlinkage long sys_lchown(const char __ error =chown_common (nd.path.dentry, user, group);mnt_drop_write (nd.path.mnt); out_release: -path_release (&nd); +path_put (&nd.path); out:return error; }
@@ -926,7 +926,7 @@ struct file *nameidata_to_filp(struct na filp =__dentry_open (nd->path.dentry, nd->path.mnt, flags, filp,NULL ); else -path_release (nd ); + path_put(&nd->path);return filp; }
fs/proc/base.c +1 -1
@@ -1033,7 +1033,7 @@ static void *proc_pid_follow_link(structint error = -EACCES ;/* We don't need a base pointer in the /proc filesystem */ -path_release (nd); +path_put (&nd->path);/* Are we allowed to snoop on the tasks file descriptors? */ if (!proc_fd_access_allowed (inode))
fs/reiserfs/super.c +4 -4
@@ -1998,20 +1998,20 @@ static int reiserfs_quota_on(struct supereturn err;/* Quotafile not on the same filesystem? */ if (nd.path.mnt->mnt_sb != sb) { -path_release (&nd); +path_put (&nd.path);return -EXDEV ; }/* We must not pack tails for quota files on reiserfs for quota IO to work */ if (!REISERFS_I (nd.path.dentry->d_inode)->i_flags & i_nopack_mask) {reiserfs_warning (sb,"reiserfs: Quota file must have tail packing disabled." ); -path_release (&nd); +path_put (&nd.path);return -EINVAL ; }/* Not journalling quota? No more tests needed... */ if (!REISERFS_SB (sb)->s_qf_names[USRQUOTA ] && !REISERFS_SB (sb)->s_qf_names[GRPQUOTA ]) { -path_release (&nd); +path_put (&nd.path);return vfs_quota_on (sb, type, format_id, path); }/* Quotafile not of fs root? */
@@ -2019,7 +2019,7 @@ static int reiserfs_quota_on(struct supereiserfs_warning (sb,"reiserfs: Quota file not on filesystem root. " "Journalled quota will not work." ); -path_release (&nd); +path_put (&nd.path);return vfs_quota_on (sb, type, format_id, path); }
fs/revoke.c +1 -1
@@ -650,7 +650,7 @@ asmlinkage long sys_revokeat(int dfd, co err =__user_walk_fd (dfd, filename,0 , &nd);if (!err) { err =do_revoke (nd.path.dentry->d_inode,NULL ); -path_release (&nd); +path_put (&nd.path); }return err; }
fs/stat.c +3 -3
@@ -63,7 +63,7 @@ int vfs_stat_fd(int dfd, char __user *na error =__user_walk_fd (dfd, name,LOOKUP_FOLLOW , &nd);if (!error) { error =vfs_getattr (nd.path.mnt, nd.path.dentry, stat); -path_release (&nd); +path_put (&nd.path); }return error; }
@@ -83,7 +83,7 @@ int vfs_lstat_fd(int dfd, char __user *n error =__user_walk_fd (dfd, name,0 , &nd);if (!error) { error =vfs_getattr (nd.path.mnt, nd.path.dentry, stat); -path_release (&nd); +path_put (&nd.path); }return error; }
@@ -313,7 +313,7 @@ asmlinkage long sys_readlinkat(int dfd, buf, bufsiz); } } -path_release (&nd); +path_put (&nd.path); }return error; }
fs/unionfs/main.c +1 -1
@@ -368,7 +368,7 @@ static int parse_dirs_option(struct supeif (err) {printk (KERN_ERR "unionfs: lower directory " "'%s' is not a valid branch\n" , name); -path_release (&nd); +path_put (&nd.path); goto out; }
fs/unionfs/super.c +6 -6
@@ -205,7 +205,7 @@ static noinline int do_remount_mode_optiif (nd.path.mnt == new_lower_paths[idx].mnt && nd.path.dentry == new_lower_paths[idx].dentry)break ; -path_release (&nd);/* no longer needed */ +path_put (&nd.path);/* no longer needed */ if (idx == cur_branches) { err = -ENOENT ;/* err may have been reset above */ printk(KERN_ERR "unionfs: branch \"%s\" "
@@ -248,7 +248,7 @@ static noinline int do_remount_del_optioif (nd.path.mnt == new_lower_paths[idx].mnt && nd.path.dentry == new_lower_paths[idx].dentry)break ; -path_release (&nd);/* no longer needed */ +path_put (&nd.path);/* no longer needed */ if (idx == cur_branches) {printk (KERN_ERR "unionfs: branch \"%s\" " "not found\n" , optarg);
@@ -267,7 +267,7 @@ static noinline int do_remount_del_optio* new_data and new_lower_paths one to the left. Finally, adjust * cur_branches. */ -pathput (&new_lower_paths[idx]); +path_put (&new_lower_paths[idx]);if (idx < cur_branches -1 ) {/* if idx==cur_branches-1, we delete last branch: easy */
@@ -332,7 +332,7 @@ static noinline int do_remount_add_optioif (nd.path.mnt == new_lower_paths[idx].mnt && nd.path.dentry == new_lower_paths[idx].dentry)break ; -path_release (&nd);/* no longer needed */ +path_put (&nd.path);/* no longer needed */ if (idx == cur_branches) {printk (KERN_ERR "unionfs: branch \"%s\" " "not found\n" , optarg);
@@ -375,7 +375,7 @@ found_insertion_point:if (err) {printk (KERN_ERR "unionfs: lower directory " "\"%s\" is not a valid branch\n" , optarg); -path_release (&nd); +path_put (&nd.path); goto out; }
@@ -789,7 +789,7 @@ out_release:/* no need to cleanup/release anything in tmp_data */ if (tmp_lower_paths)for (i =0 ; i < new_branches; i++) -pathput (&tmp_lower_paths[i]); +path_put (&tmp_lower_paths[i]); out_free:kfree (tmp_lower_paths);kfree (tmp_data);
fs/utimes.c +1 -1
@@ -143,7 +143,7 @@ dput_and_out:if (f)fput (f);else -path_release (&nd); +path_put (&nd.path); out:return error; }
fs/xattr.c +8 -8
@@ -239,7 +239,7 @@ sys_setxattr(char __user *path, char __ureturn error; error =setxattr (nd.path.dentry, name, value, size, flags);mnt_drop_write (nd.path.mnt); -path_release (&nd); +path_put (&nd.path);return error; }
@@ -258,7 +258,7 @@ sys_lsetxattr(char __user *path, char __return error; error =setxattr (nd.path.dentry, name, value, size, flags);mnt_drop_write (nd.path.mnt); -path_release (&nd); +path_put (&nd.path);return error; }
@@ -333,7 +333,7 @@ sys_getxattr(char __user *path, char __uif (error)return error; error =getxattr (nd.path.dentry, name, value, size); -path_release (&nd); +path_put (&nd.path);return error; }
@@ -348,7 +348,7 @@ sys_lgetxattr(char __user *path, char __if (error)return error; error =getxattr (nd.path.dentry, name, value, size); -path_release (&nd); +path_put (&nd.path);return error; }
@@ -407,7 +407,7 @@ sys_listxattr(char __user *path, char __if (error)return error; error =listxattr (nd.path.dentry, list, size); -path_release (&nd); +path_put (&nd.path);return error; }
@@ -421,7 +421,7 @@ sys_llistxattr(char __user *path, char _if (error)return error; error =listxattr (nd.path.dentry, list, size); -path_release (&nd); +path_put (&nd.path);return error; }
@@ -468,7 +468,7 @@ sys_removexattr(char __user *path, charif (error)return error; error =removexattr (nd.path.dentry, name); -path_release (&nd); +path_put (&nd.path);return error; }
@@ -482,7 +482,7 @@ sys_lremovexattr(char __user *path, charif (error)return error; error =removexattr (nd.path.dentry, name); -path_release (&nd); +path_put (&nd.path);return error; }
fs/xfs/linux-2.6/xfs_ioctl.c +1 -1
@@ -95,7 +95,7 @@ xfs_find_handle(ASSERT (nd.path.dentry);ASSERT (nd.path.dentry->d_inode); inode =igrab (nd.path.dentry->d_inode); -path_release (&nd); +path_put (&nd.path);break ; }
include/linux/namei.h +0 -7
@@ -67,7 +67,6 @@ extern int FASTCALL(__user_walk_fd(int dextern int FASTCALL (path_lookup (const char *,unsigned ,struct nameidata *));extern int vfs_path_lookup (struct dentry *,struct vfsmount *,const char *,unsigned int ,struct nameidata *); -extern void path_release (struct nameidata *);extern int __user_path_lookup_open (const char __user *,unsigned lookup_flags,struct nameidata *nd,int open_flags);extern int path_lookup_open (int dfd,const char *name,unsigned lookup_flags,struct nameidata *,int open_flags);
@@ -101,10 +100,4 @@ static inline void pathget(struct path * dget(path->dentry); } -static inline void pathput (struct path *path) -{ -dput (path->dentry); -mntput (path->mnt); -} -#endif /* _LINUX_NAMEI_H */
include/linux/path.h +2 -0
@@ -9,4 +9,6 @@ struct path { struct dentry *dentry; }; +extern void path_put (struct path *); +#endif /* _LINUX_PATH_H */
kernel/audit_tree.c +8 -8
@@ -550,7 +550,7 @@ void audit_trim_trees(void) goto skip_it; root_mnt =collect_mounts (nd.path.mnt, nd.path.dentry); -path_release (&nd); +path_put (&nd.path);if (!root_mnt) goto skip_it;
@@ -642,7 +642,7 @@ int audit_add_tree_rule(struct audit_kruif (err) goto Err; mnt =collect_mounts (nd.path.mnt, nd.path.dentry); -path_release (&nd); +path_put (&nd.path);if (!mnt) { err = -ENOMEM ; goto Err;
@@ -702,7 +702,7 @@ int audit_tag_tree(char *old, char *new)if (err)return err; tagged =collect_mounts (nd.path.mnt, nd.path.dentry); -path_release (&nd); +path_put (&nd.path);if (!tagged)return -ENOMEM ;
@@ -711,9 +711,9 @@ int audit_tag_tree(char *old, char *new)drop_collected_mounts (tagged);return err; } - mnt =mntget (nd.mnt); - dentry =dget (nd.dentry); -path_release (&nd); + mnt =mntget (nd.path.mnt); + dentry =dget (nd.path.dentry); +path_put (&nd.path);if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)follow_up (&mnt, &dentry);
@@ -744,13 +744,13 @@ int audit_tag_tree(char *old, char *new)spin_lock (&vfsmount_lock);if (!is_under (mnt, dentry, &nd)) {spin_unlock (&vfsmount_lock); -path_release (&nd); +path_put (&nd.path);put_tree (tree);mutex_lock (&audit_filter_mutex);continue ; }spin_unlock (&vfsmount_lock); -path_release (&nd); +path_put (&nd.path);list_for_each_entry (p, &list, mnt_list) { failed =tag_chunk (p->mnt_root->d_inode, tree);
kernel/auditfilter.c +2 -2
@@ -1152,11 +1152,11 @@ static int audit_get_nd(char *path, strustatic void audit_put_nd (struct nameidata *ndp,struct nameidata *ndw) {if (ndp) { -path_release (ndp); +path_put (&ndp->path);kfree (ndp); }if (ndw) { -path_release (ndw); +path_put (&ndw->path);kfree (ndw); } }
net/sunrpc/rpc_pipe.c +1 -1
@@ -484,7 +484,7 @@ rpc_lookup_parent(char *path, struct namstatic void rpc_release_path (struct nameidata *nd) { -path_release (nd); +path_put (&nd->path);rpc_put_mount (); }
net/unix/af_unix.c +3 -3
@@ -752,7 +752,7 @@ static struct sock *unix_find_other(struif (u->sk_type == type)touch_atime (nd.path.mnt, nd.path.dentry); -path_release (&nd); +path_put (&nd.path);mnt_drop_write (nd.path.mnt); err=-EPROTOTYPE ;
@@ -776,7 +776,7 @@ static struct sock *unix_find_other(stru mnt_drop_write_fail:mnt_drop_write (nd.path.mnt); put_path_fail: -path_release (&nd); +path_put (&nd.path); fail: *error=err;return NULL ;
@@ -893,7 +893,7 @@ out_mknod_dput:dput (dentry); out_mknod_unlock:mutex_unlock (&nd.path.dentry->d_inode->i_mutex); -path_release (&nd); +path_put (&nd.path); out_mknod_parent:if (err==-EEXIST ) err=-EADDRINUSE ;
PATCH 7/13 Use path_put() in a few places instead of {mnt,d}put()
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
Use path_put() in a few places instead of {mnt,d}put()
--- fs/afs/mntpt.c | 3 +-- fs/namei.c | 15 +++++---------- 2 files changed, 6 insertions(+), 12 deletions(-)
fs/afs/mntpt.c +1 -2
@@ -235,8 +235,7 @@ static void *afs_mntpt_follow_link(struc err =do_add_mount (newmnt, nd,MNT_SHRINKABLE , &afs_vfsmounts);switch (err) {case 0 : -dput (nd->path.dentry); -mntput (nd->path.mnt); +path_put (&nd->path); nd->path.mnt = newmnt; nd->path.dentry =dget (newmnt->mnt_root); schedule_delayed_work(&afs_mntpt_expiry_timer,
fs/namei.c +5 -10
@@ -626,8 +626,7 @@ static __always_inline int __do_follow_lif (dentry->d_inode->i_op->put_link) dentry->d_inode->i_op->put_link (dentry, nd, cookie); } -dput (dentry); -mntput (path->mnt); +path_put (path);return error; }
@@ -1034,8 +1033,7 @@ static int fastcall link_path_walk(const result =__link_path_walk (name, nd); } -dput (save.path.dentry); -mntput (save.path.mnt); +path_put (&save.path);return result; }
@@ -1057,8 +1055,7 @@ static int __emul_lookup_dentry(const chif (!nd->path.dentry->d_inode ||S_ISDIR (nd->path.dentry->d_inode->i_mode)) { -struct dentry *old_dentry = nd->path.dentry; -struct vfsmount *old_mnt = nd->path.mnt; +struct path old_path = nd->path;struct qstr last = nd->last;int last_type = nd->last_type;struct fs_struct *fs = current->fs;
@@ -1074,14 +1071,12 @@ static int __emul_lookup_dentry(const chread_unlock (&fs->lock);if (path_walk (name, nd) ==0 ) {if (nd->path.dentry->d_inode) { -dput (old_dentry); -mntput (old_mnt); +path_put (&old_path);return 1 ; }path_put (&nd->path); } - nd->path.dentry = old_dentry; - nd->path.mnt = old_mnt; + nd->path = old_path; nd->last = last; nd->last_type = last_type; }
PATCH 8/13 Introduce path_get()
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
This introduces the symmetric function to path_put() for getting a reference to the dentry and vfsmount of a struct path in the right order.
--- fs/namei.c | 17 +++++++++++++++-- fs/unionfs/super.c | 2 +- include/linux/namei.h | 6 ------ include/linux/path.h | 1 + 4 files changed, 17 insertions(+), 9 deletions(-)
fs/namei.c +15 -2
@@ -363,6 +363,19 @@ int deny_write_access(struct file * file }/** +* path_get - get a reference to a path +* @path: path to get the reference to +* +* Given a path increment the reference count to the dentry and the vfsmount. +*/ +void path_get (struct path *path) +{ +mntget (path->mnt); +dget (path->dentry); +} +EXPORT_SYMBOL (path_get); + +/** * path_put - put a reference to a path * @path: path to put the reference to *
@@ -1161,8 +1174,8 @@ static int fastcall do_path_lookup(int dif (retval) goto fput_fail; - nd->path.mnt =mntget (file->f_path.mnt); - nd->path.dentry =dget (dentry); + nd->path = file->f_path; +path_get (&file->f_path);fput_light (file, fput_needed); }
fs/unionfs/super.c +1 -1
@@ -544,7 +544,7 @@ static int unionfs_remount_fs(struct supmemcpy (tmp_lower_paths,UNIONFS_D (sb->s_root)->lower_paths, cur_branches *sizeof (struct path ));for (i =0 ; i < cur_branches; i++) -pathget (&tmp_lower_paths[i]);/* drop refs at end of fxn */ +path_get (&tmp_lower_paths[i]);/* drop refs at end of fxn */ /******************************************************************* * For each branch command, do path_lookup on the requested branch,
include/linux/namei.h +0 -6
@@ -94,10 +94,4 @@ static inline char *nd_get_link(struct n return nd->saved_names[nd->depth]; } -static inline void pathget (struct path *path) -{ -mntget (path->mnt); -dget (path->dentry); -} -#endif /* _LINUX_NAMEI_H */
include/linux/path.h +1 -0
@@ -9,6 +9,7 @@ struct path { struct dentry *dentry; }; +extern void path_get (struct path *);extern void path_put (struct path *);#endif /* _LINUX_PATH_H */
PATCH 9/13 Use struct path in fs_struct
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
* Use struct path in fs_struct.
--- fs/dcache.c | 34 ++++++++++++--------------- fs/namei.c | 53 ++++++++++++++++++------------------------ fs/namespace.c | 57 ++++++++++++++++++++-------------------------- fs/proc/base.c | 8 +++--- include/linux/fs_struct.h | 6 +--- init/do_mounts.c | 6 ++-- kernel/auditsc.c | 4 +-- kernel/exit.c | 12 +++------ kernel/fork.c | 18 +++++++------- 9 files changed, 87 insertions(+), 111 deletions(-)
fs/dcache.c +15 -19
@@ -1851,8 +1851,7 @@ char * d_path(struct dentry *dentry, str char *buf, int buflen) {char *res; -struct vfsmount *rootmnt; -struct dentry *root; +struct path root;/* * We have various synthetic filesystems that never get mounted. On
@@ -1865,14 +1864,13 @@ char * d_path(struct dentry *dentry, strreturn dentry->d_op->d_dname (dentry, buf, buflen);read_lock (¤t->fs->lock); - rootmnt =mntget (current->fs->rootmnt); - root =dget (current->fs->root); + root = current->fs->root; +path_get (¤t->fs->root);read_unlock (¤t->fs->lock);spin_lock (&dcache_lock); - res =__d_path (dentry, vfsmnt, root, rootmnt, buf, buflen); + res =__d_path (dentry, vfsmnt, root.dentry, root.mnt, buf, buflen);spin_unlock (&dcache_lock); -dput (root); -mntput (rootmnt); +path_put (&root);return res; }
@@ -1918,28 +1916,28 @@ char *dynamic_dname(struct dentry *dentrasmlinkage long sys_getcwd (char __user *buf,unsigned long size) {int error; -struct vfsmount *pwdmnt, *rootmnt; -struct dentry *pwd, *root; +struct path pwd, root;char *page = (char *)__get_free_page (GFP_USER );if (!page)return -ENOMEM ;read_lock (¤t->fs->lock); - pwdmnt =mntget (current->fs->pwdmnt); - pwd =dget (current->fs->pwd); - rootmnt =mntget (current->fs->rootmnt); - root =dget (current->fs->root); + pwd = current->fs->pwd; +path_get (¤t->fs->pwd); + root = current->fs->root; +path_get (¤t->fs->root);read_unlock (¤t->fs->lock); error = -ENOENT ;/* Has the current directory has been unlinked? */ spin_lock (&dcache_lock); -if (pwd->d_parent == pwd || !d_unhashed (pwd)) { +if (pwd.dentry->d_parent == pwd.dentry || !d_unhashed (pwd.dentry)) {unsigned long len;char * cwd; - cwd =__d_path (pwd, pwdmnt, root, rootmnt, page,PAGE_SIZE ); + cwd =__d_path (pwd.dentry, pwd.mnt, root.dentry, root.mnt, + page,PAGE_SIZE );spin_unlock (&dcache_lock); error =PTR_ERR (cwd);
@@ -1957,10 +1955,8 @@ asmlinkage long sys_getcwd(char __user *spin_unlock (&dcache_lock); out: -dput (pwd); -mntput (pwdmnt); -dput (root); -mntput (rootmnt); +path_put (&pwd); +path_put (&root);free_page ((unsigned long ) page);return error; }
fs/namei.c +23 -30
105 lines not on this page · raw message
fs/namespace.c +25 -32
114 lines not on this page · raw message
fs/proc/base.c +4 -4
@@ -165,8 +165,8 @@ static int proc_cwd_link(struct inode *i }if (fs) {read_lock (&fs->lock); - *mnt =mntget (fs->pwdmnt); - *dentry =dget (fs->pwd); + *mnt =mntget (fs->pwd.mnt); + *dentry =dget (fs->pwd.dentry);read_unlock (&fs->lock); result =0 ;put_fs_struct (fs);
@@ -186,8 +186,8 @@ static int proc_root_link(struct inode * }if (fs) {read_lock (&fs->lock); - *mnt =mntget (fs->rootmnt); - *dentry =dget (fs->root); + *mnt =mntget (fs->root.mnt); + *dentry =dget (fs->root.dentry);read_unlock (&fs->lock); result =0 ;put_fs_struct (fs);
include/linux/fs_struct.h +2 -4
@@ -1,15 +1,13 @@#ifndef _LINUX_FS_STRUCT_H#define _LINUX_FS_STRUCT_H -struct dentry ; -struct vfsmount ; +#include <linux/path.h> struct fs_struct {atomic_t count;rwlock_t lock;int umask; -struct dentry * root, * pwd, * altroot; -struct vfsmount * rootmnt, * pwdmnt, * altrootmnt; +struct path root, pwd, altroot; };#define INIT_FS { \
init/do_mounts.c +3 -3
@@ -286,10 +286,10 @@ static int __init do_mount_root(char *nareturn err;sys_chdir ("/root" ); -ROOT_DEV = current->fs->pwdmnt->mnt_sb->s_dev; +ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev;printk ("VFS: Mounted root (%s filesystem)%s.\n" , - current->fs->pwdmnt->mnt_sb->s_type->name, - current->fs->pwdmnt->mnt_sb->s_flags &MS_RDONLY ? + current->fs->pwd.mnt->mnt_sb->s_type->name, + current->fs->pwd.mnt->mnt_sb->s_flags &MS_RDONLY ?" readonly" :"" );return 0 ; }
kernel/auditsc.c +2 -2
@@ -1528,8 +1528,8 @@ void __audit_getname(const char *name) ++context->name_count;if (!context->pwd) {read_lock (¤t->fs->lock); - context->pwd =dget (current->fs->pwd); - context->pwdmnt =mntget (current->fs->pwdmnt); + context->pwd =dget (current->fs->pwd.dentry); + context->pwdmnt =mntget (current->fs->pwd.mnt);read_unlock (¤t->fs->lock); }
kernel/exit.c +4 -8
@@ -513,14 +513,10 @@ static void __put_fs_struct(struct fs_st {/* No need to hold fs->lock if we are killing it */ if (atomic_dec_and_test (&fs->count)) { -dput (fs->root); -mntput (fs->rootmnt); -dput (fs->pwd); -mntput (fs->pwdmnt); -if (fs->altroot) { -dput (fs->altroot); -mntput (fs->altrootmnt); - } +path_put (&fs->root); +path_put (&fs->pwd); +if (fs->altroot.dentry) +path_put (&fs->altroot);kmem_cache_free (fs_cachep, fs); } }
kernel/fork.c +9 -9
@@ -598,16 +598,16 @@ static struct fs_struct *__copy_fs_strucrwlock_init (&fs->lock); fs->umask = old->umask;read_lock (&old->lock); - fs->rootmnt =mntget (old->rootmnt); - fs->root =dget (old->root); - fs->pwdmnt =mntget (old->pwdmnt); - fs->pwd =dget (old->pwd); -if (old->altroot) { - fs->altrootmnt =mntget (old->altrootmnt); - fs->altroot =dget (old->altroot); + fs->root = old->root; +path_get (&old->root); + fs->pwd = old->pwd; +path_get (&old->pwd); +if (old->altroot.dentry) { + fs->altroot = old->altroot; +path_get (&old->altroot); }else { - fs->altrootmnt =NULL ; - fs->altroot =NULL ; + fs->altroot.mnt =NULL ; + fs->altroot.dentry =NULL ; }read_unlock (&old->lock); }
PATCH 10/13 Make set_fs_{root,pwd} take a struct path
In reply to Bharata B RaoFrom: Jan Blunck <[email protected]>
In nearly all cases the set_fs_{root,pwd}() calls work on a struct path. Change the function to reflect this and use path_get() here.
--- fs/namespace.c | 28 ++++++++++++++-------------- fs/open.c | 12 ++++-------- include/linux/fs_struct.h | 4 ++-- 3 files changed, 20 insertions(+), 24 deletions(-)
fs/namespace.c +14 -14
@@ -2040,15 +2040,14 @@ out1:* Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. * It can block. Requires the big lock held. */ -void set_fs_root (struct fs_struct *fs,struct vfsmount *mnt, -struct dentry *dentry) +void set_fs_root (struct fs_struct *fs,struct path *path) {struct path old_root;write_lock (&fs->lock); old_root = fs->root; - fs->root.mnt =mntget (mnt); - fs->root.dentry =dget (dentry); + fs->root = *path; +path_get (path);write_unlock (&fs->lock);if (old_root.dentry)path_put (&old_root);
@@ -2058,15 +2057,14 @@ void set_fs_root(struct fs_struct *fs, s* Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. * It can block. Requires the big lock held. */ -void set_fs_pwd (struct fs_struct *fs,struct vfsmount *mnt, -struct dentry *dentry) +void set_fs_pwd (struct fs_struct *fs,struct path *path) {struct path old_pwd;write_lock (&fs->lock); old_pwd = fs->pwd; - fs->pwd.mnt =mntget (mnt); - fs->pwd.dentry =dget (dentry); + fs->pwd = *path; +path_get (path);write_unlock (&fs->lock);if (old_pwd.dentry)
@@ -2087,12 +2085,10 @@ static void chroot_fs_refs(struct nameidtask_unlock (p);if (fs->root.dentry == old_nd->path.dentry && fs->root.mnt == old_nd->path.mnt) -set_fs_root (fs, new_nd->path.mnt, - new_nd->path.dentry); +set_fs_root (fs, &new_nd->path);if (fs->pwd.dentry == old_nd->path.dentry && fs->pwd.mnt == old_nd->path.mnt) -set_fs_pwd (fs, new_nd->path.mnt, - new_nd->path.dentry); +set_fs_pwd (fs, &new_nd->path);put_fs_struct (fs); }else task_unlock (p);
@@ -2235,6 +2231,7 @@ static void __init init_mount_tree(void) {struct vfsmount *mnt;struct mnt_namespace *ns; +struct path root; mnt =do_kern_mount ("rootfs" ,0 ,"rootfs" ,NULL );if (IS_ERR (mnt))
@@ -2253,8 +2250,11 @@ static void __init init_mount_tree(void) init_task.nsproxy->mnt_ns = ns;get_mnt_ns (ns); -set_fs_pwd (current->fs, ns->root, ns->root->mnt_root); -set_fs_root (current->fs, ns->root, ns->root->mnt_root); + root.mnt = ns->root; + root.dentry = ns->root->mnt_root; + +set_fs_pwd (current->fs, &root); +set_fs_root (current->fs, &root); }void __init mnt_init (void )
fs/open.c +4 -8
@@ -501,7 +501,7 @@ asmlinkage long sys_chdir(const char __uif (error) goto dput_and_out; -set_fs_pwd (current->fs, nd.path.mnt, nd.path.dentry); +set_fs_pwd (current->fs, &nd.path); dput_and_out:path_put (&nd.path);
@@ -512,9 +512,7 @@ out:asmlinkage long sys_fchdir (unsigned int fd) {struct file *file; -struct dentry *dentry;struct inode *inode; -struct vfsmount *mnt;int error; error = -EBADF ;
@@ -522,9 +520,7 @@ asmlinkage long sys_fchdir(unsigned intif (!file) goto out; - dentry = file->f_path.dentry; - mnt = file->f_path.mnt; - inode = dentry->d_inode; + inode = file->f_path.dentry->d_inode; error = -ENOTDIR ;if (!S_ISDIR (inode->i_mode))
@@ -532,7 +528,7 @@ asmlinkage long sys_fchdir(unsigned int error =file_permission (file,MAY_EXEC );if (!error) -set_fs_pwd (current->fs, mnt, dentry); +set_fs_pwd (current->fs, &file->f_path); out_putf:fput (file); out:
@@ -556,7 +552,7 @@ asmlinkage long sys_chroot(const char __if (!capable (CAP_SYS_CHROOT )) goto dput_and_out; -set_fs_root (current->fs, nd.path.mnt, nd.path.dentry); +set_fs_root (current->fs, &nd.path);set_fs_altroot (); error =0 ; dput_and_out:
include/linux/fs_struct.h +2 -2
@@ -20,8 +20,8 @@ extern struct kmem_cache *fs_cachep;extern void exit_fs (struct task_struct *);extern void set_fs_altroot (void ); -extern void set_fs_root (struct fs_struct *,struct vfsmount *,struct dentry *); -extern void set_fs_pwd (struct fs_struct *,struct vfsmount *,struct dentry *); +extern void set_fs_root (struct fs_struct *,struct path *); +extern void set_fs_pwd (struct fs_struct *,struct path *);extern struct fs_struct *copy_fs_struct (struct fs_struct *);extern void put_fs_struct (struct fs_struct *);
PATCH 11/13 Make __d_path() to take a struct path argument
In reply to Bharata B RaoFrom: Andreas Gruenbacher <[email protected]>
One less argument to __d_path.
All callers to __d_path pass the dentry and vfsmount of a struct path to __d_path. Pass the struct path directly, instead.
--- fs/dcache.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/dcache.c +4 -6
@@ -1779,8 +1779,7 @@ shouldnt_be_hashed:* "buflen" should be positive. Caller holds the dcache_lock. */ static char *__d_path (struct dentry *dentry,struct vfsmount *vfsmnt, -struct dentry *root,struct vfsmount *rootmnt, -char *buffer,int buflen) +struct path *root,char *buffer,int buflen) {char * end = buffer+buflen;char * retval;
@@ -1805,7 +1804,7 @@ static char * __d_path( struct dentry *dfor (;;) {struct dentry * parent; -if (dentry == root && vfsmnt == rootmnt) +if (dentry == root->dentry && vfsmnt == root->mnt)break ;if (dentry == vfsmnt->mnt_root ||IS_ROOT (dentry)) {/* Global root? */
@@ -1868,7 +1867,7 @@ char * d_path(struct dentry *dentry, strpath_get (¤t->fs->root);read_unlock (¤t->fs->lock);spin_lock (&dcache_lock); - res =__d_path (dentry, vfsmnt, root.dentry, root.mnt, buf, buflen); + res =__d_path (dentry, vfsmnt, &root, buf, buflen);spin_unlock (&dcache_lock);path_put (&root);return res;
@@ -1936,8 +1935,7 @@ asmlinkage long sys_getcwd(char __user *unsigned long len;char * cwd; - cwd =__d_path (pwd.dentry, pwd.mnt, root.dentry, root.mnt, - page,PAGE_SIZE ); + cwd =__d_path (pwd.dentry, pwd.mnt, &root, page,PAGE_SIZE );spin_unlock (&dcache_lock); error =PTR_ERR (cwd);
PATCH 12/13 Use struct path argument in proc_get_link()
In reply to Bharata B RaoReplace the (vfsmnt, dentry) arguments in proc_inode operation proc_get_link() by struct path.
Also, this should eventually allow do_proc_readlink() to call d_path() with a struct path argument.
--- fs/proc/base.c | 60 +++++++++++++++++++++--------------------------- fs/proc/internal.h | 2 - fs/proc/task_mmu.c | 6 ++-- fs/proc/task_nommu.c | 6 ++-- include/linux/proc_fs.h | 2 - 5 files changed, 35 insertions(+), 41 deletions(-)
fs/proc/base.c +27 -33
@@ -153,7 +153,7 @@ static int get_nr_threads(struct task_streturn count; } -static int proc_cwd_link (struct inode *inode,struct dentry **dentry,struct vfsmount **mnt) +static int proc_cwd_link (struct inode *inode,struct path *path) {struct task_struct *task =get_proc_task (inode);struct fs_struct *fs =NULL ;
@@ -165,8 +165,8 @@ static int proc_cwd_link(struct inode *i }if (fs) {read_lock (&fs->lock); - *mnt =mntget (fs->pwd.mnt); - *dentry =dget (fs->pwd.dentry); + *path = fs->pwd; +path_get (path);read_unlock (&fs->lock); result =0 ;put_fs_struct (fs);
@@ -174,7 +174,7 @@ static int proc_cwd_link(struct inode *ireturn result; } -static int proc_root_link (struct inode *inode,struct dentry **dentry,struct vfsmount **mnt) +static int proc_root_link (struct inode *inode,struct path *path) {struct task_struct *task =get_proc_task (inode);struct fs_struct *fs =NULL ;
@@ -186,8 +186,8 @@ static int proc_root_link(struct inode * }if (fs) {read_lock (&fs->lock); - *mnt =mntget (fs->root.mnt); - *dentry =dget (fs->root.dentry); + *path = fs->root; +path_get (path);read_unlock (&fs->lock); result =0 ;put_fs_struct (fs);
@@ -1039,34 +1039,32 @@ static void *proc_pid_follow_link(structif (!proc_fd_access_allowed (inode)) goto out; - error =PROC_I (inode)->op.proc_get_link (inode, &nd->path.dentry, - &nd->path.mnt); + error =PROC_I (inode)->op.proc_get_link (inode, &nd->path); nd->last_type =LAST_BIND ; out:return ERR_PTR (error); } -static int do_proc_readlink (struct dentry *dentry,struct vfsmount *mnt, -char __user *buffer,int buflen) +static int do_proc_readlink (struct path *path,char __user *buffer,int buflen) {struct inode * inode;char *tmp = (char *)__get_free_page (GFP_TEMPORARY ); -char *path; +char *pathname;int len;if (!tmp)return -ENOMEM ; - inode = dentry->d_inode; - path =d_path (dentry, mnt, tmp,PAGE_SIZE ); - len =PTR_ERR (path); -if (IS_ERR (path)) + inode = path->dentry->d_inode; + pathname =d_path (path->dentry, path->mnt, tmp,PAGE_SIZE ); + len =PTR_ERR (pathname); +if (IS_ERR (pathname)) goto out; - len = tmp +PAGE_SIZE -1 - path; + len = tmp +PAGE_SIZE -1 - pathname;if (len > buflen) len = buflen; -if (copy_to_user (buffer, path, len)) +if (copy_to_user (buffer, pathname, len)) len = -EFAULT ; out:free_page ((unsigned long )tmp);
@@ -1077,20 +1075,18 @@ static int proc_pid_readlink(struct dent {int error = -EACCES ;struct inode *inode = dentry->d_inode; -struct dentry *de; -struct vfsmount *mnt =NULL ; +struct path path;/* Are we allowed to snoop on the tasks file descriptors? */ if (!proc_fd_access_allowed (inode)) goto out; - error =PROC_I (inode)->op.proc_get_link (inode, &de, &mnt); + error =PROC_I (inode)->op.proc_get_link (inode, &path);if (error) goto out; - error =do_proc_readlink (de, mnt, buffer, buflen); -dput (de); -mntput (mnt); + error =do_proc_readlink (&path, buffer, buflen); +path_put (&path); out:return error; }
@@ -1317,8 +1313,7 @@ out:#define PROC_FDINFO_MAX 64 -static int proc_fd_info (struct inode *inode,struct dentry **dentry, -struct vfsmount **mnt,char *info) +static int proc_fd_info (struct inode *inode,struct path *path,char *info) {struct task_struct *task =get_proc_task (inode);struct files_struct *files =NULL ;
@@ -1337,10 +1332,10 @@ static int proc_fd_info(struct inode *inspin_lock (&files->file_lock); file =fcheck_files (files, fd);if (file) { -if (mnt) - *mnt =mntget (file->f_path.mnt); -if (dentry) - *dentry =dget (file->f_path.dentry); +if (path) { + *path = file->f_path; +path_get (path); + }if (info)snprintf (info,PROC_FDINFO_MAX , "pos:\t%lli\n"
@@ -1357,10 +1352,9 @@ static int proc_fd_info(struct inode *inreturn -ENOENT ; } -static int proc_fd_link (struct inode *inode,struct dentry **dentry, -struct vfsmount **mnt) +static int proc_fd_link (struct inode *inode,struct path *path) { -return proc_fd_info (inode, dentry, mnt,NULL ); +return proc_fd_info (inode, path,NULL ); }static int tid_fd_revalidate (struct dentry *dentry,struct nameidata *nd)
@@ -1554,7 +1548,7 @@ static ssize_t proc_fdinfo_read(struct f size_t len, loff_t *ppos) { char tmp[PROC_FDINFO_MAX]; -int err =proc_fd_info (file->f_path.dentry->d_inode,NULL ,NULL , tmp); +int err =proc_fd_info (file->f_path.dentry->d_inode,NULL , tmp);if (!err) err =simple_read_from_buffer (buf, len, ppos, tmp,strlen (tmp));return err;
fs/proc/internal.h +1 -1
@@ -45,7 +45,7 @@ extern int nommu_vma_show(struct seq_filextern int maps_protect;extern void create_seq_entry (char *name,mode_t mode,const struct file_operations *f); -extern int proc_exe_link (struct inode *,struct dentry **,struct vfsmount **); +extern int proc_exe_link (struct inode *,struct path *);extern int proc_tid_stat (struct task_struct *,char *);extern int proc_tgid_stat (struct task_struct *,char *);extern int proc_pid_status (struct task_struct *,char *);
fs/proc/task_mmu.c +3 -3
@@ -73,7 +73,7 @@ int task_statm(struct mm_struct *mm, intreturn mm->total_vm; } -int proc_exe_link (struct inode *inode,struct dentry **dentry,struct vfsmount **mnt) +int proc_exe_link (struct inode *inode,struct path *path) {struct vm_area_struct * vma;int result = -ENOENT ;
@@ -96,8 +96,8 @@ int proc_exe_link(struct inode *inode, s }if (vma) { - *mnt =mntget (vma->vm_file->f_path.mnt); - *dentry =dget (vma->vm_file->f_path.dentry); + *path = vma->vm_file->f_path; +path_get (path); result =0 ; }
fs/proc/task_nommu.c +3 -3
@@ -104,7 +104,7 @@ int task_statm(struct mm_struct *mm, intreturn size; } -int proc_exe_link (struct inode *inode,struct dentry **dentry,struct vfsmount **mnt) +int proc_exe_link (struct inode *inode,struct path *path) {struct vm_list_struct *vml;struct vm_area_struct *vma;
@@ -127,8 +127,8 @@ int proc_exe_link(struct inode *inode, s }if (vma) { - *mnt =mntget (vma->vm_file->f_path.mnt); - *dentry =dget (vma->vm_file->f_path.dentry); + *path = vma->vm_file->f_path; +path_get (path); result =0 ; }
include/linux/proc_fs.h +1 -1
@@ -257,7 +257,7 @@ extern void kclist_add(struct kcore_list#endif union proc_op { -int (*proc_get_link)(struct inode *,struct dentry **,struct vfsmount **); +int (*proc_get_link)(struct inode *,struct path *);int (*proc_read)(struct task_struct *task,char *page); };
PATCH 13/13 Rename {__}d_path() to {__}print_path() and fix comments
In reply to Bharata B RaoChanges the name of d_path() and __d_path() to print_path() and __print_path() respectively and fixes the kerneldoc comments for print_path().
--- arch/blackfin/kernel/traps.c | 2 - drivers/md/bitmap.c | 2 - drivers/usb/gadget/file_storage.c | 4 +-- fs/compat_ioctl.c | 3 +- fs/dcache.c | 41 +++++++++++++++++--------------------- fs/dcookies.c | 2 - fs/ecryptfs/super.c | 2 - fs/nfsd/export.c | 2 - fs/proc/base.c | 2 - fs/seq_file.c | 2 - fs/sysfs/file.c | 2 - fs/unionfs/super.c | 2 - include/linux/dcache.h | 2 - kernel/audit.c | 2 - 14 files changed, 34 insertions(+), 36 deletions(-)
arch/blackfin/kernel/traps.c +1 -1
@@ -102,7 +102,7 @@ static int printk_address(unsigned longstruct file *file = vma->vm_file;if (file) {char _tmpbuf[256 ]; - name =d_path (file->f_dentry, + name =print_path (file->f_dentry, file->f_vfsmnt, _tmpbuf,sizeof (_tmpbuf));
drivers/md/bitmap.c +1 -1
@@ -215,7 +215,7 @@ char *file_path(struct file *file, char d = file->f_path.dentry; v = file->f_path.mnt; - buf =d_path (d, v, buf, count); + buf =print_path (d, v, buf, count);return IS_ERR (buf) ?NULL : buf; }
drivers/usb/gadget/file_storage.c +2 -2
@@ -3567,7 +3567,7 @@ static ssize_t show_file(struct device *down_read (&fsg->filesem);if (backing_file_is_open (curlun)) {// Get the complete pathname - p =d_path (curlun->filp->f_path.dentry, + p =print_path (curlun->filp->f_path.dentry, curlun->filp->f_path.mnt, buf,PAGE_SIZE -1 );if (IS_ERR (p)) rc =PTR_ERR (p);
@@ -3985,7 +3985,7 @@ static int __init fsg_bind(struct usb_gaif (backing_file_is_open (curlun)) { p =NULL ;if (pathbuf) { - p =d_path (curlun->filp->f_path.dentry, + p =print_path (curlun->filp->f_path.dentry, curlun->filp->f_path.mnt, pathbuf,PATH_MAX );if (IS_ERR (p))
fs/compat_ioctl.c +2 -1
@@ -3544,7 +3544,8 @@ static void compat_ioctl_error(struct fi/* find the name of the device. */ path = (char *)__get_free_page (GFP_KERNEL );if (path) { - fn =d_path (filp->f_path.dentry, filp->f_path.mnt, path,PAGE_SIZE ); + fn =print_path (filp->f_path.dentry, filp->f_path.mnt, + path,PAGE_SIZE );if (IS_ERR (fn)) fn ="?" ; }
fs/dcache.c +19 -22
71 lines not on this page · raw message
fs/dcookies.c +1 -1
@@ -174,7 +174,7 @@ asmlinkage long sys_lookup_dcookie(u64 c goto out;/* FIXME: (deleted) ? */ - path =d_path (dcs->dentry, dcs->vfsmnt, kbuf,PAGE_SIZE ); + path =print_path (dcs->dentry, dcs->vfsmnt, kbuf,PAGE_SIZE );if (IS_ERR (path)) { err =PTR_ERR (path);
fs/ecryptfs/super.c +1 -1
@@ -174,7 +174,7 @@ static int ecryptfs_show_options(struct rc = -ENOMEM ; goto out; } - path =d_path (lower_root_dentry, lower_mnt, tmp_page,PAGE_SIZE ); + path =print_path (lower_root_dentry, lower_mnt, tmp_page,PAGE_SIZE );if (IS_ERR (path)) { rc =PTR_ERR (path); goto out;
fs/nfsd/export.c +1 -1
@@ -349,7 +349,7 @@ static void svc_export_request(struct cachar *pth;qword_add (bpp, blen, exp->ex_client->name); - pth =d_path (exp->ex_dentry, exp->ex_mnt, *bpp, *blen); + pth =print_path (exp->ex_dentry, exp->ex_mnt, *bpp, *blen);if (IS_ERR (pth)) {/* is this correct? */ (*bpp)[0 ] ='\n' ;
fs/proc/base.c +1 -1
@@ -1056,7 +1056,7 @@ static int do_proc_readlink(struct pathreturn -ENOMEM ; inode = path->dentry->d_inode; - pathname =d_path (path->dentry, path->mnt, tmp,PAGE_SIZE ); + pathname =print_path (path->dentry, path->mnt, tmp,PAGE_SIZE ); len =PTR_ERR (pathname);if (IS_ERR (pathname)) goto out;
fs/seq_file.c +1 -1
@@ -355,7 +355,7 @@ int seq_path(struct seq_file *m, {if (m->count < m->size) {char *s = m->buf + m->count; -char *p =d_path (dentry, mnt, s, m->size - m->count); +char *p =print_path (dentry, mnt, s, m->size - m->count);if (!IS_ERR (p)) {while (s <= p) {char c = *p++;
fs/sysfs/file.c +1 -1
@@ -355,7 +355,7 @@ static int sysfs_open_file(struct inodeint error;char *p; - p =d_path (file->f_dentry, sysfs_mount, last_sysfs_file, + p =print_path (file->f_dentry, sysfs_mount, last_sysfs_file,sizeof (last_sysfs_file));if (p)memmove (last_sysfs_file, p,strlen (p) +1 );
fs/unionfs/super.c +1 -1
@@ -975,7 +975,7 @@ static int unionfs_show_options(struct sseq_printf (m,",dirs=" );for (bindex = bstart; bindex <= bend; bindex++) { - path =d_path (unionfs_lower_dentry_idx (sb->s_root, bindex), + path =print_path (unionfs_lower_dentry_idx (sb->s_root, bindex),unionfs_lower_mnt_idx (sb->s_root, bindex), tmp_page,PAGE_SIZE );if (IS_ERR (path)) {
include/linux/dcache.h +1 -1
@@ -300,7 +300,7 @@ extern int d_validate(struct dentry *, s*/ extern char *dynamic_dname (struct dentry *,char *,int ,const char *, ...); -extern char *d_path (struct dentry *,struct vfsmount *,char *,int ); +extern char *print_path (struct dentry *,struct vfsmount *,char *,int );/* Allocation counts.. */
kernel/audit.c +1 -1
@@ -1407,7 +1407,7 @@ void audit_log_d_path(struct audit_buffeaudit_log_format (ab,"<no memory>" );return ; } - p =d_path (dentry, vfsmnt, path,PATH_MAX +11 ); + p =print_path (dentry, vfsmnt, path,PATH_MAX +11 );if (IS_ERR (p)) {/* Should never happen since we send PATH_MAX */ /* FIXME: can we save some information here? */ audit_log_format (ab,"<too long>" );
Re: [PATCH 13/13] Rename {__}d_path() to {__}print_path() and fix comments
Quoted 2 lines · Bharata B Rao
Changes the name of
d_path()and__d_path()toprint_path()and__print_path()respectively and fixes the kerneldoc comments forprint_path().
I don't think we want to put in this rename until d_path is changed to actually take a struct path * describing the path to be printed.
Any reason we've got this patchset posted by three people now? :)
Andrew Morton
maintainerQuoted 2 lines · On Mon, 22 Oct 2007 15:57:58 +0200 Christoph Hellwig <[email protected]> wrote:
Any reason we've got this patchset posted by three people now? :)
presumably because I haven't been merging it.
I was in bugfix-only mode from a week prior to 2.6.24 release and during the merge window. Partly caused by the already-idiotic amount of stuff we had queued for 2.6.24, partly because we needed to concentrate on stabilising the 2.6.25 patchpile rather than writing new stuff.
And partly to send the signal that rather than beavering away on new features all the time, we should also be spending some (more) time testing, reviewing and bugfixing the current and soon-to-be-current code.
Probably I should have been more explicit about it, but it wasn't really planned. Next time I'll send more "thanks, I parked this for consideration at a more appropriate time" emails.
Andrew Morton
maintainerRe: [PATCH 13/13] Rename {__}d_path() to {__}print_path() and fix comments
In reply to Christoph HellwigQuoted 6 lines · On Mon, 22 Oct 2007 11:14:43 +0100 Christoph Hellwig <[email protected]> wrote:
Quoted 2 lines · Bharata B Rao
Changes the name of
d_path()and__d_path()toprint_path()and__print_path()respectively and fixes the kerneldoc comments forprint_path().I don't think we want to put in this rename until
d_pathis changed to actually take a struct path * describing the path to be printed.
I didn't merge this one.
Quoted 2 lines · Christoph Hellwig
Any reason we've got this patchset posted by three people now? :)
Two reasons actually !
- The set of patches posted by Jan last was on 2.6.23-rc8-mm1. So I thought let me help Andrew a bit by making them available on latest -mm :) And I didn't know that these were already under consideration by Andrew.
- The set of patches posted by Jan didn't even pass compile test for me. So I made sure that the patches compiled and worked on x86, x86_64 and powerpc.
Regards,
Bharata.
Quoted 13 lines · Andrew Morton
Quoted 2 lines · On Mon, 22 Oct 2007 15:57:58 +0200 Christoph Hellwig <[email protected]> wrote:
Any reason we've got this patchset posted by three people now? :)
presumably because I haven't been merging it.
I was in bugfix-only mode from a week prior to 2.6.24 release and during the merge window. Partly caused by the already-idiotic amount of stuff we had queued for 2.6.24, partly because we needed to concentrate on stabilising the 2.6.25 patchpile rather than writing new stuff.
Quoted 7 lines
And partly to send the signal that rather than beavering away on new features all the time, we should also be spending some (more) time testing, reviewing and bugfixing the current and soon-to-be-current code.
Probably I should have been more explicit about it, but it wasn't really planned. Next time I'll send more "thanks, I parked this for consideration at a more appropriate time" emails.
Oh, I got that one. I don't know why Bharata sent the patch series again. Especially since I don't know which version of the patches he sent out :(
The original patches where rotting in my queue for quite some time until Andreas got fed up with me having no time to work on them. Now since Andreas is busy working on other things I took over again. Thats it.
Quoted 10 lines · Bharata B Rao
Quoted 2 lines · Christoph Hellwig
Any reason we've got this patchset posted by three people now? :)
Two reasons actually !
- The set of patches posted by Jan last was on 2.6.23-rc8-mm1. So I thought let me help Andrew a bit by making them available on latest -mm :) And I didn't know that these were already under consideration by Andrew.
And they have been ported to 2.6.23-mm1 since the day it came out ...
Quoted 2 lines
- The set of patches posted by Jan didn't even pass compile test for me. So I made sure that the patches compiled and worked on x86,
x86_64and powerpc.
And I merged your feedback already in ...
The thing is: how do we keep going from here? Do you want to send my patches in the future or are you going to ask me before sending things out? We don't need to duplicate the work here. I already put my quilt stack into a public place for you to work on them but I don't like the way this is going on at the moment.
Quoted 6 lines · Jan Blunck
The thing is: how do we keep going from here? Do you want to send my patches in the future or are you going to ask me before sending things out? We don't need to duplicate the work here. I already put my quilt stack into a public place for you to work on them but I don't like the way this is going on at the moment.
My intention was to help speed up the Union Mount effort by ensuring that patches don't rot waiting for developer's attention. Going by the past interactions, I got a feeling that you have lot of other work besides this, while I have time to spare on this. Hence wanted to do my bit to get patches moving as quickly as possible.
As I have conveyed to you many times, I would still like you to maintain the patches and send out as timely as possible on lkml. If you can't do this because of your other commitments, then I would more than willing to maintain these and give them maximum attention.
And thanks for making available the patches publicly, I have been asking this for months now.
Regards,
Bharata.