From patchwork Thu May 4 11:42:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13231080 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 23643C77B78 for ; Thu, 4 May 2023 11:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbjEDLml (ORCPT ); Thu, 4 May 2023 07:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjEDLml (ORCPT ); Thu, 4 May 2023 07:42:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DF9D10B for ; Thu, 4 May 2023 04:42:40 -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 99AEA63391 for ; Thu, 4 May 2023 11:42:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4F9CC433D2; Thu, 4 May 2023 11:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683200559; bh=8aGNIJKtXpgEBNOhWL4emxcKzvE9oZ03/h2rK0ZJhEY=; h=From:To:Cc:Subject:Date:From; b=FoJ4JXob4AWCspTIELDk/U8XSwpKKvJuEJIJl8hPa96gJruC9W77WnhQ+JkzgdADL n+ox7xJ58TTt97bv65gog4rS0V6WCVxBZpCAlOo58UThrxJWKHBzS15w2Ka9TmwR5u YFkED6eBllBgjAMMmx9led3e0SSLdr2c78CeRUSJGbXfoQmxdVgT5CsSw5X4xFyTHq CJH1mYwRlsMpuL1wNpGvG3b49s3GyGzthDQnbY2pjBL81UqHh6iyFefWOoxB42Tuty RB4rBSQzQ9WJtvjp1mFG8vaTNEPPQZCSdC8PrsAdus+zYKQ9U6Q88e/da/yTXl5Nns GMYKYBfjAXPog== From: Jeff Layton To: Calum Mackay Cc: linux-nfs@vger.kernel.org Subject: [PATCH] WRT18: have it also check the ctime between writes Date: Thu, 4 May 2023 07:42:37 -0400 Message-Id: <20230504114237.31090-1-jlayton@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 On many servers, the ctime doesn't have sufficient granularity to show an apparent change between rapid writes, but some are able to do so. Have the test also check the ctimes here and pass_warn if it doesn't change after every write. Signed-off-by: Jeff Layton --- nfs4.0/servertests/st_write.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) I've been using this some to test the multigrain ctime patches, and I think it'd be a reasonable addition. We could also consider adding a separate test for this. diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py index db1b1e585fdb..e635717f76c9 100644 --- a/nfs4.0/servertests/st_write.py +++ b/nfs4.0/servertests/st_write.py @@ -497,19 +497,27 @@ def testChangeGranularityWrite(t, env): c = env.c1 c.init_connection() fh, stateid = c.create_confirm(t.word()) - ops = c.use_obj(fh) + [c.getattr([FATTR4_CHANGE])] \ - + [op.write(stateid, 0, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \ - + [op.write(stateid, 10, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \ - + [op.write(stateid, 20, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] \ - + [op.write(stateid, 30, UNSTABLE4, _text)] + [c.getattr([FATTR4_CHANGE])] + attrlist = [FATTR4_CHANGE, FATTR4_TIME_METADATA] + ops = c.use_obj(fh) + [c.getattr(attrlist)] \ + + [op.write(stateid, 0, UNSTABLE4, _text)] + [c.getattr(attrlist)] \ + + [op.write(stateid, 10, UNSTABLE4, _text)] + [c.getattr(attrlist)] \ + + [op.write(stateid, 20, UNSTABLE4, _text)] + [c.getattr(attrlist)] \ + + [op.write(stateid, 30, UNSTABLE4, _text)] + [c.getattr(attrlist)] res = c.compound(ops) check(res) - chattr1 = res.resarray[1].obj_attributes - chattr2 = res.resarray[3].obj_attributes - chattr3 = res.resarray[5].obj_attributes - chattr4 = res.resarray[7].obj_attributes + chattr1 = res.resarray[1].obj_attributes[FATTR4_CHANGE] + chattr2 = res.resarray[3].obj_attributes[FATTR4_CHANGE] + chattr3 = res.resarray[5].obj_attributes[FATTR4_CHANGE] + chattr4 = res.resarray[7].obj_attributes[FATTR4_CHANGE] if chattr1 == chattr2 or chattr2 == chattr3 or chattr3 == chattr4: - t.fail("consecutive SETATTR(mode)'s don't all change change attribute") + t.fail("consecutive WRITE's don't change change attribute") + + ctime1 = res.resarray[1].obj_attributes[FATTR4_TIME_METADATA] + ctime2 = res.resarray[3].obj_attributes[FATTR4_TIME_METADATA] + ctime3 = res.resarray[5].obj_attributes[FATTR4_TIME_METADATA] + ctime4 = res.resarray[7].obj_attributes[FATTR4_TIME_METADATA] + if compareTimes(ctime1, ctime2) == 0 or compareTimes(ctime2, ctime3) == 0 or compareTimes(ctime3, ctime4) == 0: + t.pass_warn("consecutive WRITE's don't all change time_metadata") def testStolenStateid(t, env): """WRITE with incorrect permissions and somebody else's stateid