From patchwork Tue May 16 14:14:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 13243221 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 19630C7EE2D for ; Tue, 16 May 2023 14:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233140AbjEPOOL (ORCPT ); Tue, 16 May 2023 10:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233883AbjEPOOK (ORCPT ); Tue, 16 May 2023 10:14:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C984CAB; Tue, 16 May 2023 07:14:09 -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 6776761B09; Tue, 16 May 2023 14:14:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66F59C433D2; Tue, 16 May 2023 14:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684246448; bh=saVZQYmRAyO5dOZw9EWySdWwQQL/yP/5bl9XqQuAVyg=; h=From:To:Cc:Subject:Date:From; b=hHRHUNOxOZ1Azow6vKLIi6u0CUmiB8otbjfuupQhm+S1L3ww5Yd9Gi7bwHTXwuPeS rTkqTiUDB+9d9ymBzBYmAVMpd7/x0jijEEvKs/dlxatLiVt6An+2aMZSImLB+L3e1p 2OwC7PYu67S7wa5Wb2DW0bu5oV76aMDJqONVLzNhTqs4jecSxp3jlefsCisZfvLD6M lKjyGuVEZPh11mW9nHOIaaCYaonWm/pHBLCCnqJK113E7CGENUqyrT81XWC4QXqSUv fd1nbFYDNLRqe0TFuB61d4Nl9ryD+bDMUqridNTib2RDLTpD/8hm5Q15bAczpC+aQN 0KoGpfiKM7SxQ== From: Anna Schumaker To: linux-nfs@vger.kernel.org, fstests@vger.kernel.org, zlang@redhat.com Cc: anna@kernel.org Subject: [PATCH v3] generic/728: Add a test for xattr ctime updates Date: Tue, 16 May 2023 10:14:07 -0400 Message-Id: <20230516141407.201674-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 Reviewed-by: Darrick J. Wong --- v3: - Add a 2 second sleep before changing the xattr v2: - Move test to generic/ - Address comments from the mailing list --- tests/generic/728 | 43 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/728.out | 2 ++ 2 files changed, 45 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..8e52eb4b219c --- /dev/null +++ b/tests/generic/728 @@ -0,0 +1,43 @@ +#! /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) + sleep 2 + $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