From patchwork Wed Jun 20 14:34:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139353 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp867630lji; Wed, 20 Jun 2018 07:35:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLdYlIOIjaRBPYnkRnrch5Aup1xGSkhFMeO3r0afSoMwquKvDXT8dG19L6vfhubHsYrWfN7 X-Received: by 2002:a62:d97:: with SMTP id 23-v6mr23272476pfn.202.1529505321503; Wed, 20 Jun 2018 07:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529505321; cv=none; d=google.com; s=arc-20160816; b=sFrOtCFiCBjGgb0g6FKKlT0q5KfuuHuES2TVNu0E/3F6iUZgRRdJcDXgL54anOXUsD DBZxDP3WWNyjz84mb/+j4WOCmq36k752gXQNPTHY/WUbvmhT6lR1lXrm7WFEmq1aGL2w HiRprPizuew9FTlJtwvJSdk4A1rXk+CMEZ+9LFnWvbI6V0Eyt6AlzXuUm6HgA2Ocy3El uHdHfAjzDIVCq/Kxkd/AOEB0WJ5s/5B2Z5baU42KD3RQrAR7svk+z+yCHBMRkrarzoKJ TZMxbC5Hnw+TPZjA1uYuYS+klDa0UUnxADND17OvaXcyYfyACHZPUoqP9pkEyHf+KQ4K wy0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Mq1cnzK0EW9w6NodfoTkwbfMFy9Z9SZW9jG8aVVR9F8=; b=whq/hdvvHPk50+57xA55pjjHxHTfT6hd8rW5vdsg9zCUBmRAtDg4vcgHqoBylaaHC8 BpldgFPcCK31xhwzprIHndXPopPyyBdsyPvwRNoX45QBI7IgvtKmFsYcQFybxxqUpo3Y cJHlhwNlHK3DmR5NQUEdiTiSZ52pkFf+AVqiyk45+EeWtSXGKB5huUU/o9QFfJDFOPRy qkF2jo/4RGZ5Ohetq/cYoL88OPZXAD3+Bd2knQyAKN88XlyHUdQAGJxTcTRX5nV02Yu0 hqbfy7o2k+Ej1PN+uqEy5WeDQ8F2QE13KprQkPwvYmj4yxb99tIBP77KWk+1UgQVS2l2 vsYg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9-v6si2038912pgp.591.2018.06.20.07.35.21; Wed, 20 Jun 2018 07:35:21 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754166AbeFTOfT (ORCPT + 30 others); Wed, 20 Jun 2018 10:35:19 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:58661 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752856AbeFTOfR (ORCPT ); Wed, 20 Jun 2018 10:35:17 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MYLUv-1fj2M40HXl-00V8Vn; Wed, 20 Jun 2018 16:35:05 +0200 From: Arnd Bergmann To: Chris Mason , Josef Bacik , David Sterba Cc: y2038@lists.linaro.org, Arnd Bergmann , Anand Jain , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] btrfs: use 64-bit timestamps for struct btrfs_dev_replace_item Date: Wed, 20 Jun 2018 16:34:33 +0200 Message-Id: <20180620143448.44388-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180620143448.44388-1-arnd@arndb.de> References: <20180620143448.44388-1-arnd@arndb.de> X-Provags-ID: V03:K1:qfBHUeRe4dB1qRa0S8jd7SDPMnKRIt5xHOzntFHibu3uJJnuumo dy1cfElifhdyVTuiBRwrnxczzmZuiGythjLwCX5g1kg9vnaBc0CkTOqemChQfoXpgnZJhdm YlZun5zb1P2RszmzszGwwsMKn60eeTxec5wAYC4R/GASm38apvu3bfo6L8W8rUqKNVEOcqP nI0RPqttcwynVrfp5rZKA== X-UI-Out-Filterresults: notjunk:1; V01:K0:fUHJ0lXFL10=:FWCl/lSF8JKMqWaDusUkvr 9PsJlcSmk0BZDDxETliIT1yvXRgryKtrHY2d3GXw54SmKl+x3hhtd5vV6cX4UiPfhPD4ZKki3 LDoybKt3DZLvm2v9ywNv4Ygh8d3TxUgeSjOJLn9RiHJ3N5JUF26k7V4kVVnsU4cLMhd1k/cHB EWZQkkk858Het2XJ6eIaCW27jgs6etAAykjgXSrv7e9T9x7JhqSpQ4XYFPtRswNGMtKktJ1xF Pf2fP6GszBXKkqCtalmvsilxbIaVkMuibh504QaYIykCOlMikKnA/dpkv4d9F3e4++GMR4+xu Ardgs1f6h+TFe96DKbuibeaxozKlfP1gH1/JtVTT09D2pdcjzv6334uCMa6qRH4TKTas8XnOE a2PasnvcZh4l4+gF7xJiX2LHnRUWHErMk5QPgtSeUx9zi0wjtGb8Hg5HSUczfYdGjNn/r+LoK vCAwv39WeZ6QtkwoqMJ7RQwq34dIIW84Ovd7rDPPjfwFLPEiP88vwMb9Vz2lHX9j+e2Hw+z4i kq70RNBftXHB5orSV0uynuXFDShRhQy77e4g2xtsHIrmkmRQ9F5VaEF2XVMPPd3yAE/hqHnCd 0Z7+B0Gaj8IkfyADcno9HrtsIpmARQTaakGp7wFcAGLNox9fZQGjvwqvugjUvzw4RNlZP+Nx/ 1W1Hrrz2EALG8X17euunFRFcnPFhZZgFoo/gMm69/LHaMoJscXj+03QQJwDsFAyQo9lM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The structure already has 64-bit fields for the timestamps, but calling get_seconds() may truncate and risk overflow on 32-bit architectures. This changes the dev-replace code to use ktime_get_real_seconds() instead, which always returns 64-bit timestamps. Signed-off-by: Arnd Bergmann --- fs/btrfs/dev-replace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index e2ba0419297a..1b30c38d05c9 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -465,7 +465,7 @@ int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, * go to the tgtdev as well (refer to btrfs_map_block()). */ dev_replace->replace_state = BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED; - dev_replace->time_started = get_seconds(); + dev_replace->time_started = ktime_get_real_seconds(); dev_replace->cursor_left = 0; dev_replace->committed_cursor_left = 0; dev_replace->cursor_left_last_write_of_item = 0; @@ -618,7 +618,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, : BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED; dev_replace->tgtdev = NULL; dev_replace->srcdev = NULL; - dev_replace->time_stopped = get_seconds(); + dev_replace->time_stopped = ktime_get_real_seconds(); dev_replace->item_needs_writeback = 1; /* replace old device with new one in mapping tree */ @@ -807,7 +807,7 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) break; } dev_replace->replace_state = BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED; - dev_replace->time_stopped = get_seconds(); + dev_replace->time_stopped = ktime_get_real_seconds(); dev_replace->item_needs_writeback = 1; btrfs_dev_replace_write_unlock(dev_replace); btrfs_scrub_cancel(fs_info); @@ -848,7 +848,7 @@ void btrfs_dev_replace_suspend_for_unmount(struct btrfs_fs_info *fs_info) case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED: dev_replace->replace_state = BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; - dev_replace->time_stopped = get_seconds(); + dev_replace->time_stopped = ktime_get_real_seconds(); dev_replace->item_needs_writeback = 1; btrfs_info(fs_info, "suspending dev_replace for unmount"); break;