diff options
author | Jan Blunck <jblunck@suse.de> | 2008-02-14 22:34:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-15 00:13:33 -0500 |
commit | 1d957f9bf87da74f420424d16ece005202bbebd3 (patch) | |
tree | 363d4770c0c74a536524c99ccd2762ce96ee9bbe /fs/open.c | |
parent | 4ac9137858e08a19f29feac4e1f4df7c268b0ba5 (diff) |
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>
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -130,7 +130,7 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf) | |||
130 | error = vfs_statfs_native(nd.path.dentry, &tmp); | 130 | error = vfs_statfs_native(nd.path.dentry, &tmp); |
131 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 131 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
132 | error = -EFAULT; | 132 | error = -EFAULT; |
133 | path_release(&nd); | 133 | path_put(&nd.path); |
134 | } | 134 | } |
135 | return error; | 135 | return error; |
136 | } | 136 | } |
@@ -149,7 +149,7 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64 | |||
149 | error = vfs_statfs64(nd.path.dentry, &tmp); | 149 | error = vfs_statfs64(nd.path.dentry, &tmp); |
150 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 150 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
151 | error = -EFAULT; | 151 | error = -EFAULT; |
152 | path_release(&nd); | 152 | path_put(&nd.path); |
153 | } | 153 | } |
154 | return error; | 154 | return error; |
155 | } | 155 | } |
@@ -277,7 +277,7 @@ static long do_sys_truncate(const char __user * path, loff_t length) | |||
277 | put_write_and_out: | 277 | put_write_and_out: |
278 | put_write_access(inode); | 278 | put_write_access(inode); |
279 | dput_and_out: | 279 | dput_and_out: |
280 | path_release(&nd); | 280 | path_put(&nd.path); |
281 | out: | 281 | out: |
282 | return error; | 282 | return error; |
283 | } | 283 | } |
@@ -462,7 +462,7 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) | |||
462 | res = -EROFS; | 462 | res = -EROFS; |
463 | 463 | ||
464 | out_path_release: | 464 | out_path_release: |
465 | path_release(&nd); | 465 | path_put(&nd.path); |
466 | out: | 466 | out: |
467 | current->fsuid = old_fsuid; | 467 | current->fsuid = old_fsuid; |
468 | current->fsgid = old_fsgid; | 468 | current->fsgid = old_fsgid; |
@@ -493,7 +493,7 @@ asmlinkage long sys_chdir(const char __user * filename) | |||
493 | set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry); | 493 | set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry); |
494 | 494 | ||
495 | dput_and_out: | 495 | dput_and_out: |
496 | path_release(&nd); | 496 | path_put(&nd.path); |
497 | out: | 497 | out: |
498 | return error; | 498 | return error; |
499 | } | 499 | } |
@@ -549,7 +549,7 @@ asmlinkage long sys_chroot(const char __user * filename) | |||
549 | set_fs_altroot(); | 549 | set_fs_altroot(); |
550 | error = 0; | 550 | error = 0; |
551 | dput_and_out: | 551 | dput_and_out: |
552 | path_release(&nd); | 552 | path_put(&nd.path); |
553 | out: | 553 | out: |
554 | return error; | 554 | return error; |
555 | } | 555 | } |
@@ -621,7 +621,7 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename, | |||
621 | mutex_unlock(&inode->i_mutex); | 621 | mutex_unlock(&inode->i_mutex); |
622 | 622 | ||
623 | dput_and_out: | 623 | dput_and_out: |
624 | path_release(&nd); | 624 | path_put(&nd.path); |
625 | out: | 625 | out: |
626 | return error; | 626 | return error; |
627 | } | 627 | } |
@@ -676,7 +676,7 @@ asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group) | |||
676 | if (error) | 676 | if (error) |
677 | goto out; | 677 | goto out; |
678 | error = chown_common(nd.path.dentry, user, group); | 678 | error = chown_common(nd.path.dentry, user, group); |
679 | path_release(&nd); | 679 | path_put(&nd.path); |
680 | out: | 680 | out: |
681 | return error; | 681 | return error; |
682 | } | 682 | } |
@@ -696,7 +696,7 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, | |||
696 | if (error) | 696 | if (error) |
697 | goto out; | 697 | goto out; |
698 | error = chown_common(nd.path.dentry, user, group); | 698 | error = chown_common(nd.path.dentry, user, group); |
699 | path_release(&nd); | 699 | path_put(&nd.path); |
700 | out: | 700 | out: |
701 | return error; | 701 | return error; |
702 | } | 702 | } |
@@ -710,7 +710,7 @@ asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group | |||
710 | if (error) | 710 | if (error) |
711 | goto out; | 711 | goto out; |
712 | error = chown_common(nd.path.dentry, user, group); | 712 | error = chown_common(nd.path.dentry, user, group); |
713 | path_release(&nd); | 713 | path_put(&nd.path); |
714 | out: | 714 | out: |
715 | return error; | 715 | return error; |
716 | } | 716 | } |
@@ -894,7 +894,7 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags) | |||
894 | filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp, | 894 | filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp, |
895 | NULL); | 895 | NULL); |
896 | else | 896 | else |
897 | path_release(nd); | 897 | path_put(&nd->path); |
898 | return filp; | 898 | return filp; |
899 | } | 899 | } |
900 | 900 | ||