aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/namei.c b/fs/namei.c
index bc24894c5f14..86643302079e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -202,7 +202,7 @@ static int acl_permission_check(struct inode *inode, int mask, unsigned int flag
202 * @inode: inode to check access rights for 202 * @inode: inode to check access rights for
203 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) 203 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
204 * @check_acl: optional callback to check for Posix ACLs 204 * @check_acl: optional callback to check for Posix ACLs
205 * @flags IPERM_FLAG_ flags. 205 * @flags: IPERM_FLAG_ flags.
206 * 206 *
207 * Used to check for read/write/execute permissions on a file. 207 * Used to check for read/write/execute permissions on a file.
208 * We use "fsuid" for this, letting us set arbitrary permissions 208 * We use "fsuid" for this, letting us set arbitrary permissions
@@ -407,7 +407,7 @@ void path_put_long(struct path *path)
407/** 407/**
408 * nameidata_drop_rcu - drop this nameidata out of rcu-walk 408 * nameidata_drop_rcu - drop this nameidata out of rcu-walk
409 * @nd: nameidata pathwalk data to drop 409 * @nd: nameidata pathwalk data to drop
410 * @Returns: 0 on success, -ECHLID on failure 410 * Returns: 0 on success, -ECHILD on failure
411 * 411 *
412 * Path walking has 2 modes, rcu-walk and ref-walk (see 412 * Path walking has 2 modes, rcu-walk and ref-walk (see
413 * Documentation/filesystems/path-lookup.txt). __drop_rcu* functions attempt 413 * Documentation/filesystems/path-lookup.txt). __drop_rcu* functions attempt
@@ -468,7 +468,7 @@ static inline int nameidata_drop_rcu_maybe(struct nameidata *nd)
468 * nameidata_dentry_drop_rcu - drop nameidata and dentry out of rcu-walk 468 * nameidata_dentry_drop_rcu - drop nameidata and dentry out of rcu-walk
469 * @nd: nameidata pathwalk data to drop 469 * @nd: nameidata pathwalk data to drop
470 * @dentry: dentry to drop 470 * @dentry: dentry to drop
471 * @Returns: 0 on success, -ECHLID on failure 471 * Returns: 0 on success, -ECHILD on failure
472 * 472 *
473 * nameidata_dentry_drop_rcu attempts to drop the current nd->path and nd->root, 473 * nameidata_dentry_drop_rcu attempts to drop the current nd->path and nd->root,
474 * and dentry into ref-walk. @dentry must be a path found by a do_lookup call on 474 * and dentry into ref-walk. @dentry must be a path found by a do_lookup call on
@@ -538,7 +538,7 @@ static inline int nameidata_dentry_drop_rcu_maybe(struct nameidata *nd, struct d
538/** 538/**
539 * nameidata_drop_rcu_last - drop nameidata ending path walk out of rcu-walk 539 * nameidata_drop_rcu_last - drop nameidata ending path walk out of rcu-walk
540 * @nd: nameidata pathwalk data to drop 540 * @nd: nameidata pathwalk data to drop
541 * @Returns: 0 on success, -ECHLID on failure 541 * Returns: 0 on success, -ECHILD on failure
542 * 542 *
543 * nameidata_drop_rcu_last attempts to drop the current nd->path into ref-walk. 543 * nameidata_drop_rcu_last attempts to drop the current nd->path into ref-walk.
544 * nd->path should be the final element of the lookup, so nd->root is discarded. 544 * nd->path should be the final element of the lookup, so nd->root is discarded.
@@ -1968,8 +1968,9 @@ int may_open(struct path *path, int acc_mode, int flag)
1968 return break_lease(inode, flag); 1968 return break_lease(inode, flag);
1969} 1969}
1970 1970
1971static int handle_truncate(struct path *path) 1971static int handle_truncate(struct file *filp)
1972{ 1972{
1973 struct path *path = &filp->f_path;
1973 struct inode *inode = path->dentry->d_inode; 1974 struct inode *inode = path->dentry->d_inode;
1974 int error = get_write_access(inode); 1975 int error = get_write_access(inode);
1975 if (error) 1976 if (error)
@@ -1983,7 +1984,7 @@ static int handle_truncate(struct path *path)
1983 if (!error) { 1984 if (!error) {
1984 error = do_truncate(path->dentry, 0, 1985 error = do_truncate(path->dentry, 0,
1985 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, 1986 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
1986 NULL); 1987 filp);
1987 } 1988 }
1988 put_write_access(inode); 1989 put_write_access(inode);
1989 return error; 1990 return error;
@@ -2081,7 +2082,7 @@ static struct file *finish_open(struct nameidata *nd,
2081 } 2082 }
2082 if (!IS_ERR(filp)) { 2083 if (!IS_ERR(filp)) {
2083 if (will_truncate) { 2084 if (will_truncate) {
2084 error = handle_truncate(&nd->path); 2085 error = handle_truncate(filp);
2085 if (error) { 2086 if (error) {
2086 fput(filp); 2087 fput(filp);
2087 filp = ERR_PTR(error); 2088 filp = ERR_PTR(error);