Skip to content

Commit 1d957f9

Browse files
Jan BlunckLinus Torvalds
authored andcommitted
Introduce path_put()
* 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() [akpm@linux-foundation.org: fix cifs] Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Cc: <linux-fsdevel@vger.kernel.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Steven French <sfrench@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4ac9137 commit 1d957f9

41 files changed

Lines changed: 125 additions & 118 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/alpha/kernel/osf_sys.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bu
260260
retval = user_path_walk(path, &nd);
261261
if (!retval) {
262262
retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz);
263-
path_release(&nd);
263+
path_put(&nd.path);
264264
}
265265
return retval;
266266
}

‎arch/mips/kernel/sysirix.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ asmlinkage int irix_statfs(const char __user *path,
711711
}
712712

713713
dput_and_out:
714-
path_release(&nd);
714+
path_put(&nd.path);
715715
out:
716716
return error;
717717
}
@@ -1385,7 +1385,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
13851385
error |= __put_user(0, &buf->f_fstr[i]);
13861386

13871387
dput_and_out:
1388-
path_release(&nd);
1388+
path_put(&nd.path);
13891389
out:
13901390
return error;
13911391
}
@@ -1636,7 +1636,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
16361636
error |= __put_user(0, &buf->f_fstr[i]);
16371637

16381638
dput_and_out:
1639-
path_release(&nd);
1639+
path_put(&nd.path);
16401640
out:
16411641
return error;
16421642
}

‎arch/parisc/hpux/sys_hpux.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ asmlinkage long hpux_statfs(const char __user *path,
222222
error = vfs_statfs_hpux(nd.path.dentry, &tmp);
223223
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
224224
error = -EFAULT;
225-
path_release(&nd);
225+
path_put(&nd.path);
226226
}
227227
return error;
228228
}

‎arch/powerpc/platforms/cell/spufs/syscalls.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
7373
LOOKUP_OPEN|LOOKUP_CREATE, &nd);
7474
if (!ret) {
7575
ret = spufs_create(&nd, flags, mode, neighbor);
76-
path_release(&nd);
76+
path_put(&nd.path);
7777
}
7878
putname(tmp);
7979
}

‎arch/sparc64/solaris/fs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf)
436436
if (!error) {
437437
struct inode *inode = nd.path.dentry->d_inode;
438438
error = report_statvfs(nd.path.mnt, inode, buf);
439-
path_release(&nd);
439+
path_put(&nd.path);
440440
}
441441
return error;
442442
}
@@ -466,7 +466,7 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf)
466466
if (!error) {
467467
struct inode *inode = nd.path.dentry->d_inode;
468468
error = report_statvfs64(nd.path.mnt, inode, buf);
469-
path_release(&nd);
469+
path_put(&nd.path);
470470
}
471471
unlock_kernel();
472472
return error;

‎drivers/md/dm-table.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int lookup_device(const char *path, dev_t *dev)
375375
*dev = inode->i_rdev;
376376

377377
out:
378-
path_release(&nd);
378+
path_put(&nd.path);
379379
return r;
380380
}
381381

‎drivers/mtd/mtdsuper.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
203203
goto not_an_MTD_device;
204204

205205
mtdnr = iminor(nd.path.dentry->d_inode);
206-
path_release(&nd);
206+
path_put(&nd.path);
207207

208208
return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
209209
mnt);
@@ -214,7 +214,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
214214
"MTD: Attempt to mount non-MTD device \"%s\"\n",
215215
dev_name);
216216
out:
217-
path_release(&nd);
217+
path_put(&nd.path);
218218
return ret;
219219

220220
}

‎fs/afs/mntpt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
227227

228228
newmnt = afs_mntpt_do_automount(nd->path.dentry);
229229
if (IS_ERR(newmnt)) {
230-
path_release(nd);
230+
path_put(&nd->path);
231231
return (void *)newmnt;
232232
}
233233

‎fs/autofs4/root.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
383383
return NULL;
384384

385385
out_error:
386-
path_release(nd);
386+
path_put(&nd->path);
387387
return ERR_PTR(status);
388388
}
389389

‎fs/block_dev.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ struct block_device *lookup_bdev(const char *path)
14091409
if (!bdev)
14101410
goto fail;
14111411
out:
1412-
path_release(&nd);
1412+
path_put(&nd.path);
14131413
return bdev;
14141414
fail:
14151415
bdev = ERR_PTR(error);

0 commit comments

Comments
 (0)