* Flag to indicate the LRU recalc on RPC reply is in progress.
* Used to limit the process by 1 thread only.
*/
- ns_rpc_recalc:1;
+ ns_rpc_recalc:1,
+
+ /* lru_size is set even before connection */
+ ns_lru_size_set_before_connection:1;
/**
* Which bucket should we start with the lock reclaim.
ldlm_ns_name(ns), ns->ns_max_unused,
(unsigned int)tmp);
+ /* This might be done even before connection from param setting
+ * config log, so it needs to be remembered to make sure
+ * LRU_SIZE is being set correctly in connection callback.
+ * See ptlrpc_connect_set_flags().
+ */
+ spin_lock(&ns->ns_lock);
+ if (ns->ns_connect_flags == 0)
+ ns->ns_lru_size_set_before_connection = 1;
+ spin_unlock(&ns->ns_lock);
+
/* Make sure that LRU resize was originally supported before
* turning it on here.
*/
CDEBUG(D_HA, "%s: Resetting ns_connect_flags to server flags: %#llx\n",
imp->imp_obd->obd_name,
ocd->ocd_connect_flags);
+
+ spin_lock(&ns->ns_lock);
ns->ns_connect_flags = (ns->ns_connect_flags & changed_flags) |
(ocd->ocd_connect_flags & ~changed_flags);
ns->ns_orig_connect_flags = ocd->ocd_connect_flags;
+ /* If lru_size has been set by param set configuration,
+ * then it should honor param set.
+ * if ns_max_unused is 0, then it means the param set actually
+ * set lru_size to 0, i.e. LRU_SIZE should be enabled or set by
+ * connection result; otherwise it should disable lru_resize.
+ * see lru_size_store().
+ */
+ if (ns_connect_lru_resize(ns) &&
+ ns->ns_lru_size_set_before_connection &&
+ ns->ns_max_unused != 0)
+ ns->ns_connect_flags &= ~OBD_CONNECT_LRU_RESIZE;
+
+ ns->ns_lru_size_set_before_connection = 0;
+ spin_unlock(&ns->ns_lock);
}
if (ocd->ocd_connect_flags & OBD_CONNECT_AT)
}
run_test 46a "handle ost additional - wide striped file"
-test_47() { #17674
+test_47a() { #17674
reformat
setup_noconfig
check_mount || error "check_mount failed"
fi
let count=count+1
done
+ cleanup || error "cleanup failed with $?"
+}
+run_test 47a "server restart does not lose lru_resize"
+
+test_47b() { #17833
+ local create_simple_link=false
+ reformat
+ setup_noconfig
+ check_mount || error "check_mount failed"
+
+ [[ -e /usr/sbin/lctl ]] || {
+ # Unfortunately set_param -P rely on the hardcoded path
+ # /usr/sbin/lctl
+ ln -s /usr/sbin/lctl $LCTL ||
+ skip_env "Can not create symlink /usr/sbin/lctl"
+ stack_trap "rm -f /usr/sbin/lctl"
+ }
+
+ do_facet mgs $LCTL \
+ set_param -P ldlm.namespaces.$FSNAME-*-mdc-*.lru_size=200
+ wait_update $HOSTNAME \
+ "$LCTL get_param -n ldlm.namespaces.$FSNAME-MDT0000-mdc-*.lru_size" \
+ "200"
+ umount $MOUNT || error "Unable to umount client"
+ mount_client $MOUNT || error "mount failed"
+ for ns in $($LCTL get_param ldlm.namespaces.$FSNAME*mdc*.lru_size); do
+ (( ${ns/*=/} == 200)) ||
+ error "${ns/=*/} is ${ns/*=/}, expect 200"
+ done
cleanup || error "cleanup failed with $?"
}
-run_test 47 "server restart does not make client loss lru_resize settings"
+run_test 47b "client restart does not lose lru_resize"
cleanup_48() {
trap 0