From patchwork Thu May 19 15:32:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mkrtchyan, Tigran" X-Patchwork-Id: 9127861 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 9BAAD6048B for ; Thu, 19 May 2016 15:42:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FBF9281BD for ; Thu, 19 May 2016 15:42:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84681281C3; Thu, 19 May 2016 15:42:42 +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,HK_RANDOM_FROM, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 E61A3281C2 for ; Thu, 19 May 2016 15:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754063AbcESPmf (ORCPT ); Thu, 19 May 2016 11:42:35 -0400 Received: from smtp-o-3.desy.de ([131.169.56.156]:47211 "EHLO smtp-o-3.desy.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753782AbcESPmf (ORCPT ); Thu, 19 May 2016 11:42:35 -0400 X-Clacks-Overhead: GNU Terry Pratchett Received: from smtp-map-3.desy.de (smtp-map-3.desy.de [131.169.56.68]) by smtp-o-3.desy.de (DESY-O-3) with ESMTP id 9830F2804C4 for ; Thu, 19 May 2016 17:42:31 +0200 (CEST) Received: from ZITSWEEP1.win.desy.de (zitsweep1.win.desy.de [131.169.97.95]) by smtp-map-3.desy.de (DESY_MAP_3) with ESMTP id 4FD505254 for ; Thu, 19 May 2016 17:32:55 +0200 (MEST) Received: from smtp-intra-1.desy.de (lb-40-26.desy.de) by ZITSWEEP1.win.desy.de (Clearswift SMTPRS 5.5.0) with ESMTP id ; Thu, 19 May 2016 17:32:55 +0200 Received: from anahit.desy.de (anahit.desy.de [131.169.185.68]) by smtp-intra-1.desy.de (DESY-INTRA-1) with ESMTP id E5D163E902; Thu, 19 May 2016 17:32:54 +0200 (MEST) From: Tigran Mkrtchyan To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Tigran Mkrtchyan Subject: [PATCH 2/2] handle NFS4ERR_BAD_STATEID on setattr Date: Thu, 19 May 2016 17:32:51 +0200 Message-Id: <1463671971-5085-2-git-send-email-tigran.mkrtchyan@desy.de> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1463671971-5085-1-git-send-email-tigran.mkrtchyan@desy.de> References: <1463671971-5085-1-git-send-email-tigran.mkrtchyan@desy.de> 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 the st_setattr test expect that setting a size for not file objects will return NFS4ERR_INVAL, nevertheless, as setting a size requires a valid open/lock state id, server may check that first and return NFS4ERR_BAD_STATEID, which is not handled by the test case. this change adds NFS4ERR_BAD_STATEID into the list of expected errors. Signed-off-by: Tigran Mkrtchyan --- nfs4.0/servertests/st_setattr.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py index 5e9c4e9..912707d 100644 --- a/nfs4.0/servertests/st_setattr.py +++ b/nfs4.0/servertests/st_setattr.py @@ -544,7 +544,7 @@ def testUnsupportedSocket(t, env): _try_unsupported(t, env, path) def testSizeDir(t, env): - """SETATTR(_SIZE) of a directory should return NFS4ERR_ISDIR + """SETATTR(_SIZE) of a directory should return NFS4ERR_ISDIR or NFS4ERR_BAD_STATEID FLAGS: setattr dir all DEPEND: MKDIR @@ -556,10 +556,10 @@ def testSizeDir(t, env): check(res) ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})] res = c.compound(ops) - check(res, NFS4ERR_ISDIR, "SETATTR(_SIZE) of a directory") + check(res, [NFS4ERR_ISDIR, NFS4ERR_BAD_STATEID], "SETATTR(_SIZE) of a directory") def testSizeLink(t, env): - """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL + """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID FLAGS: setattr symlink all DEPEND: MKLINK @@ -571,11 +571,11 @@ def testSizeLink(t, env): check(res) ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})] res = c.compound(ops) - check(res, [NFS4ERR_INVAL, NFS4ERR_SYMLINK], + check(res, [NFS4ERR_INVAL, NFS4ERR_SYMLINK, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a symlink") def testSizeBlock(t, env): - """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL + """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID FLAGS: setattr block all DEPEND: MKBLK @@ -587,10 +587,10 @@ def testSizeBlock(t, env): check(res) ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})] res = c.compound(ops) - check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a block device") + check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a block device") def testSizeChar(t, env): - """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL + """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID FLAGS: setattr char all DEPEND: MKCHAR @@ -602,10 +602,10 @@ def testSizeChar(t, env): check(res) ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})] res = c.compound(ops) - check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a character device") + check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a character device") def testSizeFifo(t, env): - """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL + """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID FLAGS: setattr fifo all DEPEND: MKFIFO @@ -617,10 +617,10 @@ def testSizeFifo(t, env): check(res) ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})] res = c.compound(ops) - check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a fifo") + check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a fifo") def testSizeSocket(t, env): - """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL + """SETATTR(FATTR4_SIZE) of a non-file object should return NFS4ERR_INVAL or NFS4ERR_BAD_STATEID FLAGS: setattr socket all DEPEND: MKSOCK @@ -632,7 +632,7 @@ def testSizeSocket(t, env): check(res) ops = c.use_obj(path) + [c.setattr({FATTR4_SIZE: 0})] res = c.compound(ops) - check(res, NFS4ERR_INVAL, "SETATTR(FATTR4_SIZE) of a socket") + check(res, [NFS4ERR_INVAL, NFS4ERR_BAD_STATEID], "SETATTR(FATTR4_SIZE) of a socket") def testInodeLocking(t, env): """SETATTR: This causes printk message due to inode locking bug