Commit dbca51dd authored by Al Viro's avatar Al Viro

switch ll_lookup_finish_locks() and ll_revalidate_it_finish() to inode

Note that ll_prep_inode() in the latter does *not* modify ->d_inode;
it expects non-negative dentry, and in such cases ll_prep_inode() doesn't
modify *inode - it only uses the value.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f5af19d1
...@@ -270,7 +270,7 @@ void ll_invalidate_aliases(struct inode *inode) ...@@ -270,7 +270,7 @@ void ll_invalidate_aliases(struct inode *inode)
int ll_revalidate_it_finish(struct ptlrpc_request *request, int ll_revalidate_it_finish(struct ptlrpc_request *request,
struct lookup_intent *it, struct lookup_intent *it,
struct dentry *de) struct inode *inode)
{ {
int rc = 0; int rc = 0;
...@@ -280,19 +280,17 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request, ...@@ -280,19 +280,17 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,
if (it_disposition(it, DISP_LOOKUP_NEG)) if (it_disposition(it, DISP_LOOKUP_NEG))
return -ENOENT; return -ENOENT;
rc = ll_prep_inode(&de->d_inode, request, NULL, it); rc = ll_prep_inode(&inode, request, NULL, it);
return rc; return rc;
} }
void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry) void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode)
{ {
LASSERT(it != NULL); LASSERT(it != NULL);
LASSERT(dentry != NULL);
if (it->d.lustre.it_lock_mode && dentry->d_inode != NULL) { if (it->d.lustre.it_lock_mode && inode != NULL) {
struct inode *inode = dentry->d_inode; struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n", CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
inode, inode->i_ino, inode->i_generation); inode, inode->i_ino, inode->i_generation);
......
...@@ -2912,8 +2912,8 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) ...@@ -2912,8 +2912,8 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
oit.it_op = IT_LOOKUP; oit.it_op = IT_LOOKUP;
/* Call getattr by fid, so do not provide name at all. */ /* Call getattr by fid, so do not provide name at all. */
op_data = ll_prep_md_op_data(NULL, dentry->d_inode, op_data = ll_prep_md_op_data(NULL, inode,
dentry->d_inode, NULL, 0, 0, inode, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL); LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data)) if (IS_ERR(op_data))
return PTR_ERR(op_data); return PTR_ERR(op_data);
...@@ -2931,7 +2931,7 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) ...@@ -2931,7 +2931,7 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
goto out; goto out;
} }
rc = ll_revalidate_it_finish(req, &oit, dentry); rc = ll_revalidate_it_finish(req, &oit, inode);
if (rc != 0) { if (rc != 0) {
ll_intent_release(&oit); ll_intent_release(&oit);
goto out; goto out;
...@@ -2944,7 +2944,7 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) ...@@ -2944,7 +2944,7 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
if (!dentry->d_inode->i_nlink) if (!dentry->d_inode->i_nlink)
d_lustre_invalidate(dentry, 0); d_lustre_invalidate(dentry, 0);
ll_lookup_finish_locks(&oit, dentry); ll_lookup_finish_locks(&oit, inode);
} else if (!ll_have_md_lock(dentry->d_inode, &ibits, LCK_MINMODE)) { } else if (!ll_have_md_lock(dentry->d_inode, &ibits, LCK_MINMODE)) {
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode); struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
u64 valid = OBD_MD_FLGETATTR; u64 valid = OBD_MD_FLGETATTR;
......
...@@ -786,9 +786,9 @@ extern const struct dentry_operations ll_d_ops; ...@@ -786,9 +786,9 @@ extern const struct dentry_operations ll_d_ops;
void ll_intent_drop_lock(struct lookup_intent *); void ll_intent_drop_lock(struct lookup_intent *);
void ll_intent_release(struct lookup_intent *); void ll_intent_release(struct lookup_intent *);
void ll_invalidate_aliases(struct inode *); void ll_invalidate_aliases(struct inode *);
void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry); void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode);
int ll_revalidate_it_finish(struct ptlrpc_request *request, int ll_revalidate_it_finish(struct ptlrpc_request *request,
struct lookup_intent *it, struct dentry *de); struct lookup_intent *it, struct inode *inode);
/* llite/llite_lib.c */ /* llite/llite_lib.c */
extern struct super_operations lustre_super_operations; extern struct super_operations lustre_super_operations;
......
...@@ -481,6 +481,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, ...@@ -481,6 +481,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
struct lookup_intent lookup_it = { .it_op = IT_LOOKUP }; struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
struct dentry *save = dentry, *retval; struct dentry *save = dentry, *retval;
struct ptlrpc_request *req = NULL; struct ptlrpc_request *req = NULL;
struct inode *inode;
struct md_op_data *op_data; struct md_op_data *op_data;
__u32 opc; __u32 opc;
int rc; int rc;
...@@ -539,12 +540,13 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, ...@@ -539,12 +540,13 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
goto out; goto out;
} }
if ((it->it_op & IT_OPEN) && dentry->d_inode && inode = dentry->d_inode;
!S_ISREG(dentry->d_inode->i_mode) && if ((it->it_op & IT_OPEN) && inode &&
!S_ISDIR(dentry->d_inode->i_mode)) { !S_ISREG(inode->i_mode) &&
ll_release_openhandle(dentry->d_inode, it); !S_ISDIR(inode->i_mode)) {
ll_release_openhandle(inode, it);
} }
ll_lookup_finish_locks(it, dentry); ll_lookup_finish_locks(it, inode);
if (dentry == save) if (dentry == save)
retval = NULL; retval = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment