aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 12d75ed214f6..167f19b5e51a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1397,7 +1397,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1397int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) 1397int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
1398{ 1398{
1399 int acc_mode, error = 0; 1399 int acc_mode, error = 0;
1400 struct dentry *dentry; 1400 struct path path;
1401 struct dentry *dir; 1401 struct dentry *dir;
1402 int count = 0; 1402 int count = 0;
1403 1403
@@ -1441,23 +1441,23 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
1441 dir = nd->dentry; 1441 dir = nd->dentry;
1442 nd->flags &= ~LOOKUP_PARENT; 1442 nd->flags &= ~LOOKUP_PARENT;
1443 down(&dir->d_inode->i_sem); 1443 down(&dir->d_inode->i_sem);
1444 dentry = __lookup_hash(&nd->last, nd->dentry, nd); 1444 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
1445 1445
1446do_last: 1446do_last:
1447 error = PTR_ERR(dentry); 1447 error = PTR_ERR(path.dentry);
1448 if (IS_ERR(dentry)) { 1448 if (IS_ERR(path.dentry)) {
1449 up(&dir->d_inode->i_sem); 1449 up(&dir->d_inode->i_sem);
1450 goto exit; 1450 goto exit;
1451 } 1451 }
1452 1452
1453 /* Negative dentry, just create the file */ 1453 /* Negative dentry, just create the file */
1454 if (!dentry->d_inode) { 1454 if (!path.dentry->d_inode) {
1455 if (!IS_POSIXACL(dir->d_inode)) 1455 if (!IS_POSIXACL(dir->d_inode))
1456 mode &= ~current->fs->umask; 1456 mode &= ~current->fs->umask;
1457 error = vfs_create(dir->d_inode, dentry, mode, nd); 1457 error = vfs_create(dir->d_inode, path.dentry, mode, nd);
1458 up(&dir->d_inode->i_sem); 1458 up(&dir->d_inode->i_sem);
1459 dput(nd->dentry); 1459 dput(nd->dentry);
1460 nd->dentry = dentry; 1460 nd->dentry = path.dentry;
1461 if (error) 1461 if (error)
1462 goto exit; 1462 goto exit;
1463 /* Don't check for write permission, don't truncate */ 1463 /* Don't check for write permission, don't truncate */
@@ -1475,22 +1475,22 @@ do_last:
1475 if (flag & O_EXCL) 1475 if (flag & O_EXCL)
1476 goto exit_dput; 1476 goto exit_dput;
1477 1477
1478 if (d_mountpoint(dentry)) { 1478 if (d_mountpoint(path.dentry)) {
1479 error = -ELOOP; 1479 error = -ELOOP;
1480 if (flag & O_NOFOLLOW) 1480 if (flag & O_NOFOLLOW)
1481 goto exit_dput; 1481 goto exit_dput;
1482 while (__follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry)); 1482 while (__follow_down(&nd->mnt,&path.dentry) && d_mountpoint(path.dentry));
1483 } 1483 }
1484 error = -ENOENT; 1484 error = -ENOENT;
1485 if (!dentry->d_inode) 1485 if (!path.dentry->d_inode)
1486 goto exit_dput; 1486 goto exit_dput;
1487 if (dentry->d_inode->i_op && dentry->d_inode->i_op->follow_link) 1487 if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link)
1488 goto do_link; 1488 goto do_link;
1489 1489
1490 dput(nd->dentry); 1490 dput(nd->dentry);
1491 nd->dentry = dentry; 1491 nd->dentry = path.dentry;
1492 error = -EISDIR; 1492 error = -EISDIR;
1493 if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) 1493 if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
1494 goto exit; 1494 goto exit;
1495ok: 1495ok:
1496 error = may_open(nd, acc_mode, flag); 1496 error = may_open(nd, acc_mode, flag);
@@ -1499,7 +1499,7 @@ ok:
1499 return 0; 1499 return 0;
1500 1500
1501exit_dput: 1501exit_dput:
1502 dput(dentry); 1502 dput(path.dentry);
1503exit: 1503exit:
1504 path_release(nd); 1504 path_release(nd);
1505 return error; 1505 return error;
@@ -1519,16 +1519,16 @@ do_link:
1519 * are done. Procfs-like symlinks just set LAST_BIND. 1519 * are done. Procfs-like symlinks just set LAST_BIND.
1520 */ 1520 */
1521 nd->flags |= LOOKUP_PARENT; 1521 nd->flags |= LOOKUP_PARENT;
1522 error = security_inode_follow_link(dentry, nd); 1522 error = security_inode_follow_link(path.dentry, nd);
1523 if (error) 1523 if (error)
1524 goto exit_dput; 1524 goto exit_dput;
1525 error = __do_follow_link(dentry, nd); 1525 error = __do_follow_link(path.dentry, nd);
1526 dput(dentry); 1526 dput(path.dentry);
1527 if (error) 1527 if (error)
1528 return error; 1528 return error;
1529 nd->flags &= ~LOOKUP_PARENT; 1529 nd->flags &= ~LOOKUP_PARENT;
1530 if (nd->last_type == LAST_BIND) { 1530 if (nd->last_type == LAST_BIND) {
1531 dentry = nd->dentry; 1531 path.dentry = nd->dentry;
1532 goto ok; 1532 goto ok;
1533 } 1533 }
1534 error = -EISDIR; 1534 error = -EISDIR;
@@ -1545,7 +1545,7 @@ do_link:
1545 } 1545 }
1546 dir = nd->dentry; 1546 dir = nd->dentry;
1547 down(&dir->d_inode->i_sem); 1547 down(&dir->d_inode->i_sem);
1548 dentry = __lookup_hash(&nd->last, nd->dentry, nd); 1548 path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
1549 putname(nd->last.name); 1549 putname(nd->last.name);
1550 goto do_last; 1550 goto do_last;
1551} 1551}