if (lld == NULL) /* NFS copies the de->d_op methods (bug 4655) */
RETURN_EXIT;
- if (lld->lld_it) {
- ll_intent_release(lld->lld_it);
- OBD_FREE(lld->lld_it, sizeof(*lld->lld_it));
- }
-
de->d_fsdata = NULL;
call_rcu(&lld->lld_rcu_head, free_dentry_data);
ENTRY;
LASSERT(de);
- CDEBUG(D_DENTRY, "%s dentry %.*s (%p, parent %p, inode %p) %s%s\n",
- d_lustre_invalid((struct dentry *)de) ? "deleting" : "keeping",
- de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode,
+ CDEBUG(D_DENTRY, "%s dentry %pd (%p, parent %p, inode %p) %s%s\n",
+ d_lustre_invalid(de) ? "deleting" : "keeping",
+ de, de, de->d_parent, de->d_inode,
d_unhashed((struct dentry *)de) ? "" : "hashed,",
list_empty(&de->d_subdirs) ? "" : "subdirs");
/* kernel >= 2.6.38 last refcount is decreased after this function. */
LASSERT(ll_d_count(de) == 1);
- if (d_lustre_invalid((struct dentry *)de))
+ if (d_lustre_invalid(de))
RETURN(1);
RETURN(0);
}
ENTRY;
LASSERT(de != NULL);
- CDEBUG(D_DENTRY, "ldd on dentry %.*s (%p) parent %p inode %p refc %d\n",
- de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode,
- ll_d_count(de));
+ CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n",
+ de, de, de->d_parent, de->d_inode,
+ ll_d_count(de));
if (de->d_fsdata == NULL) {
struct ll_dentry_data *lld;
if (it->it_remote_lock_mode != 0) {
handle.cookie = it->it_remote_lock_handle;
- CDEBUG(D_DLMTRACE, "releasing remote lock with cookie"
- "%#llx from it %p\n", handle.cookie, it);
+ CDEBUG(D_DLMTRACE,
+ "releasing remote lock with cookie %#llx from it %p\n",
+ handle.cookie, it);
ldlm_lock_decref(&handle,
it->it_remote_lock_mode);
it->it_remote_lock_mode = 0;
EXIT;
}
-void ll_invalidate_aliases(struct inode *inode)
+/* mark aliases invalid and prune unused aliases */
+void ll_prune_aliases(struct inode *inode)
{
struct dentry *dentry;
- DECLARE_LL_D_HLIST_NODE_PTR(p);
ENTRY;
LASSERT(inode != NULL);
PFID(ll_inode2fid(inode)), inode);
spin_lock(&inode->i_lock);
- ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry) {
- CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p "
- "inode %p flags %d\n", dentry->d_name.len,
- dentry->d_name.name, dentry, dentry->d_parent,
- dentry->d_inode, dentry->d_flags);
-
- d_lustre_invalidate(dentry, 0);
- }
+ hlist_for_each_entry(dentry, &inode->i_dentry, d_alias)
+ d_lustre_invalidate(dentry);
spin_unlock(&inode->i_lock);
+ d_prune_aliases(inode);
+
EXIT;
}
void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry)
{
- LASSERT(it != NULL);
- LASSERT(dentry != NULL);
+ LASSERT(it != NULL);
+ LASSERT(dentry != NULL);
if (it->it_lock_mode && dentry->d_inode != NULL) {
- struct inode *inode = dentry->d_inode;
- struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
+ struct inode *inode = dentry->d_inode;
+ struct ll_sb_info *sbi = ll_i2sbi(inode);
CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"(%p)\n",
PFID(ll_inode2fid(inode)), inode);
- ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL);
- }
-
- /* drop lookup or getattr locks immediately */
- if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR) {
- /* on 2.6 there are situation when several lookups and
- * revalidations may be requested during single operation.
- * therefore, we don't release intent here -bzzz */
- ll_intent_drop_lock(it);
- }
+ ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL);
+ }
+
+ /* drop lookup or getattr locks immediately */
+ if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR)
+ ll_intent_drop_lock(it);
}
static int ll_revalidate_dentry(struct dentry *dentry,
{
struct inode *dir = dentry->d_parent->d_inode;
+ CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n",
+ dentry->d_name.name, lookup_flags);
+
/* If this is intermediate component path lookup and we were able to get
* to this dentry, then its lock has not been revoked and the
* path component is valid. */
return 1;
/* Symlink - always valid as long as the dentry was found */
-#ifdef HAVE_IOP_GET_LINK
- if (dentry->d_inode && dentry->d_inode->i_op->get_link)
-#else
- if (dentry->d_inode && dentry->d_inode->i_op->follow_link)
-#endif
- return 1;
+ /* only special case is to prevent ELOOP error from VFS during open
+ * of a foreign symlink file/dir with O_NOFOLLOW, like it happens for
+ * real symlinks. This will allow to open foreign symlink file/dir
+ * for get[dir]stripe/unlock ioctl()s.
+ */
+ if (d_is_symlink(dentry)) {
+ if (!S_ISLNK(dentry->d_inode->i_mode) &&
+ !(lookup_flags & LOOKUP_FOLLOW))
+ return 0;
+ else
+ return 1;
+ }
/*
* VFS warns us that this is the second go around and previous
return -ECHILD;
if (dentry_may_statahead(dir, dentry))
- ll_statahead(dir, &dentry, dentry->d_inode == NULL);
+ ll_revalidate_statahead(dir, &dentry, dentry->d_inode == NULL);
return 1;
}
-/*
- * Always trust cached dentries. Update statahead window if necessary.
- */
-#ifdef HAVE_IOP_ATOMIC_OPEN
-static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags)
-{
- int rc;
- ENTRY;
-
- CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n",
- dentry->d_name.name, flags);
-
- rc = ll_revalidate_dentry(dentry, flags);
- RETURN(rc);
-}
-#else
-static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
-{
- int rc;
- ENTRY;
-
- /*
- * this is normally called from NFS export, and we don't know whether
- * this is the last component.
- */
- if (nd == NULL)
- RETURN(1);
-
- CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n",
- dentry->d_name.name, nd->flags);
-
- rc = ll_revalidate_dentry(dentry, nd->flags);
- RETURN(rc);
-}
-#endif
-
const struct dentry_operations ll_d_ops = {
- .d_revalidate = ll_revalidate_nd,
+ .d_revalidate = ll_revalidate_dentry,
.d_release = ll_release,
.d_delete = ll_ddelete,
.d_compare = ll_dcompare,