From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12A57C4740A for ; Sat, 5 Oct 2019 18:35:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2E21222C0 for ; Sat, 5 Oct 2019 18:35:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bpB09IzR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387884AbfJESf2 (ORCPT ); Sat, 5 Oct 2019 14:35:28 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43839 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387477AbfJESf2 (ORCPT ); Sat, 5 Oct 2019 14:35:28 -0400 Received: by mail-pg1-f194.google.com with SMTP id v27so5622869pgk.10 for ; Sat, 05 Oct 2019 11:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Tnbg8cbdnCoP/gLWy4NbGy+ltT6M9bJ9vhLYsPjZeS4=; b=bpB09IzRudsQGjBLurE7gSMeiYAucGWvoD2lXalBPZNhJinXtmtD0CTt0RypA2ZTcb gxG/1FsQDBCJSU/dDzZMkZMEAquvgR+K5CH1QjY7cNlOVyRiY1eDX8nd/ZPTh/9U7SB2 7DT/GU6tDQJTuMMw2OApkZ0b7ayN9SwHAwQOYB9quJTcVs552IvUPerxgOcCeyL6TtGD FIEue7tOT+NHjWUbgfGMuSo+uM6jCinejKWGLcbRThpBQlFMTPM8s+6wJFtNy8cQJO1c EgLKKvTiyvhPzvA0hugGd6IaBZ8DjSDjDA8ZlQVAF5R0MadEKLqQhauJcRYUy0QSo/ch U3vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Tnbg8cbdnCoP/gLWy4NbGy+ltT6M9bJ9vhLYsPjZeS4=; b=ESQnQddxADDa8ZdUJ/0X9RErKoPGau0TklV8DgH7Rr9xzWlpPx39VuuXJ/YiqHwjoS XdarKror5bumTbmi4TbJYAHuumsdUYTeDxZEe94TatdLwJiSUkJxJ0PpIbI/PCPPOS4f OopTSME+El69Fn3jxLfToxFfnODqrkm38o2m9Hi9kxNc3mqBxS05PKhNAWOTHsmT6VSv LC5jih53VyZcVwGhqzUooxyvEDA27vxeyRsvR4uElLHyhpcOqw8Co7Giotcr+qzDF8qR ilXypR9kun49t7I5zeCE2eVZGfri4QzUfadh6W0Z56O6ICCpPhWHb2+Hhh/mlOLLK9uF wiEA== X-Gm-Message-State: APjAAAU/rrKr9ZvmhoTnSXhQDip256zVIchGMyrRdSuolCxZCb3wu/vQ upacjWnQEza4fEb8lxuBpc8= X-Google-Smtp-Source: APXvYqzF/m5Yw7i3RKsbPAPV0z3TnGphBIu5W4izOFixYcp10bEcRtt5vz4gR4OoVrQEL6sENn3etw== X-Received: by 2002:a62:62c6:: with SMTP id w189mr24202548pfb.235.1570300527207; Sat, 05 Oct 2019 11:35:27 -0700 (PDT) Received: from localhost ([178.128.102.47]) by smtp.gmail.com with ESMTPSA id x72sm11800150pfc.89.2019.10.05.11.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2019 11:35:25 -0700 (PDT) Date: Sun, 6 Oct 2019 02:35:19 +0800 From: Eryu Guan To: Deepa Dinamani Cc: fstests@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: Re: [PATCH] generic/402: fix for updated behavior of timestamp limits Message-ID: <20191005183517.GE2622@desktop> References: <20190719041231.26500-1-deepa.kernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190719041231.26500-1-deepa.kernel@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org On Thu, Jul 18, 2019 at 09:12:31PM -0700, Deepa Dinamani wrote: > The mount behavior will not be altered because of the unsupported > timestamps on the filesystems. > > Adjust the test accordingly. Thanks for the heads-up about the merge of the fixes https://git.kernel.org/torvalds/c/cfb82e1df8b7c76991ea12958855897c2fb4debc > > An updated series to be posted after the merge window is hosted at > > > Signed-off-by: Deepa Dinamani > > --- > common/rc | 36 +++++++++--------- > tests/generic/402 | 87 ++++++++++++++++--------------------------- > tests/generic/402.out | 2 +- > 3 files changed, 53 insertions(+), 72 deletions(-) > > diff --git a/common/rc b/common/rc > index 25203bb4..39a2deb0 100644 > --- a/common/rc > +++ b/common/rc > @@ -1959,16 +1959,9 @@ _run_aiodio() > return $status > } > > -# this test requires y2038 sysfs switch and filesystem > -# timestamp ranges support. > -_require_y2038() > +_require_timestamp_range() > { > local device=${1:-$TEST_DEV} > - local sysfsdir=/proc/sys/fs/fs-timestamp-check-on > - > - if [ ! -e $sysfsdir ]; then > - _notrun "no kernel support for y2038 sysfs switch" > - fi > > local tsmin tsmax > read tsmin tsmax <<<$(_filesystem_timestamp_range $device) > @@ -1980,23 +1973,32 @@ _require_y2038() > _filesystem_timestamp_range() > { > local device=${1:-$TEST_DEV} > + u32max=$(((1<<32)-1)) > + s32min=-$((1<<31)) > + s32max=$(((1<<31)-1)) > + s64max=$(((1<<63)-1)) > + s64min=$((1<<63)) > + > case $FSTYP in > - ext4) > + ext2) > + echo "$s32min $s32max" > + ;; > + ext3|ext4) > if [ $(dumpe2fs -h $device 2>/dev/null | grep "Inode size:" | cut -d: -f2) -gt 128 ]; then > - echo "-2147483648 15032385535" > + printf "%d %d\n" $s32min 0x37fffffff > else > - echo "-2147483648 2147483647" > + echo "$s32min $s32max" > fi > ;; > > - xfs) > - echo "-2147483648 2147483647" > - ;; > jfs) > - echo "0 4294967295" > + echo "0 $u32max" > ;; > - f2fs) > - echo "-2147483648 2147483647" > + xfs) > + echo "$s32min $s32max" > + ;; > + btrfs) > + echo "$s64min $s64max" > ;; > *) > echo "-1 -1" > diff --git a/tests/generic/402 b/tests/generic/402 > index f742fedd..dd136ec2 100755 > --- a/tests/generic/402 > +++ b/tests/generic/402 > @@ -4,15 +4,10 @@ > # > # FS QA Test 402 > # > -# Tests to verify policy for filesystem timestamps for > -# supported ranges: > -# 1. Verify filesystem rw mount according to sysctl > -# timestamp_supported. > -# 2. Verify timestamp clamping for timestamps beyond max > -# timestamp supported. > +# Test to verify filesystem timestamps for supported ranges. > # > -# Exit status 1: either or both tests above fail. > -# Exit status 0: both the above tests pass. > +# Exit status 1: test failed. > +# Exit status 0: test passed. These exit status checks are not needed, please see below. > # > seq=`basename $0` > seqres=$RESULT_DIR/$seq > @@ -49,47 +44,59 @@ check_stat() > prev_timestamp="$timestamp;$timestamp" > if [ $prev_timestamp != $stat_timestamp ]; then > echo "$prev_timestamp != $stat_timestamp" | tee -a $seqres.full > + return 1 We already print error message on test failure, which will break the golden image, so there's no need to return 0 or 1. All similar checks and returns are not needed in other functions. Thanks, Eryu > fi > + return 0 > } > > run_test_individual() > { > + fail=0 > file=$1 > timestamp=$2 > update_time=$3 > > # check if the time needs update > if [ $update_time -eq 1 ]; then > - echo "Updating file: $file to timestamp `date -d @$timestamp`" >> $seqres.full > + echo "Updating file: $file to timestamp $timestamp" >> $seqres.full > $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file > if [ $? -ne 0 ]; then > echo "Failed to update times on $file" | tee -a $seqres.full > + fail=1 > fi > fi > > - tsclamp=$(($timestamp>$tsmax?$tsmax:$timestamp)) > - echo "Checking file: $file Updated timestamp is `date -d @$tsclamp`" >> $seqres.full > - check_stat $file $tsclamp > + tsclamp=$((timestamptsmax?tsmax:timestamp)) > + echo "Checking file: $file Updated timestamp is $tsclamp" >> $seqres.full > + if ! check_stat $file $tsclamp; then > + fail=1 > + fi > + return $fail > } > > run_test() > { > + fail=0 > update_time=$1 > > n=1 > > for TIME in "${TIMESTAMPS[@]}"; do > - run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time > + if ! run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time; then > + fail=1 > + fi > ((n++)) > done > + > + return $fail > } > > _scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed" > -_require_y2038 $SCRATCH_DEV > +_require_timestamp_range $SCRATCH_DEV > > read tsmin tsmax <<<$(_filesystem_timestamp_range $SCRATCH_DEV) > -echo min supported timestamp $tsmin $(date --date=@$tsmin) >> $seqres.full > -echo max supported timestamp $tsmax $(date --date=@$tsmax) >> $seqres.full > +echo min supported timestamp $tsmin >> $seqres.full > +echo max supported timestamp $tsmax >> $seqres.full > > # Test timestamps array > > @@ -97,45 +104,14 @@ declare -a TIMESTAMPS=( > $tsmin > 0 > $tsmax > + $((tsmax/2)) > $((tsmax+1)) > - 4294967295 > - 8589934591 > - 34359738367 > ) > > -# Max timestamp is hardcoded to Mon Jan 18 19:14:07 PST 2038 > -sys_tsmax=2147483647 > -echo "max timestamp that needs to be supported by fs for rw mount is" \ > - "$((sys_tsmax+1)) $(date --date=@$((sys_tsmax+1)))" >> $seqres.full > - > -read ts_check <<<$(cat /proc/sys/fs/fs-timestamp-check-on) > - > _scratch_mount > result=$? > > -if [ $ts_check -ne 0 ]; then > - echo "sysctl filesystem timestamp check is on" >> $seqres.full > - # check for mount failure if the minimum requirement for max timestamp > - # supported is not met. > - if [ $sys_tsmax -ge $tsmax ]; then > - if [ $result -eq 0 ]; then > - echo "mount test failed" | tee -a $seqres.full > - exit > - fi > - else > - if [ $result -ne 0 ]; then > - echo "failed to mount $SCRATCH_DEV" | tee -a $seqres.full > - exit > - fi > - fi > -else > - # if sysctl switch is off then mount should succeed always. > - echo "sysctl filesystem timestamp check is off" >> $seqres.full > - if [ $result -ne 0 ]; then > - echo "failed to mount $SCRATCH_DEV and timestamp check is off" >> $seqres.full > - exit > - fi > -fi > +status=0 > > # Begin test case 1 > echo "In memory timestamps update test start" >> $seqres.full > @@ -143,7 +119,9 @@ echo "In memory timestamps update test start" >> $seqres.full > # update time on the file > update_time=1 > > -run_test $update_time > +if ! run_test $update_time; then > + status=1 > +fi > > echo "In memory timestamps update complete" >> $seqres.full > > @@ -162,12 +140,13 @@ update_time=0 > echo "On disk timestamps update test start" >> $seqres.full > > # Re-run test > -run_test $update_time > +if ! run_test $update_time; then > + status=1 > +fi > > echo "On disk timestamps update test complete" >> $seqres.full > > -echo "y2038 inode timestamp tests completed successfully" > +echo "inode timestamp tests completed status $status" > > # success, all done > -status=0 > -exit > +exit $status > diff --git a/tests/generic/402.out b/tests/generic/402.out > index 6c5b9308..4500e6c7 100644 > --- a/tests/generic/402.out > +++ b/tests/generic/402.out > @@ -1,2 +1,2 @@ > QA output created by 402 > -y2038 inode timestamp tests completed successfully > +inode timestamp tests completed status 0 > -- > 2.17.1 >