Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp408039imm; Thu, 6 Sep 2018 04:33:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbqdN5d0RfWZnmUnpKg+ZtggWapYlKGyXyE9U4l3SEJi1rXKtqOuqac/AxN8jfDhAN79BIm X-Received: by 2002:a63:3741:: with SMTP id g1-v6mr2263687pgn.59.1536233590298; Thu, 06 Sep 2018 04:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536233590; cv=none; d=google.com; s=arc-20160816; b=yh4q9CA3885vazbE7tYtk9ZsM7Mwk+ni0WX04enJwKk7OiTMIowbr3dphlq5RZf4l8 uNUlyYomxgrn0co7cqN6KB/bIkN3PAwpDyfn4jbNiTSybn1DXlcBRYGk+e21609YKE6A ZF2D2hTQVBbBrIh6SOd8fmxRXttU2yGiNyVNKcACUS/fDegO2m1OWBnF9KiVDp4ArFka zFNtXWNflJKwYURQhU4xLLx2tAMD42n+j0lkQtIQS+GSFyWotgIHpranVcWvfqblk20J Pz5svUTcnrh6dE5cSSuH+I9eU3l/Io9tFAdJjPnIWFGphMzkny5aNqRVSa20RD3xgDKe ck7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=/9PVwQQqUAh+RndXsAQjHm/1uY1IZVKam0kY8UJVbmA=; b=UumuW+s5Qoz4oCBMhEjiX3UwlaU950zfl26voC4Ywv4r4BqRSLVaLjc1ZkpZvtlcnt DyhWEcSGpQ6lysyhamKcx3DB5ONUejHfe6aLCuGUystHqeZoUD5WNFCqX0/YmYaIsFIo +oeq/b6ZGUapvQHNxmd9zGTs6btWSXzEYyp4lAJvCjwIDCvGlqZ6VRFD3nZNY03QpNxH 9ZZmY3RKX1xuJ/QIBSCyoUEvaZHHBD4w5vGdYNLqQOIQsBKqqJ135BhgMxnpSfUJjny7 0mAoOHNLsHBXecVvySdzYaoC06Exoz9YxTKvxnyEQyPhNcrQNa+emY3mfXbH/M1lcwHt hlzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r130-v6si4672843pgr.456.2018.09.06.04.32.54; Thu, 06 Sep 2018 04:33:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727700AbeIFQBM (ORCPT + 99 others); Thu, 6 Sep 2018 12:01:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39912 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725919AbeIFQBM (ORCPT ); Thu, 6 Sep 2018 12:01:12 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BAD53401BF62; Thu, 6 Sep 2018 11:26:11 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 018EE2027EA0; Thu, 6 Sep 2018 11:26:09 +0000 (UTC) From: Vitaly Kuznetsov To: xen-devel@lists.xenproject.org Cc: linux-kernel@vger.kernel.org, Boris Ostrovsky , Juergen Gross , Wei Liu Subject: [PATCH] xen/manage: don't complain about an empty value in control/sysrq node Date: Thu, 6 Sep 2018 13:26:08 +0200 Message-Id: <20180906112608.4221-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 06 Sep 2018 11:26:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 06 Sep 2018 11:26:11 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When guest receives a sysrq request from the host it acknowledges it by writing '\0' to control/sysrq xenstore node. This, however, make xenstore watch fire again but xenbus_scanf() fails to parse empty value with "%c" format string: sysrq: SysRq : Emergency Sync Emergency Sync complete xen:manage: Error -34 reading sysrq code in control/sysrq Ignore -ERANGE the same way we already ignore -ENOENT, empty value in control/sysrq is totally legal. Signed-off-by: Vitaly Kuznetsov --- This is a follow-up to my Xen toolstack patch: https://lists.xenproject.org/archives/html/xen-devel/2018-09/msg00266.html without it we're seeing -EPERM on write and the issue I'm trying to address here stays hidden. --- drivers/xen/manage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index c93d8ef8df34..5bb01a62f214 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -280,9 +280,11 @@ static void sysrq_handler(struct xenbus_watch *watch, const char *path, /* * The Xenstore watch fires directly after registering it and * after a suspend/resume cycle. So ENOENT is no error but - * might happen in those cases. + * might happen in those cases. ERANGE is observed when we get + * an empty value (''), this happens when we acknowledge the + * request by writing '\0' below. */ - if (err != -ENOENT) + if (err != -ENOENT && err != -ERANGE) pr_err("Error %d reading sysrq code in control/sysrq\n", err); xenbus_transaction_end(xbt, 1); -- 2.14.4