Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-2835 ptlrpc: Fix race during exp_flock_hash creation
[fs/lustre-release.git]
/
lustre
/
ldlm
/
ldlm_flock.c
diff --git
a/lustre/ldlm/ldlm_flock.c
b/lustre/ldlm/ldlm_flock.c
index
5b40b3e
..
a765cc7
100644
(file)
--- a/
lustre/ldlm/ldlm_flock.c
+++ b/
lustre/ldlm/ldlm_flock.c
@@
-100,20
+100,12
@@
ldlm_flocks_overlap(struct ldlm_lock *lock, struct ldlm_lock *new)
lock->l_policy_data.l_flock.start));
}
lock->l_policy_data.l_flock.start));
}
-static inline
int
ldlm_flock_blocking_link(struct ldlm_lock *req,
- struct ldlm_lock *lock)
+static inline
void
ldlm_flock_blocking_link(struct ldlm_lock *req,
+
struct ldlm_lock *lock)
{
{
- int rc = 0;
-
/* For server only */
if (req->l_export == NULL)
/* For server only */
if (req->l_export == NULL)
- return 0;
-
- if (unlikely(req->l_export->exp_flock_hash == NULL)) {
- rc = ldlm_init_flock_export(req->l_export);
- if (rc)
- goto error;
- }
+ return;
LASSERT(cfs_hlist_unhashed(&req->l_exp_flock_hash));
LASSERT(cfs_hlist_unhashed(&req->l_exp_flock_hash));
@@
-126,8
+118,6
@@
static inline int ldlm_flock_blocking_link(struct ldlm_lock *req,
cfs_hash_add(req->l_export->exp_flock_hash,
&req->l_policy_data.l_flock.owner,
&req->l_exp_flock_hash);
cfs_hash_add(req->l_export->exp_flock_hash,
&req->l_policy_data.l_flock.owner,
&req->l_exp_flock_hash);
-error:
- return rc;
}
static inline void ldlm_flock_blocking_unlink(struct ldlm_lock *req)
}
static inline void ldlm_flock_blocking_unlink(struct ldlm_lock *req)
@@
-258,7
+248,6
@@
ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq,
int overlaps = 0;
int splitted = 0;
const struct ldlm_callback_suite null_cbs = { NULL };
int overlaps = 0;
int splitted = 0;
const struct ldlm_callback_suite null_cbs = { NULL };
- int rc;
ENTRY;
CDEBUG(D_DLMTRACE, "flags %#llx owner "LPU64" pid %u mode %u start "
ENTRY;
CDEBUG(D_DLMTRACE, "flags %#llx owner "LPU64" pid %u mode %u start "
@@
-337,12
+326,8
@@
reprocess:
/* add lock to blocking list before deadlock
* check to prevent race */
/* add lock to blocking list before deadlock
* check to prevent race */
- rc = ldlm_flock_blocking_link(req, lock);
- if (rc) {
- ldlm_flock_destroy(req, mode, *flags);
- *err = rc;
- RETURN(LDLM_ITER_STOP);
- }
+ ldlm_flock_blocking_link(req, lock);
+
if (ldlm_flock_deadlock(req, lock)) {
ldlm_flock_blocking_unlink(req);
ldlm_flock_destroy(req, mode, *flags);
if (ldlm_flock_deadlock(req, lock)) {
ldlm_flock_blocking_unlink(req);
ldlm_flock_destroy(req, mode, *flags);
@@
-862,6
+847,9
@@
static cfs_hash_ops_t ldlm_export_flock_ops = {
int ldlm_init_flock_export(struct obd_export *exp)
{
int ldlm_init_flock_export(struct obd_export *exp)
{
+ if( strcmp(exp->exp_obd->obd_type->typ_name, LUSTRE_MDT_NAME) != 0)
+ RETURN(0);
+
exp->exp_flock_hash =
cfs_hash_create(obd_uuid2str(&exp->exp_client_uuid),
HASH_EXP_LOCK_CUR_BITS,
exp->exp_flock_hash =
cfs_hash_create(obd_uuid2str(&exp->exp_client_uuid),
HASH_EXP_LOCK_CUR_BITS,