* NL CR CW PR PW EX GROUP COS TXN
* NL 1 1 1 1 1 1 1 1 1
* CR 1 1 1 1 1 0 0 0 1
- * CW 1 1 1 0 0 0 0 0 1
+ * CW 1 1 1 0 0 0 0 0 0
* PR 1 1 0 1 0 0 0 0 1
* PW 1 1 0 0 0 0 0 0 0
* EX 1 0 0 0 0 0 0 0 0
* GROUP 1 0 0 0 0 0 1 0 0
* COS 1 0 0 0 0 0 0 1 0
- * TXN 1 1 1 1 0 0 0 0 1
+ * TXN 1 1 0 1 0 0 0 0 1
* </PRE>
*/
/** @{ */
#define LCK_COMPAT_EX LCK_NL
#define LCK_COMPAT_PW (LCK_COMPAT_EX | LCK_CR)
#define LCK_COMPAT_PR (LCK_COMPAT_PW | LCK_PR | LCK_TXN)
-#define LCK_COMPAT_CW (LCK_COMPAT_PW | LCK_CW | LCK_TXN)
+#define LCK_COMPAT_CW (LCK_COMPAT_PW | LCK_CW)
#define LCK_COMPAT_CR (LCK_COMPAT_CW | LCK_PR | LCK_PW | LCK_TXN)
#define LCK_COMPAT_NL (LCK_COMPAT_CR | LCK_EX | LCK_GROUP | LCK_COS)
#define LCK_COMPAT_GROUP (LCK_NL | LCK_GROUP)
#define LCK_COMPAT_COS (LCK_NL | LCK_COS)
-#define LCK_COMPAT_TXN (LCK_COMPAT_PR | LCK_CW)
+#define LCK_COMPAT_TXN LCK_COMPAT_PR
/** @} Lock Compatibility Matrix */
extern enum ldlm_mode lck_compat_array[];
mdt_lock_pdo_mode(info, obj, lh);
if (lh->mlh_pdo_mode != LCK_NL) {
if (pdo_lock) {
- rc = mdt_fid_lock(info->mti_env, ns, &lh->mlh_pdo_lh,
- lh->mlh_pdo_mode, policy, res_id,
- dlmflags, cookie);
+ if (mdt_object_remote(obj)) {
+ rc = mdt_remote_object_lock_try(info, obj,
+ &lh->mlh_pdo_lh, lh->mlh_pdo_mode,
+ policy, res_id, false);
+ lh->mlh_pdo_remote = 1;
+ } else {
+ rc = mdt_fid_lock(info->mti_env, ns,
+ &lh->mlh_pdo_lh, lh->mlh_pdo_mode,
+ policy, res_id, dlmflags, cookie);
+ }
if (rc) {
mdt_object_unlock(info, obj, lh, 1);
return rc;
res_id->name[LUSTRE_RES_ID_HSH_OFF] = lh->mlh_pdo_hash;
}
- rc = mdt_fid_lock(info->mti_env, ns, &lh->mlh_reg_lh, lh->mlh_reg_mode,
- policy, res_id, dlmflags, cookie);
+ if (mdt_object_remote(obj))
+ rc = mdt_remote_object_lock_try(info, obj, &lh->mlh_rreg_lh,
+ lh->mlh_rreg_mode, policy, res_id, false);
+ else
+ rc = mdt_fid_lock(info->mti_env, ns, &lh->mlh_reg_lh,
+ lh->mlh_reg_mode, policy, res_id, dlmflags, cookie);
if (rc)
mdt_object_unlock(info, obj, lh, 1);
else if (CFS_FAIL_PRECHECK(OBD_FAIL_MDS_PDO_LOCK) &&
/**
* take parent UPDATE lock
*
- * if parent is local, take PDO lock by name hash, otherwise take regular lock.
+ * if parent is local or mode is LCK_PW, take PDO lock, otherwise take regular
+ * lock.
*
* \param info struct mdt_thread_info
* \param obj parent object
ENTRY;
LASSERT(obj && lname);
- if (mdt_object_remote(obj)) {
+ LASSERT(mode == LCK_PW || mode == LCK_PR);
+ if (mdt_object_remote(obj) && mode == LCK_PR) {
__u64 ibits = MDS_INODELOCK_UPDATE;
mdt_lock_reg_init(lh, mode);
{
ENTRY;
- mdt_save_lock(info, &lh->mlh_pdo_lh, lh->mlh_pdo_mode, decref);
+ if (lh->mlh_pdo_remote)
+ mdt_save_remote_lock(info, o, &lh->mlh_pdo_lh,
+ lh->mlh_pdo_mode, decref);
+ else
+ mdt_save_lock(info, &lh->mlh_pdo_lh, lh->mlh_pdo_mode, decref);
mdt_save_lock(info, &lh->mlh_reg_lh, lh->mlh_reg_mode, decref);
mdt_save_remote_lock(info, o, &lh->mlh_rreg_lh, lh->mlh_rreg_mode,
decref);
echo $1
echo " $2"
eval $2
-# bash -c "$2"
}
test_33c() {
mkdir_on_mdt0 $DIR/$tdir
sync_all_data
- op_trigger_solc "create remote dir and local dir" \
- "$LFS mkdir -i 1 $DIR/$tdir/remote" \
- "$LFS mkdir -i 0 $DIR/$tdir/local"
- (( MDSCOUNT > 2 )) &&
- op_trigger_solc "create remote dirs on different MDTs" \
- "$LFS mkdir -i 1 $DIR/$tdir/remote.1" \
- "$LFS mkdir -i 2 $DIR/$tdir/remote.2"
+ if (( MDS1_VERSION < $(version_code 2.15.55.204) )); then
+ op_trigger_solc "create remote dir and local dir" \
+ "$LFS mkdir -i 1 $DIR/$tdir/remote" \
+ "$LFS mkdir -i 0 $DIR/$tdir/local"
+ (( MDSCOUNT > 2 )) &&
+ op_trigger_solc "create remote dirs on different MDTs" \
+ "$LFS mkdir -i 1 $DIR/$tdir/remote.1" \
+ "$LFS mkdir -i 2 $DIR/$tdir/remote.2"
+ fi
op_trigger_solc "create file on 2nd stripe under striped directory" \
"$LFS mkdir -i 0 -c 2 $DIR/$tdir/striped" \
"touch $DIR2/$tdir/striped/subfile"
$LFS mkdir -i 0 -c 2 $DIR/$tdir/striped
sync_all_data
do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
- if (( MDS1_VERSION >= $(version_code 2.15.55.133) )); then
+ if (( MDS1_VERSION >= $(version_code 2.15.55.204) )); then
test_33_run "create file on 2nd stripe after setattr" \
"chmod 777 $DIR/$tdir/striped; \
touch $DIR2/$tdir/striped/subfile"
+ test_33_run "create remote dir and local dir" \
+ "$LFS mkdir -i 1 $DIR/$tdir/remote" \
+ "$LFS mkdir -i 0 $DIR/$tdir/local"
+ (( MDSCOUNT > 2 )) &&
+ test_33_run "create remote dirs on different MDTs" \
+ "$LFS mkdir -i 1 $DIR/$tdir/remote.1" \
+ "$LFS mkdir -i 2 $DIR/$tdir/remote.2"
fi
test_33_run "create local dir after remote dir creation transaction commit" \
"$LFS mkdir -i 1 $DIR/$tdir/remote.3; \