From patchwork Sun Nov 27 06:26:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 9448707 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 544026071C for ; Sun, 27 Nov 2016 06:27:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DD2520855 for ; Sun, 27 Nov 2016 06:27:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3284D22376; Sun, 27 Nov 2016 06:27:49 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 AA98F20855 for ; Sun, 27 Nov 2016 06:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347AbcK0G1r (ORCPT ); Sun, 27 Nov 2016 01:27:47 -0500 Received: from us-smtp-delivery-194.mimecast.com ([63.128.21.194]:58255 "EHLO us-smtp-delivery-194.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753222AbcK0G1q (ORCPT ); Sun, 27 Nov 2016 01:27:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=PrimaryData.onmicrosoft.com; s=selector1-primarydata-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wpFC3/AciCpsINbtNzdcT8MuE43j3phGF9x4BOoY4Cw=; b=W13KNCYbKsmvgY4BLnX6hlP+d1qM/wpTpdCfU5tvd0Xnfd6h+oCxwWXm3E1OfacP1w/8OxPpn6ttVhGxL/zMeoNFtJBQWds+z8lzhKbtWf2qjND8DWDW9THzX5aLtjJ/gOvBJfjEMmE0MoTPj0Y3s5NG9sdisH4R4se1M3HVg1k= Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02lp0024.outbound.protection.outlook.com [216.32.180.24]) (Using TLS) by us-smtp-1.mimecast.com with ESMTP id us-mta-92-IPkF21IIOQOUUyUe7t1MLQ-6; Sun, 27 Nov 2016 01:27:35 -0500 Received: from jhereg.localdomain (73.202.55.195) by BN6PR11MB1364.namprd11.prod.outlook.com (10.173.33.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.10; Sun, 27 Nov 2016 06:27:25 +0000 From: Tom Haynes To: "J. Bruce Fields" CC: Linux NFS Mailing list Subject: [PATCH pynfs 09/12] Check that the flex file access uid/gid are correct for the different iomodes Date: Sat, 26 Nov 2016 22:26:38 -0800 Message-ID: <1480228001-64821-10-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 2.3.6 In-Reply-To: <1480228001-64821-1-git-send-email-loghyr@primarydata.com> References: <1480228001-64821-1-git-send-email-loghyr@primarydata.com> MIME-Version: 1.0 X-Originating-IP: [73.202.55.195] X-ClientProxiedBy: DM2PR07CA0047.namprd07.prod.outlook.com (10.141.52.175) To BN6PR11MB1364.namprd11.prod.outlook.com (10.173.33.8) X-MS-Office365-Filtering-Correlation-Id: eb907c61-0e83-461e-9529-08d4168e7462 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN6PR11MB1364; X-Microsoft-Exchange-Diagnostics: 1; BN6PR11MB1364; 3:gYLLTUA2uN5pDVjNPAv7h+uLM0J5jcAprMqcGrxIkgz4lPeYrtCfBOlbSz47QOd9WT8UBs6WqvWuDqJ/rSMZ63cymkd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x5hGKZOKj0u72kvVwmAlPnEvEnHih0qmBt1ElrvZjTMFcWsfe6eRH04EOn3Zw7Yi0RRWeRKnD1u7LpcuWSaF26yiwu1wT66whi+mWXWgFtOLwf4DCOQgpXRe7f63XNeCD7vt5uEU+DeYbgROE3Tc4qz/XXZoXlRZk1P9rrFcJz8DB3UO0SYNCUvP7HarYOEiy5wQ4LGrrLgt5i+Xhm9FMw==; 20:bDU0J20ceNo+16E5ZZ8lhSaImi+zVBtMhWwS/k3ixMJ9SO1m9CRuTRXKdLZENKPXGVHG48qseW/nMoYyvGwG6wi8OuzoEJtkXsnmqJ87ubKEjs8NT2oqQv0Q11yPKBWd6SH/Xe4/vymv1n9GJI1vuth14TaFOZ1a+Xcv++DQZlY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060326)(6045199)(6040361)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(6061324)(20161123560025)(2016111802025)(20161123555025)(20161123564025)(20161123562025)(6043046)(6042181); SRVR:BN6PR11MB1364; BCL:0; PCL:0; RULEID:; SRVR:BN6PR11MB1364; X-Microsoft-Exchange-Diagnostics: 1; BN6PR11MB1364; 4:EDsP7yb6FSgwQ3I9J8nwFCMsy5XK+sm8KGf6GQV6Imupgvv/Jezhx1olbavpDMOglNTFt3KNw3ks5dy9IjoNvl3p7h4v1BPqJJL/lOp0cNGZPyVq2N/9v0iUUQU0qYxE85Ejmd6toWBnQfinueXotx88U+0gSsOfhEFUQ754k52ih7TIyAYR6I1rfYAT/a3KzI7TANMrX16kLwMaMkDGURYkUXD5cFV2RnmLeyBnyq+RcfRO4mbI+Ac9tb8AbCUUtILQQnWIziiacOy45azt5gGTvPKHgUn0fnirma0g2v+8qCFD+GYEKccrs0dQ/y9KLX7HuKFVoj5/GJLFWPozLC7BKdbeNDM3B5Uo1sFtR8Y81Vs+fcEyFnoCromotucnliDNQMjZCkoWbATJq7onZ9qLP4kgnvEGiWZS8JDmQ1MniTjtovvT8aO/s/TFFh0Z83SvkfiU6JOoLHqJh4QLkGZ3K+lX4By3WUXiVIKpiUdQdcomhQXPrALFHDrcVyhpTg0kAOIkF+0NLZk/q9WpKVgJVn0a+OFxQGMcHgp1iAXTxPvzR1ofaIEngFV4Wewq1ARdbvvtgwMLVsBb0qWK6yzCRyz0l5KdC7VDWZ1pt9CT6yoVwxAgHYOFMhbDpvXF6uXv8wSr+9XaUS0blcr4zCuQhnSeXzvtj57HgtZ3uVIBY5jYfkt1gmVKXveqEk/I X-Forefront-PRVS: 0139052FDB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(50986999)(86362001)(5003940100001)(68736007)(305945005)(7736002)(7846002)(105586002)(101416001)(97736004)(42186005)(92566002)(76176999)(36756003)(66066001)(38730400001)(47776003)(110136003)(33646002)(106356001)(733004)(2950100002)(50466002)(8676002)(6916009)(6666003)(81166006)(81156014)(4326007)(50226002)(5660300001)(48376002)(2906002)(6116002)(3846002)(6486002)(189998001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR11MB1364; H:jhereg.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR11MB1364; 23:naix4xMS8fzjFssWoqm+zDwO4/T/86YX/q5lPlFN8?= =?us-ascii?Q?cjgyrbSDFafTCxshJZneI9XY+6/POt4UW8SVVm1HHYOgxR/7XtqQ+FR5taKc?= =?us-ascii?Q?mMHKkzSdl8Bj8Ndc9svB+1FxLn6hPyxBOD3Vj81sBCwBbZuY5LFbaHwg/svQ?= =?us-ascii?Q?zEvyctiSqD7RWqF2+mOpMbTNxaUJB0YY01pYPbC3DYec1aJWuNUKreEAXJpv?= =?us-ascii?Q?i2ZjCaOQaRShKIvNgNBeFo0YLJvZ/V1cBkMliOYzUkpRJklRgwutW4DrDSdy?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O+aelrZ3TJqwYBMaLPPREcEvAOIVX4PGGnnSCtKQFSx1wZYCVqRfiuh/B8hljii1Ffu7LoFdQq7jh1IpaXSHWEfxGfr2gNQAuclU1XkYQK/fXVGCRi5OCIixLA648Kw6v/7xuapVMURNN2w8LgKmCN5Wd1ARziretxlm+PCusvUEGk2g==; 20:Z3L1C5ZIVygztokadFvPfGSs8Xrl8ewFay//DVpsstMg/0MuMwH7hOPEJXMn7ZlES0HnSc9wnwpLPNlOQgjWGI3DAvavy1sOXAKLcGzTtujpfMxAi3GvcgXar3PXh0stkAflI7mPQKHnQmJ8OXyA351EJZHpZqcDfskDxvO0Zf8= X-OriginatorOrg: primarydata.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2016 06:27:25.5944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1364 X-MC-Unique: IPkF21IIOQOUUyUe7t1MLQ-6 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 Signed-off-by: Tom Haynes --- nfs4.1/server41tests/st_flex.py | 115 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py index 8ecb114..fdcfd32 100644 --- a/nfs4.1/server41tests/st_flex.py +++ b/nfs4.1/server41tests/st_flex.py @@ -206,3 +206,118 @@ def testFlexLayoutStress(t, env): check(res) res = close_file(sess, fh, stateid=open_stateid) check(res) + +def testFlexGetDevInfo(t, env): + """Get the device info + + FLAGS: flex + CODE: FFGDI1 + """ + sess = env.c1.new_pnfs_client_session(env.testname(t)) + # Create the file + res = create_file(sess, env.testname(t)) + check(res) + # Get layout 1 + fh = res.resarray[-1].object + open_stateid = res.resarray[-2].stateid + lo_stateid = open_stateid + + ops = [op.putfh(fh), + op.layoutget(False, LAYOUT4_FLEX_FILES, + LAYOUTIOMODE4_RW, + 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)] + res = sess.compound(ops) + check(res) + lo_stateid = res.resarray[-1].logr_stateid + if lo_stateid.seqid != 1: + fail("Expected stateid.seqid==%i, got %i" % (1, lo_stateid.seqid)) + + layout = res.resarray[-1].logr_layout[-1] + p = FlexUnpacker(layout.loc_body) + opaque = p.unpack_ff_layout4() + p.done() + + # Assume one mirror/storage device + ds = opaque.ffl_mirrors[-1].ffm_data_servers[-1] + + deviceid = ds.ffds_deviceid + + ops = [op.putfh(fh), + op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, 0)] + res = sess.compound(ops) + check(res) + + ops = [op.putfh(fh), + op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY, + layoutreturn4(LAYOUTRETURN4_FILE, + layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))] + res = sess.compound(ops) + check(res) + res = close_file(sess, fh, stateid=open_stateid) + check(res) + +def testFlexLayoutTestAccess(t, env): + """Get both a LAYOUTIOMODE4_RW and LAYOUTIOMODE4_READ segment + making sure that they have the same gid, but a different uid. + + FLAGS: flex + CODE: FFLA1 + """ + sess = env.c1.new_pnfs_client_session(env.testname(t)) + # Create the file + res = create_file(sess, env.testname(t)) + check(res) + # Get layout 1 + fh = res.resarray[-1].object + open_stateid = res.resarray[-2].stateid + + ops = [op.putfh(fh), + op.layoutget(False, LAYOUT4_FLEX_FILES, + LAYOUTIOMODE4_RW, + 0, 0xffffffffffffffff, 8192, open_stateid, 0xffff)] + res = sess.compound(ops) + check(res) + lo_stateid = res.resarray[-1].logr_stateid + if lo_stateid.seqid != 1: + fail("Expected stateid.seqid==%i, got %i" % (1, lo_stateid.seqid)) + + layout = res.resarray[-1].logr_layout[-1] + p = FlexUnpacker(layout.loc_body) + opaque = p.unpack_ff_layout4() + p.done() + + # Assume one mirror/storage device + ds = opaque.ffl_mirrors[-1].ffm_data_servers[-1] + + uid_rw = ds.ffds_user + gid_rw = ds.ffds_group + + ops = [op.putfh(fh), + op.layoutget(False, LAYOUT4_FLEX_FILES, + LAYOUTIOMODE4_READ, + 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)] + res = sess.compound(ops) + check(res) + lo_stateid = res.resarray[-1].logr_stateid + if lo_stateid.seqid != 2: + fail("Expected stateid.seqid==%i, got %i" % (2, lo_stateid.seqid)) + + layout = res.resarray[-1].logr_layout[-1] + p = FlexUnpacker(layout.loc_body) + opaque = p.unpack_ff_layout4() + p.done() + + # Assume one mirror/storage device + ds = opaque.ffl_mirrors[-1].ffm_data_servers[-1] + + uid_rd = ds.ffds_user + gid_rd = ds.ffds_group + + if uid_rw == uid_rd: + fail("Expected uid_rd != %i, got %i" % (uid_rd, uid_rw)) + + if gid_rw != gid_rd: + fail("Expected gid_rd == %i, got %i" % (gid_rd, gid_rw)) + + res = close_file(sess, fh, stateid=open_stateid) + check(res)