aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 9b8b87fcd4ec..b6a065eb25a5 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1610,12 +1610,18 @@ xfs_inactive(
1610 return VN_INACTIVE_CACHE; 1610 return VN_INACTIVE_CACHE;
1611} 1611}
1612 1612
1613 1613/*
1614 * Lookups up an inode from "name". If ci_name is not NULL, then a CI match
1615 * is allowed, otherwise it has to be an exact match. If a CI match is found,
1616 * ci_name->name will point to a the actual name (caller must free) or
1617 * will be set to NULL if an exact match is found.
1618 */
1614int 1619int
1615xfs_lookup( 1620xfs_lookup(
1616 xfs_inode_t *dp, 1621 xfs_inode_t *dp,
1617 struct xfs_name *name, 1622 struct xfs_name *name,
1618 xfs_inode_t **ipp) 1623 xfs_inode_t **ipp,
1624 struct xfs_name *ci_name)
1619{ 1625{
1620 xfs_ino_t inum; 1626 xfs_ino_t inum;
1621 int error; 1627 int error;
@@ -1627,7 +1633,7 @@ xfs_lookup(
1627 return XFS_ERROR(EIO); 1633 return XFS_ERROR(EIO);
1628 1634
1629 lock_mode = xfs_ilock_map_shared(dp); 1635 lock_mode = xfs_ilock_map_shared(dp);
1630 error = xfs_dir_lookup(NULL, dp, name, &inum); 1636 error = xfs_dir_lookup(NULL, dp, name, &inum, ci_name);
1631 xfs_iunlock_map_shared(dp, lock_mode); 1637 xfs_iunlock_map_shared(dp, lock_mode);
1632 1638
1633 if (error) 1639 if (error)
@@ -1635,12 +1641,15 @@ xfs_lookup(
1635 1641
1636 error = xfs_iget(dp->i_mount, NULL, inum, 0, 0, ipp, 0); 1642 error = xfs_iget(dp->i_mount, NULL, inum, 0, 0, ipp, 0);
1637 if (error) 1643 if (error)
1638 goto out; 1644 goto out_free_name;
1639 1645
1640 xfs_itrace_ref(*ipp); 1646 xfs_itrace_ref(*ipp);
1641 return 0; 1647 return 0;
1642 1648
1643 out: 1649out_free_name:
1650 if (ci_name)
1651 kmem_free(ci_name->name);
1652out:
1644 *ipp = NULL; 1653 *ipp = NULL;
1645 return error; 1654 return error;
1646} 1655}