struct md_attr *ma = &info->mti_attr;
__u64 open_flags = info->mti_spec.sp_cr_flags;
__u64 trybits = 0;
- enum ldlm_mode lm = LCK_CR;
+ enum ldlm_mode lm = LCK_PR;
bool acq_lease = !!(open_flags & MDS_OPEN_LEASE);
bool try_layout = false;
bool create_layout = false;
/* Return lookup lock to validate inode at the client side.
* This is pretty important otherwise MDT will return layout
* lock for each open.
- * However this is a double-edged sword because changing
- * permission will revoke a huge number of LOOKUP locks.
+ * Since trylocks are opportunistic now and we also have
+ * ability to selectively cancel lock bits from clients on conflict,
+ * we would also return other useful bits: PERM and UPDATE - both
+ * necessary to ensure subsequent stats from the client would not
+ * need to talk to us again. Historically speaking both permissions
+ * and other inode data rarely changes after creation anyway, so
+ * there should not be any downsides from doing it for normal
+ * operations now.
*/
if (!OBD_FAIL_CHECK(OBD_FAIL_MDS_NO_LL_OPEN) && try_layout) {
if (!(*ibits & MDS_INODELOCK_LOOKUP))
trybits |= MDS_INODELOCK_LOOKUP;
trybits |= MDS_INODELOCK_LAYOUT;
+ /* PERM|UPDATE ibits in CR mode don't make sense, since
+ * all modifications lock these ibits in PW mode.
+ * Don't lock UPDATE|PERM ibits upon PCC attach, otherwise
+ * PCC will be detached when these ibits are revoked.
+ */
+ if (lm != LCK_CR && !(open_flags & MDS_OPEN_PCC))
+ trybits |= MDS_INODELOCK_UPDATE | MDS_INODELOCK_PERM;
}
if (*ibits | trybits)
do_facet $SINGLEMDS $LCTL set_param fail_loc=0x0
umount_client $MOUNT || error "(2) umount failed"
+ stop mds1
+ start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
mount_client $MOUNT || error "(3) mount failed"
touch $DIR/$tdir/striped_dir/dummy ||
chattr -i $DIR/$tdir/striped_dir ||
error "(10) Fail to chattr on the broken striped directory"
+ rm -f $DIR/$tdir/striped_dir/dummy || error "(11) Fail to remove dummy"
+
+ # LFSCK again to regenerate master LMV
+ echo "Trigger namespace LFSCK to find out the inconsistency"
+ $START_NAMESPACE -r -A ||
+ error "(12) Fail to start LFSCK for namespace"
+
+ wait_all_targets_blocked namespace completed 6
+
+ # reload striped_dir to parse newly generated LMV
+ stop mds1
+ start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
+
rmdir $DIR/$tdir/striped_dir ||
- error "(11) Fail to remove the striped directory after LFSCK"
+ error "(13) Fail to remove the striped directory after LFSCK"
}
run_test 31d "Set broken striped directory (modified after broken) as read-only"
check_lpcc_state $file "readwrite"
do_facet $SINGLEAGT $RUNAS dd if=/dev/zero of=$file bs=1024 count=1 &&
error "non-root user can dd write to $file"
- chmod 777 $file || error "chmod 777 $file failed"
+ chmod 777 $DIR2/$tfile || error "chmod 777 $DIR2/$tfile failed"
do_facet $SINGLEAGT $RUNAS dd if=/dev/zero of=$file bs=1024 count=1 ||
error "non-root user cannot write $file with permission (777)"