aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/mdc/mdc_locks.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/mdc/mdc_locks.c')
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_locks.c77
1 files changed, 45 insertions, 32 deletions
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 71219b90e22b..b58147ee62b6 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -38,7 +38,7 @@
# include <linux/module.h>
-#include "../include/linux/lustre_intent.h"
+#include "../include/lustre_intent.h"
#include "../include/obd.h"
#include "../include/obd_class.h"
#include "../include/lustre_dlm.h"
@@ -134,12 +134,12 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
if (lock->l_resource->lr_lvb_inode &&
lock->l_resource->lr_lvb_inode != data) {
struct inode *old_inode = lock->l_resource->lr_lvb_inode;
+
LASSERTF(old_inode->i_state & I_FREEING,
- "Found existing inode %p/%lu/%u state %lu in lock: "
- "setting data to %p/%lu/%u\n", old_inode,
- old_inode->i_ino, old_inode->i_generation,
- old_inode->i_state,
- new_inode, new_inode->i_ino, new_inode->i_generation);
+ "Found existing inode %p/%lu/%u state %lu in lock: setting data to %p/%lu/%u\n",
+ old_inode, old_inode->i_ino, old_inode->i_generation,
+ old_inode->i_state, new_inode, new_inode->i_ino,
+ new_inode->i_generation);
}
lock->l_resource->lr_lvb_inode = new_inode;
if (bits)
@@ -218,7 +218,7 @@ int mdc_find_cbdata(struct obd_export *exp,
struct ldlm_res_id res_id;
int rc = 0;
- fid_build_reg_res_name((struct lu_fid*)fid, &res_id);
+ fid_build_reg_res_name((struct lu_fid *)fid, &res_id);
rc = ldlm_resource_iterate(class_exp2obd(exp)->obd_namespace, &res_id,
it, data);
if (rc == LDLM_ITER_STOP)
@@ -450,12 +450,12 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp,
}
static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
- struct lookup_intent *it,
- struct md_op_data *op_data)
+ struct lookup_intent *it,
+ struct md_op_data *op_data)
{
struct ptlrpc_request *req;
struct obd_device *obddev = class_exp2obd(exp);
- obd_valid valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE |
+ u64 valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE |
OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA |
OBD_MD_FLMDSCAPA | OBD_MD_MEA |
(client_is_remote(exp) ?
@@ -621,7 +621,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
* function without doing so, and try to replay a failed create
* (bug 3440) */
if (it->it_op & IT_OPEN && req->rq_replay &&
- (!it_disposition(it, DISP_OPEN_OPEN) ||intent->it_status != 0))
+ (!it_disposition(it, DISP_OPEN_OPEN) || intent->it_status != 0))
mdc_clear_replay_flag(req, intent->it_status);
DEBUG_REQ(D_RPCTRACE, req, "op: %d disposition: %x, status: %d",
@@ -633,7 +633,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
body = req_capsule_server_get(pill, &RMF_MDT_BODY);
if (body == NULL) {
- CERROR ("Can't swab mdt_body\n");
+ CERROR("Can't swab mdt_body\n");
return -EPROTO;
}
@@ -678,6 +678,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
*/
if ((it->it_op & IT_OPEN) && req->rq_replay) {
void *lmm;
+
if (req_capsule_get_size(pill, &RMF_EADATA,
RCL_CLIENT) <
body->eadatasize)
@@ -777,25 +778,29 @@ static int mdc_finish_enqueue(struct obd_export *exp,
int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
struct lookup_intent *it, struct md_op_data *op_data,
struct lustre_handle *lockh, void *lmm, int lmmsize,
- struct ptlrpc_request **reqp, __u64 extra_lock_flags)
+ struct ptlrpc_request **reqp, u64 extra_lock_flags)
{
- struct obd_device *obddev = class_exp2obd(exp);
- struct ptlrpc_request *req = NULL;
- __u64 flags, saved_flags = extra_lock_flags;
- int rc;
- struct ldlm_res_id res_id;
- static const ldlm_policy_data_t lookup_policy =
- { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
- static const ldlm_policy_data_t update_policy =
- { .l_inodebits = { MDS_INODELOCK_UPDATE } };
- static const ldlm_policy_data_t layout_policy =
- { .l_inodebits = { MDS_INODELOCK_LAYOUT } };
+ static const ldlm_policy_data_t lookup_policy = {
+ .l_inodebits = { MDS_INODELOCK_LOOKUP }
+ };
+ static const ldlm_policy_data_t update_policy = {
+ .l_inodebits = { MDS_INODELOCK_UPDATE }
+ };
+ static const ldlm_policy_data_t layout_policy = {
+ .l_inodebits = { MDS_INODELOCK_LAYOUT }
+ };
static const ldlm_policy_data_t getxattr_policy = {
- .l_inodebits = { MDS_INODELOCK_XATTR } };
+ .l_inodebits = { MDS_INODELOCK_XATTR }
+ };
ldlm_policy_data_t const *policy = &lookup_policy;
- int generation, resends = 0;
- struct ldlm_reply *lockrep;
- enum lvb_type lvb_type = 0;
+ struct obd_device *obddev = class_exp2obd(exp);
+ struct ptlrpc_request *req;
+ u64 flags, saved_flags = extra_lock_flags;
+ struct ldlm_res_id res_id;
+ int generation, resends = 0;
+ struct ldlm_reply *lockrep;
+ enum lvb_type lvb_type = LVB_T_NONE;
+ int rc;
LASSERTF(!it || einfo->ei_type == LDLM_IBITS, "lock type %d\n",
einfo->ei_type);
@@ -939,7 +944,12 @@ resend:
memset(lockh, 0, sizeof(*lockh));
}
ptlrpc_req_finished(req);
+
+ it->d.lustre.it_lock_handle = 0;
+ it->d.lustre.it_lock_mode = 0;
+ it->d.lustre.it_data = NULL;
}
+
return rc;
}
@@ -1029,6 +1039,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
lock = ldlm_handle2lock(lockh);
if (lock) {
ldlm_policy_data_t policy = lock->l_policy_data;
+
LDLM_DEBUG(lock, "matching against this");
LASSERTF(fid_res_name_eq(&mdt_body->fid1,
@@ -1039,14 +1050,16 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
memcpy(&old_lock, lockh, sizeof(*lockh));
if (ldlm_lock_match(NULL, LDLM_FL_BLOCK_GRANTED, NULL,
- LDLM_IBITS, &policy, LCK_NL, &old_lock, 0)) {
+ LDLM_IBITS, &policy, LCK_NL,
+ &old_lock, 0)) {
ldlm_lock_decref_and_cancel(lockh,
it->d.lustre.it_lock_mode);
memcpy(lockh, &old_lock, sizeof(old_lock));
it->d.lustre.it_lock_handle = lockh->cookie;
}
}
- CDEBUG(D_DENTRY,"D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
+ CDEBUG(D_DENTRY,
+ "D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
op_data->op_namelen, op_data->op_name, ldlm_it2str(it->it_op),
it->d.lustre.it_status, it->d.lustre.it_disposition, rc);
return rc;
@@ -1223,7 +1236,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env,
if (rc < 0) {
CERROR("ldlm_cli_enqueue_fini: %d\n", rc);
mdc_clear_replay_flag(req, rc);
- GOTO(out, rc);
+ goto out;
}
lockrep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP);
@@ -1234,7 +1247,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env,
rc = mdc_finish_enqueue(exp, req, einfo, it, lockh, rc);
if (rc)
- GOTO(out, rc);
+ goto out;
rc = mdc_finish_intent_lock(exp, req, &minfo->mi_data, it, lockh);