From patchwork Thu Jun 26 00:05:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4424941 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F05FABEEAA for ; Thu, 26 Jun 2014 00:06:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE5A820172 for ; Thu, 26 Jun 2014 00:06:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0DA220123 for ; Thu, 26 Jun 2014 00:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757177AbaFZAG1 (ORCPT ); Wed, 25 Jun 2014 20:06:27 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:63218 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757173AbaFZAGY (ORCPT ); Wed, 25 Jun 2014 20:06:24 -0400 Received: by mail-pb0-f54.google.com with SMTP id un15so2335872pbc.41 for ; Wed, 25 Jun 2014 17:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=siARKzis8d1lqDqU/xufX6JTXHFTDrWpTbSe8u1hD+A=; b=BPaE40XKn7ixGQzw0v8ltsDb5nHlULsWNektkNN/Zgn4vtDiBpUDu+gb1qM6LpPW13 Eox+5ArLcths3V35tSA9CDqMNbGeEonLQvHffvMEAgEgi9dAxkr95mJn4AQM/AYVpB22 K0v/KcJqEEiwD1HgbLu955A3TttXEEFG1/os6+PPVg/+iUa7E3BuxFN1RcepjY3vKfhq g77fN+w8PMJBmdI/UyLMBUHqSKc9Jnmt7i2zhE7fQSCpeitDmd4gF8ZdeDOKfJ1EEquo io8DzfO2FyIrA5qU1DgvscBm1/LvECfeJ0z2NtFp6fsXleTT8L/8D/a1+TebZnNFtB3X Lv1A== X-Received: by 10.68.137.98 with SMTP id qh2mr14758413pbb.26.1403741184497; Wed, 25 Jun 2014 17:06:24 -0700 (PDT) Received: from [192.168.0.100] ([171.215.227.43]) by mx.google.com with ESMTPSA id no9sm6978343pbc.83.2014.06.25.17.06.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 17:06:23 -0700 (PDT) Message-ID: <53AB63D3.90509@gmail.com> Date: Thu, 26 Jun 2014 08:05:39 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , kinglongmee@gmail.com Subject: Re: [PATCH 3/3 v3] ACL: Add some test cases for nfsv4 acl References: <539AD7DD.5060108@gmail.com> <20140618145626.GC17790@fieldses.org> In-Reply-To: <20140618145626.GC17790@fieldses.org> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 6/18/2014 22:56, J. Bruce Fields wrote: > On Fri, Jun 13, 2014 at 06:52:13PM +0800, Kinglong Mee wrote: >> v3, modify for exist st_acl.py >> >> Signed-off-by: Kinglong Mee >> --- >> nfs4.0/servertests/st_acl.py | 337 +++++++++++++++++++++++++++++++++++++++++-- >> 1 file changed, 326 insertions(+), 11 deletions(-) ... snip ... >> +def doSetACLEnv(t, env, type = NF4REG): >> + c = env.c1 >> + path = c.homedir + [t.code] >> + res = c.create_obj(path, attrs={FATTR4_MODE:0777}) >> + check(res) >> + >> + c1 = env.c2 > > That's pretty confusing variable naming. A new patch fixing the variable is added below. Please have a check, thanks. > >> + c1.init_connection() >> + >> + path += [t.code] >> + attrs = {FATTR4_MODE: 0777} >> + >> + if type == NF4REG: >> + fh, stateid = c1.create_confirm(t.code, path, attrs=attrs, >> + deny=OPEN4_SHARE_DENY_NONE) > > Also, this creates a minor cleanup annoyance: a later run of pynfs will > attempt to reuse the already-existing tree and if it's not running as > root tries to make everything writable (see nfs4.0/nfs4lib.py:clean_dir) > so pynfs gives up when a setattr of mode fails (because this file is > owned by someone else). Yes, that's right. I will check the problem with running as a non-root user, and try to find the resolve. > > Honestly I don't really understand how pynfs is meant to work here or > who's fault this is, but I'm setting this patch aside for now. > As you said, I always run it as a root-user, so pynfs works correctly. thanks, Kinglong Mee >From b340bb95ab063d19f421fb987114ef05c395ee64 Mon Sep 17 00:00:00 2001 From: Kinglong Mee Date: Thu, 26 Jun 2014 15:57:11 +0800 Subject: [PATCH] nfs4.0/acl: meaningful variable naming for session Signed-off-by: Kinglong Mee --- nfs4.0/servertests/st_acl.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/nfs4.0/servertests/st_acl.py b/nfs4.0/servertests/st_acl.py index 5c7146a..7869189 100644 --- a/nfs4.0/servertests/st_acl.py +++ b/nfs4.0/servertests/st_acl.py @@ -130,25 +130,28 @@ def doCheckACL(t, c, file, acl): # print printableacl(attrs[FATTR4_ACL]) def doSetACLEnv(t, env, type = NF4REG): - c = env.c1 - path = c.homedir + [t.code] - res = c.create_obj(path, attrs={FATTR4_MODE:0777}) + """ Create a directory with 0777 as top dir, and create a directory + or a regualr file for testing by other user under the above dir. + """ + cdir = env.c1 + path = cdir.homedir + [t.code] + res = cdir.create_obj(path, attrs={FATTR4_MODE:0777}) check(res) - c1 = env.c2 - c1.init_connection() + ctest = env.c2 + ctest.init_connection() path += [t.code] attrs = {FATTR4_MODE: 0777} if type == NF4REG: - fh, stateid = c1.create_confirm(t.code, path, attrs=attrs, + fh, stateid = ctest.create_confirm(t.code, path, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) - return (c1, path, fh, stateid) + return (ctest, path, fh, stateid) else: - res = c1.create_obj(path, attrs=attrs) + res = ctest.create_obj(path, attrs=attrs) check(res) - return (c1, path) + return (ctest, path) def testWriteFileWithoutACL(t, env): """ Check write file without write ACL