Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6548740ybv; Wed, 12 Feb 2020 14:37:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwA2azVZHlkOuU60gh35Scmg/mLo3lbSAJipfV5Z6j60akcFPnZMTY7PpKHNl7dWmADUzvK X-Received: by 2002:a9d:d0b:: with SMTP id 11mr11537692oti.287.1581547056497; Wed, 12 Feb 2020 14:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581547056; cv=none; d=google.com; s=arc-20160816; b=bPpLxWghtUpOXTMMqJIqNg1YA5SfPScDm4/wyplVcAuUgouARmpmZEnQO+qu5Sxnru yAvBEEuubzAJ7e7PdYKKuFD9TpIwE3iQRLBdQN1L7naf/GDAG/LOTLcVSD+abhspb+km RNZxPJrbL4rdaGbd+5XXlsCbjl20bvfExDbmL0UUX0VOMbniyNan9Xy9BQg3oO9TJTTq f5bJB/49V2Jyy5ZJu+qY29PKRLyKhJc2ZJr3Vwcxp7bux4I0EO8N7/W1TvkR3jeeiuLM 94smdJi6f4pbbNMgrOj5LR23pZneS8sJRVX0EcMFK/VhwnYSH2nJNoG5wyD+kkkGbBIL LSEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:ironport-sdr :dkim-signature; bh=ZcT5NL3HFOPFbym2IiAARR+k8Y7xo5J+zpygwD2ALWc=; b=am6usOt1nephoz6P+7/Pzwh2JzezEdXyHgF0flKsZD5w4dKmS6lnfCaP1J23RHOyHQ J+R1Onz1Wfgz+zZkWMC6yIreISvGk5aEeCcypS+mpkGVs8wkgKH7/RRZoIVB3ZLf0zwc gDZVcs/ntf8iDUqbxuezQfhKG3c9ieOpq9/XaLWfU3IKzaGzndxElz5zj4tMKfjjmbly pWJCS+ELa0TUEYefrCskH8pWrhNuD0odq3eHZAs9f2KGQnVjcbqcQQsXqzoOvWjCSbWG sUJ7SyFSGe+lB79wdwTXk/bt8L3nQz/KYycxgpnRs9+egG5LEwjKcRkGcqiqfLnQ1x5Q 7u5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=OBTbLSy3; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si81925oti.306.2020.02.12.14.37.24; Wed, 12 Feb 2020 14:37:36 -0800 (PST) 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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=OBTbLSy3; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729226AbgBLWgX (ORCPT + 99 others); Wed, 12 Feb 2020 17:36:23 -0500 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:14698 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727947AbgBLWgX (ORCPT ); Wed, 12 Feb 2020 17:36:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1581546982; x=1613082982; h=date:from:to:subject:message-id:mime-version; bh=ZcT5NL3HFOPFbym2IiAARR+k8Y7xo5J+zpygwD2ALWc=; b=OBTbLSy3uAILFo/AKR2w77FqbxDrXMS0XsBY6hCNboXUgPEOEGQNiojN SCwczM2RxJ+CFTGBy0emzyV8tgXCjP1eSguAFPoShKCMJfUGE4RQM2WHq VAWYow1x5lP0lQ1mJ5nFZM2r1AscK5HPOUGEbwBI/HnVOi6pEYW1RWLZv M=; IronPort-SDR: RuG58dnJ7bK0jmVNwi+pnsRoVw06xDHGaPsu5B6jHAddTjNNYzGJxuu6rUzhRt+WNLOPfopBFM 6yF3lWoXEQ8Q== X-IronPort-AV: E=Sophos;i="5.70,434,1574121600"; d="scan'208";a="16854725" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1e-c7c08562.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 12 Feb 2020 22:36:22 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1e-c7c08562.us-east-1.amazon.com (Postfix) with ESMTPS id 910E62427DA; Wed, 12 Feb 2020 22:36:14 +0000 (UTC) Received: from EX13D01UWB002.ant.amazon.com (10.43.161.136) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 12 Feb 2020 22:35:52 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13d01UWB002.ant.amazon.com (10.43.161.136) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 12 Feb 2020 22:35:52 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 12 Feb 2020 22:35:52 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id 28812400D1; Wed, 12 Feb 2020 22:35:52 +0000 (UTC) Date: Wed, 12 Feb 2020 22:35:52 +0000 From: Anchal Agarwal To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC PATCH v3 12/12] PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA Message-ID: <20200212223552.GA4609@dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aleksei Besogonov The SNAPSHOT_SET_SWAP_AREA is supposed to be used to set the hibernation offset on a running kernel to enable hibernating to a swap file. However, it doesn't actually update the swsusp_resume_block variable. As a result, the hibernation fails at the last step (after all the data is written out) in the validation of the swap signature in mark_swapfiles(). Before this patch, the command line processing was the only place where swsusp_resume_block was set. Signed-off-by: Aleksei Besogonov Signed-off-by: Munehisa Kamata Signed-off-by: Anchal Agarwal --- Changes since V2: None --- kernel/power/user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/power/user.c b/kernel/power/user.c index 77438954cc2b..d396e313cb7b 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -374,8 +374,12 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, if (swdev) { offset = swap_area.offset; data->swap = swap_type_of(swdev, offset, NULL); - if (data->swap < 0) + if (data->swap < 0) { error = -ENODEV; + } else { + swsusp_resume_device = swdev; + swsusp_resume_block = offset; + } } else { data->swap = -1; error = -EINVAL; -- 2.24.1.AMZN