From patchwork Fri May 5 17:24:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13232857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00D10C77B7F for ; Fri, 5 May 2023 17:24:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjEERYb (ORCPT ); Fri, 5 May 2023 13:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbjEERYb (ORCPT ); Fri, 5 May 2023 13:24:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58CB615EE8; Fri, 5 May 2023 10:24:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E8C9560C32; Fri, 5 May 2023 17:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBBDFC433EF; Fri, 5 May 2023 17:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683307469; bh=q+shlfQScJK1HgZP8bRzIfV3LK1GTqcBoyl3Ruu40rs=; h=From:To:Cc:Subject:Date:From; b=hRJqY22EO3jyfYEYkNxtNYBzd0+bzrnTM5q23kpuu4R4QPp5+0n33WdLZMhN68wFT 4+maCHV2gZBNZZ4hYGmjNUXwTt4fvTtus101bFbKQOgjM29vtgL5a9yzHd9GZUQJa7 Ex8Q2BUEwmdvWsjhxLG+ZJTmlMV2pBT/A2OnLjeQf4hU/21WMwq+YWdAnM1l8VVTKf gmjsQLbKZt4+zDMhdtw9ngsHb/HO2z40qTCwBvbyD4SC0Q1AfwJWG/Je3KrxISn0ZJ ACLTosJGov/auJtI43HqcujgMcKvhu0Ulb9Kcrj1RPFfw321eomau1l5UCjpb2mZhz 8soqOmGy3imKA== From: Anna Schumaker To: linux-nfs@vger.kernel.org, fstests@vger.kernel.org Cc: anna@kernel.org Subject: [PATCH v2] generic/728: Add a test for xattr ctime updates Date: Fri, 5 May 2023 13:24:27 -0400 Message-Id: <20230505172427.94963-1-anna@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker The NFS client wasn't updating ctime after a setxattr request. This is a test written while fixing the bug. Signed-off-by: Anna Schumaker --- v2: - Move test to generic/ - Address comments from the mailing list --- tests/generic/728 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/728.out | 2 ++ 2 files changed, 44 insertions(+) create mode 100755 tests/generic/728 create mode 100644 tests/generic/728.out diff --git a/tests/generic/728 b/tests/generic/728 new file mode 100755 index 000000000000..ab2414c151db --- /dev/null +++ b/tests/generic/728 @@ -0,0 +1,42 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023 Netapp Inc., All Rights Reserved. +# +# FS QA Test 728 +# +# Test a bug where the NFS client wasn't sending a post-op GETATTR to the +# server after setting an xattr, resulting in `stat` reporting a stale ctime. +# +. ./common/preamble +_begin_fstest auto quick attr + +# Import common functions +. ./common/attr + +# real QA test starts here +_supported_fs generic +_require_test +_require_attrs + +rm -rf $TEST_DIR/testfile +touch $TEST_DIR/testfile + + +_check_xattr_op() +{ + what=$1 + shift 1 + + before_ctime=$(stat -c %z $TEST_DIR/testfile) + $SETFATTR_PROG $* $TEST_DIR/testfile + after_ctime=$(stat -c %z $TEST_DIR/testfile) + + test "$before_ctime" != "$after_ctime" || echo "Expected ctime to change after $what." +} + +_check_xattr_op setxattr -n user.foobar -v 123 +_check_xattr_op removexattr -x user.foobar + +echo "Silence is golden" +status=0 +exit diff --git a/tests/generic/728.out b/tests/generic/728.out new file mode 100644 index 000000000000..ab39f45fe5da --- /dev/null +++ b/tests/generic/728.out @@ -0,0 +1,2 @@ +QA output created by 728 +Silence is golden