Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5818800imm; Tue, 12 Jun 2018 13:59:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKNsUYFcojhf8uI/GoDGUPofDnBHhw9JKC8GTHbrL6X+k16ENWzofUDDP6vYLUycTSNcuzh X-Received: by 2002:a63:304:: with SMTP id 4-v6mr1630361pgd.290.1528837167080; Tue, 12 Jun 2018 13:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528837167; cv=none; d=google.com; s=arc-20160816; b=lDP7S8yprVF8pApydXW/KQlXplCCA35wS8v7dMBkD4DutTEruda41HSkPzI+B01tMM muEcSypq69BLHmxC1E6sI/jCxyh74wgCOidgiv8eOe07f4wAoxmcmtImQxMGTeK4a1jd vKIA3+ZFpqGBafh4QJ7pRLeeOpZBIghy7Zcfe2gM7A8OvbE1C0QIPQew4pQDAEskpQmR CgKW7ZTR1UfxTP6JC6FO14gfkNnto0OlP362Rhu9fqZEBsADu0EL4pcHp4mN4CtJ/0yE Ur66jV6Uz2GNpDTOXQfHzBBpDNdpIP/8fwTOVvWoijoQG1aSOin9x6Mojsx9X+5maX8h 6gkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CaVNlSsvdiSt9FutpnLSEKRFgB42VECALAbNL5pFElw=; b=XMPEeNmsEfxNLn6sEn115644XIBlJfQ/yw/t28FzOwhY6RdvLqSc3aStDVdggNlnpW XhrWaQmec55KarrcZAqBjejcah8CvURArY0OYMIgR5eERhrgJbWRkT+oxvkitswjj7ck +yr3J5I7hCr9nDAmRIVyD5O67zW9+SVieR0DzVB1v6Baqp/MbwjQtfEDYpK5TURDTK87 7bmhWGyhvdsyhTvxUgAYVOpVz8+Ozn5330sss3yhK6owsFZCMgqHPsu23t470JZND0lN T4w76GGo9vCzmrBc5sre+T1OBGQMDnASXIMrtcq0Su4GgLT1gy5nh0J1VjW10hYzKFHY KM0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=mT6tKf8Y; 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 a22-v6si975308plm.121.2018.06.12.13.59.12; Tue, 12 Jun 2018 13:59:27 -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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=mT6tKf8Y; 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 S934546AbeFLU4w (ORCPT + 99 others); Tue, 12 Jun 2018 16:56:52 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:46135 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934342AbeFLU4p (ORCPT ); Tue, 12 Jun 2018 16:56:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1528837005; x=1560373005; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=CaVNlSsvdiSt9FutpnLSEKRFgB42VECALAbNL5pFElw=; b=mT6tKf8YGb39dR1oqnseZTSoj4hq/EDdFS1ZtfKBBkV6qqTa3eRhuD2E FpdZ/dO67uEBg7Y8MJtr0RLMJ8xuxxgJ0wzTc4uTUSxzL0ySyoZDKLqry mc1avbTCefZwdS0RkIRsnYUkeIJ4kQaXU0hSocvGQj1bUldPsRLV4txSC 0=; X-IronPort-AV: E=Sophos;i="5.51,216,1526342400"; d="scan'208";a="347699308" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-55156cd4.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Jun 2018 20:56:42 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-55156cd4.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w5CKueZq017015 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 12 Jun 2018 20:56:42 GMT Received: from EX13D05UWB003.ant.amazon.com (10.43.161.26) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:39 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D05UWB003.ant.amazon.com (10.43.161.26) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:39 +0000 Received: from localhost (10.25.15.63) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 12 Jun 2018 20:56:39 +0000 From: Anchal Agarwal To: , , , CC: , , , , , , , , , , , , , , , , , Subject: [RFC PATCH 12/12] PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA Date: Tue, 12 Jun 2018 20:56:19 +0000 Message-ID: <20180612205619.28156-13-anchalag@amazon.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180612205619.28156-1-anchalag@amazon.com> References: <20180612205619.28156-1-anchalag@amazon.com> MIME-Version: 1.0 Content-Type: text/plain 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 Reviewed-by: Munehisa Kamata Reviewed-by: Eduardo Valentin --- 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 abd2255..b522a42 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -379,8 +379,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.7.4