- if (!cache_dentry)
- return;
-
- /*
- * this is needed because d_unalloc() calls dput(), which in turn calls
- * iput() on dentry inode.
- */
- if (cache_dentry->d_inode)
- igrab(cache_dentry->d_inode);
- d_unalloc(cache_dentry);
-}
-
-static inline int lookup_by_path(char *path, int flags, struct nameidata *nd)
-{
- struct dentry *dentry = NULL;
- int rc = 0;
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- if (path_init(path, flags, nd)) {
-#else
- if (path_lookup(path, flags, nd)) {
-#endif
- rc = path_walk(path, nd);
- if (rc)
- RETURN(rc);
- } else {
- RETURN(-EINVAL);
- }
-
- dentry = nd->dentry;
-
- if (!dentry->d_inode || is_bad_inode(dentry->d_inode)) {
- path_release(nd);
- RETURN(-ENODEV);
- }
- RETURN(rc);