# open intent should update default EA size
# see mdc_update_max_ea_from_body()
# notice this is the very first RPC to MDS2
- cp /etc/services $DIR/$tdir/mds2 ||
- error "Failed to copy files to mds$n"
+ out=$(cp /etc/services $DIR/$tdir/mds2 2>&1)
+ ret=$?
+ echo $out
+ # With SSK, this situation can lead to -EPERM being returned.
+ # In that case, simply retry.
+ if [ $ret -ne 0 ] && $SHARED_KEY; then
+ if echo "$out" | grep -q "not permitted"; then
+ cp /etc/services $DIR/$tdir/mds2
+ ret=$?
+ fi
+ fi
+ [ $ret -eq 0 ] || error "Failed to copy files to mds$n"
}
run_test 820 "update max EA from open intent"
if (param.status) {
logmsg(LL_ERR, "status: %ld (%s)\n",
param.status, strerror((int)(-param.status)));
-
- /* kernel return -ETIMEDOUT means the rpc timedout, we should
- * notify the caller to reinitiate the gss negotiation, by
- * returning -ERESTART
- */
- if (param.status == -ETIMEDOUT)
- rc = -ERESTART;
- else
- rc = param.status;
- return rc;
+ return param.status;
}
p = (unsigned int *)outbuf;
if (lnd->lnd_rpc_err) {
logmsg(LL_ERR, "negotiation rpc error: %d\n",
lnd->lnd_rpc_err);
- return -1;
+ return lnd->lnd_rpc_err;
}
if (gr.gr_major != GSS_S_COMPLETE &&
logmsg(LL_ERR, "negotiation gss error %x\n",
lnd->lnd_gss_err);
- return -1;
+ return -ENOTCONN;
}
if (gr.gr_ctx.length != 0) {
struct keyring_upcall_param *kup,
int req_fd[2], int reply_fd[2])
{
- struct lgss_nego_data lnd;
- OM_uint32 min_stat;
- int rc = -1;
-
- memset(&lnd, 0, sizeof(lnd));
+ struct lgss_nego_data lnd;
+ OM_uint32 min_stat;
+ int rc = -1;
+ bool redo = true;
if (lgss_get_service_str(&g_service, kup->kup_svc, kup->kup_nid)) {
logmsg(LL_ERR, "key %08x: failed to construct service "
goto out_cred;
}
+retry_nego:
+ memset(&lnd, 0, sizeof(lnd));
if (lgssc_init_nego_data(&lnd, kup, cred->lc_mech->lmt_mech_n)) {
logmsg(LL_ERR, "key %08x: failed to initialize "
"negotiation data\n", keyid);
}
rc = lgssc_negotiation(&lnd, req_fd, reply_fd);
- if (rc) {
+ if (rc == -EAGAIN || (rc == -ETIMEDOUT && redo)) {
+ logmsg(LL_ERR, "Failed negotiation must retry\n");
+ redo = false;
+ goto retry_nego;
+ } else if (rc) {
logmsg(LL_ERR, "key %08x: failed to negotiation\n", keyid);
error_kernel_key(keyid, lnd.lnd_rpc_err, lnd.lnd_gss_err);
goto out;
struct keyring_upcall_param *kup,
int req_fd[2], int reply_fd[2])
{
- struct lgss_nego_data lnd;
- OM_uint32 min_stat;
- int rc;
-
-retry:
- memset(&lnd, 0, sizeof(lnd));
+ struct lgss_nego_data lnd;
+ OM_uint32 min_stat;
+ int rc;
+ bool redo = true;
rc = lgss_get_service_str(&g_service, kup->kup_svc, kup->kup_nid);
if (rc) {
goto out_cred;
}
+retry:
+ memset(&lnd, 0, sizeof(lnd));
rc = lgssc_init_nego_data(&lnd, kup, cred->lc_mech->lmt_mech_n);
if (rc) {
logmsg(LL_ERR, "key %08x: failed to initialize "
* update to the kernel key
*/
rc = lgssc_negotiation_manual(&lnd, cred, req_fd, reply_fd);
- if (rc == -EAGAIN) {
+ if (rc == -EAGAIN || (rc == -ETIMEDOUT && redo)) {
logmsg(LL_ERR, "Failed negotiation must retry\n");
+ redo = false;
goto retry;
-
} else if (rc) {
logmsg(LL_ERR, "key %08x: failed to negotiate\n", keyid);
error_kernel_key(keyid, lnd.lnd_rpc_err, lnd.lnd_gss_err);