From patchwork Sun Jan 22 16:51:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9531203 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 2503F6020B for ; Sun, 22 Jan 2017 16:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13AA727F8F for ; Sun, 22 Jan 2017 16:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0657427F95; Sun, 22 Jan 2017 16:51: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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham 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 72D0027F8F for ; Sun, 22 Jan 2017 16:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750967AbdAVQvX (ORCPT ); Sun, 22 Jan 2017 11:51:23 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:49342 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750884AbdAVQvX (ORCPT ); Sun, 22 Jan 2017 11:51:23 -0500 Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cVLMQ-0004AD-7l; Sun, 22 Jan 2017 16:51:22 +0000 From: Christoph Hellwig To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org Subject: [pynfs PATCH] check that a mixed size / uid setattr works Date: Sun, 22 Jan 2017 17:51:18 +0100 Message-Id: <1485103878-15160-1-git-send-email-hch@lst.de> X-Mailer: git-send-email 2.1.4 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On some Linux file systems this currently fails and/or trips an ASSERT. Signed-off-by: Christoph Hellwig --- nfs4.0/servertests/st_setattr.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py index b6a398b..accd807 100644 --- a/nfs4.0/servertests/st_setattr.py +++ b/nfs4.0/servertests/st_setattr.py @@ -27,6 +27,23 @@ def _set_size(t, c, file, stateid=None, msg=" using stateid=0"): check(res, msg="Changing size from %i to 0" % newsize) check_res(t, c, res, file, dict) +# +# Mix size and non-size attributes in a single SETATTR. Some Linux file +# systems aren't happy with this mix, and a server passing this on 1:1 +# will trigger warnings or incorrect results. +# +def _set_mixed(t, c, file, stateid=None, msg=" using stateid=0"): + startsize = c.do_getattr(FATTR4_SIZE, file) + newsize = startsize + 10 + owner = "65534" # nobody + + dict = {FATTR4_SIZE: newsize, FATTR4_OWNER: owner} + ops = c.use_obj(file) + [c.setattr(dict, stateid)] + res = c.compound(ops) + check(res, msg="Changing size from %i to %i and owner to %s%s" % + (startsize, newsize, owner, msg), warnlist=[NFS4ERR_BAD_STATEID]) + check_res(t, c, res, file, dict) + def _try_readonly(t, env, path): c = env.c1 baseops = c.use_obj(path) @@ -701,3 +718,15 @@ def testChangeGranularity(t, env): chattr4 = res.resarray[7].obj_attributes if chattr1 == chattr2 or chattr2 == chattr3 or chattr3 == chattr4: t.fail("consecutive SETATTR(mode)'s don't all change change attribute") + +def testMixed(t, env): + """SETATTR(FATTR4_SIZE + FATTR4_OWNER) on file with stateid = 0 + + FLAGS: setattr file all + DEPEND: MKFILE + CODE: SATT16 + """ + c = env.c1 + c.init_connection() + fh, stateid = c.create_confirm(t.code, deny=OPEN4_SHARE_DENY_NONE) + _set_mixed(t, c, fh)