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: 10477649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB0CE600F6 for ; Wed, 20 Jun 2018 14:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABCCD28F1E for ; Wed, 20 Jun 2018 14:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A087B28F2B; Wed, 20 Jun 2018 14:35:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5760528F1E for ; Wed, 20 Jun 2018 14:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754097AbeFTOfT (ORCPT ); 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-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;