GOTO(out_sa, rc);
}
- exp = ll_i2mdexp(de->d_inode);
-
/* Never execute intents for mount points.
* Attributes will be fixed up in ll_inode_revalidate_it */
if (d_mountpoint(de))
GOTO(out_sa, rc = 1);
- /* Root of the lustre tree. Always valid.
- * Attributes will be fixed up in ll_inode_revalidate_it */
- if (de == de->d_sb->s_root)
- GOTO(out_sa, rc = 1);
+ /* need to get attributes in case root got changed from other client */
+ if (de == de->d_sb->s_root) {
+ rc = __ll_inode_revalidate_it(de, it, MDS_INODELOCK_LOOKUP);
+ if (rc == 0)
+ rc = 1;
+ GOTO(out_sa, rc);
+ }
+
+ exp = ll_i2mdexp(de->d_inode);
OBD_FAIL_TIMEOUT(OBD_FAIL_MDC_REVALIDATE_PAUSE, 5);
ll_frob_intent(&it, &lookup_it);
do_lock:
it->it_create_mode &= ~current->fs->umask;
- it->it_flags |= O_CHECK_STALE;
+ it->it_create_mode |= M_CHECK_STALE;
rc = md_intent_lock(exp, op_data, NULL, 0, it,
lookup_flags,
&req, ll_md_blocking_ast, 0);
- it->it_flags &= ~O_CHECK_STALE;
+ it->it_create_mode &= ~M_CHECK_STALE;
ll_finish_md_op_data(op_data);
if (it->it_op == IT_GETATTR && !first)
/* If there are too many locks on client-side, then some
}
if (rc < 0) {
- if (-ESTALE == rc) {
+ if (rc != -ESTALE) {
+ CDEBUG(D_INFO, "ll_intent_lock: rc %d : it->it_status "
+ "%d\n", rc, it->d.lustre.it_status);
+ } else {
+#ifndef HAVE_VFS_INTENT_PATCHES
if (it_disposition(it, DISP_OPEN_OPEN) &&
!it_open_error(DISP_OPEN_OPEN, it))
/* server have valid open - close file first*/
ll_release_openhandle(de, it);
- /* release intent reference to avoid having stale 'it'
- * in namedata for old VFS intent */
- ll_intent_drop_lock(it);
- } else {
- CDEBUG(D_INFO, "ll_intent_lock: rc %d : it->it_status "
- "%d\n", rc, it->d.lustre.it_status);
+#endif
}
GOTO(out, rc = 0);
}
}
#ifdef HAVE_VFS_INTENT_PATCHES
-static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
+int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
{
int rc;
ENTRY;
(struct ptlrpc_request *)
it->d.lustre.it_data);
} else {
- struct file *filp;
-
- nd->intent.open.file->private_data = it;
- filp = lookup_instantiate_filp(nd, dentry,NULL);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
/* 2.6.1[456] have a bug in open_namei() that forgets to check
* nd->intent.open.file for error, so we need to return it as lookup's result
* instead */
- if (IS_ERR(filp))
- rc = 0;
+ struct file *filp;
+
+ nd->intent.open.file->private_data = it;
+ filp = lookup_instantiate_filp(nd, dentry,NULL);
+ if (IS_ERR(filp)) {
+ rc = PTR_ERR(filp);
+ }
+#else
+ nd->intent.open.file->private_data = it;
+ (void)lookup_instantiate_filp(nd, dentry,NULL);
#endif
}
#else