linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Mi Jinlong <mijinlong@cn.fujitsu.com>
Cc: Fred Isaman <iisaman@netapp.com>,
	"J. Bruce Fields" <bfields@redhat.com>,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH 3/3] nfsd4: implement secinfo_no_name
Date: Tue, 18 Jan 2011 17:59:14 -0500	[thread overview]
Message-ID: <20110118225913.GG10903@fieldses.org> (raw)
In-Reply-To: <4D2E6F70.2090501@cn.fujitsu.com>

On Thu, Jan 13, 2011 at 11:20:16AM +0800, Mi Jinlong wrote:
> 
> 
> J. Bruce Fields 写道:
> > Could I ask for a few changes?:
> > 	- The second half of testSupported2 should go into a separate
> > 	  test in a separate st_secinfo file.  (It will be a very small
> > 	  file for now!  But we can port some of the 4.0 tests to it
> > 	  some day.)
> > 	- That test should create a file in the same way that e.g. the
> > 	  st_open tests do instead of assuming a file named "/tree"
> > 	  exists.
> 
>   Is the following one OK?

Yes, applied.

Thanks again for the pynfs help, getting these new features tested is
important.

--b.

> 
> thanks,
> Mi Jinlong
> 
> >From 480d5d5272dd6d3c7bd15adafd62a4a9d2431db2 Mon Sep 17 00:00:00 2001
> From: Mi Jinlong <mijinlong@cn.fujitsu.com>
> Date: Sun, 2 Jan 2011 17:59:20 +0800
> Subject: [PATCH] CLNT: Add some simple secinfo_no_name and secinfo tests
> 
> Add two simple secinfo_no_name tests as Bruce said:
>   - send PUTROOTFH+SECINFO_NO_NAME, check that you get back a
>     legal result.
>   - send PUTROOTFH+SECINFO+GETFH, and/or
>     PUTROOTFH+SECINFO_NO_NAME+GETFH, check that the GETFH returns
>     NOFILEHANDLE.
> 
> also add two simple secinfo tests case.
> 
> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
> ---
>  nfs4.1/server41tests/__init__.py           |    2 +
>  nfs4.1/server41tests/st_secinfo.py         |   57 ++++++++++++++++++++++++++++
>  nfs4.1/server41tests/st_secinfo_no_name.py |   35 +++++++++++++++++
>  3 files changed, 94 insertions(+), 0 deletions(-)
>  create mode 100644 nfs4.1/server41tests/st_secinfo.py
>  create mode 100644 nfs4.1/server41tests/st_secinfo_no_name.py
> 
> diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py
> index 22cd664..3b4411a 100644
> --- a/nfs4.1/server41tests/__init__.py
> +++ b/nfs4.1/server41tests/__init__.py
> @@ -2,6 +2,8 @@ __all__ = ["st_exchange_id.py", # draft 21
>             "st_compound.py",
>             "st_create_session.py",
>             "st_destroy_session.py",
> +           "st_secinfo_no_name.py",
> +           "st_secinfo.py",
>             "st_sequence.py",
>  	   "st_trunking.py",
>             "st_open.py",
> diff --git a/nfs4.1/server41tests/st_secinfo.py b/nfs4.1/server41tests/st_secinfo.py
> new file mode 100644
> index 0000000..c0e5b71
> --- /dev/null
> +++ b/nfs4.1/server41tests/st_secinfo.py
> @@ -0,0 +1,57 @@
> +from st_create_session import create_session
> +from nfs4_const import *
> +from environment import check, fail, use_obj, bad_sessionid, create_file
> +from nfs4_type import channel_attrs4
> +import nfs4_ops as op
> +import nfs4lib
> +
> +def testSupported(t, env):
> +    """Do a simple SECINFO
> +
> +    FLAGS: all
> +    CODE: SEC1
> +    """
> +    name = env.testname(t)
> +    c = env.c1.new_client(env.testname(t))
> +    sess = c.create_session()
> +
> +    # Create a tmpfile for testing
> +    owner = "owner_%s" % name
> +    path = sess.c.homedir + [name]
> +    res = create_file(sess, owner, path, access=OPEN4_SHARE_ACCESS_WRITE)
> +    check(res)
> +
> +    # Get the filehandle of the tmpfile's parent dir
> +    res = sess.compound(use_obj(sess.c.homedir) + [op.getfh()])
> +    check(res)
> +    fh = res.resarray[-1].object
> +
> +    # Just do a simple SECINFO
> +    res = sess.compound([op.putfh(fh), op.secinfo(name)])
> +    check(res)
> +
> +def testSupported2(t, env):
> +    """GETFH after do a SECINFO_NO_NAME or SECINFO
> +       result in a NOFILEHANDLE error, See rfc 5661 section 2.6.3.1.1.8
> +
> +    FLAGS: all
> +    CODE: SEC2
> +    """
> +    name = env.testname(t)
> +    c = env.c1.new_client(env.testname(t))
> +    sess = c.create_session()
> +
> +    # Create a tmpfile for testing
> +    owner = "owner_%s" % name
> +    path = sess.c.homedir + [name]
> +    res = create_file(sess, owner, path, access=OPEN4_SHARE_ACCESS_WRITE)
> +    check(res)
> +
> +    # Get the filehandle of the tmpfile's parent dir
> +    res = sess.compound(use_obj(sess.c.homedir) + [op.getfh()])
> +    check(res)
> +    fh = res.resarray[-1].object
> +
> +    # GETFH after do a SECINFO should get error NFS4ERR_NOFILEHANDLE
> +    res = sess.compound([op.putfh(fh), op.secinfo(name), op.getfh()])
> +    check(res, NFS4ERR_NOFILEHANDLE)
> diff --git a/nfs4.1/server41tests/st_secinfo_no_name.py b/nfs4.1/server41tests/st_secinfo_no_name.py
> new file mode 100644
> index 0000000..14bc410
> --- /dev/null
> +++ b/nfs4.1/server41tests/st_secinfo_no_name.py
> @@ -0,0 +1,35 @@
> +from st_create_session import create_session
> +from nfs4_const import *
> +from environment import check, fail, bad_sessionid, create_file
> +from nfs4_type import channel_attrs4
> +import nfs4_ops as op
> +import nfs4lib
> +
> +def testSupported(t, env):
> +    """Do a simple SECINFO_NO_NAME
> +       send PUTROOTFH+SECINFO_NO_NAME, check is result legal
> +
> +    FLAGS: all
> +    CODE: SECNN1
> +    """
> +    c = env.c1.new_client(env.testname(t))
> +    sess = c.create_session()
> +
> +    # Do a simple SECINFO_NO_NAME
> +    res = sess.compound([op.putrootfh(), op.secinfo_no_name(0)])
> +    check(res)
> +
> +def testSupported2(t, env):
> +    """GETFH after do a SECINFO_NO_NAME or SECINFO
> +       result in a NOFILEHANDLE error, See rfc 5661 section 2.6.3.1.1.8
> +
> +    FLAGS: all
> +    CODE: SECNN2
> +    """
> +    c = env.c1.new_client(env.testname(t))
> +    sess = c.create_session()
> +
> +    # GETFH after do a SECINFO_NO_NAME should get error NFS4ERR_NOFILEHANDLE
> +    res = sess.compound([op.putrootfh(), op.secinfo_no_name(0), op.getfh()])
> +    print res
> +    check(res, NFS4ERR_NOFILEHANDLE)
> -- 
> 1.7.3.4
> 
> 
> 

      reply	other threads:[~2011-01-18 22:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 19:01 4.1 secinfo patches J. Bruce Fields
2010-12-17 19:01 ` [PATCH 1/3] nfsd4: 4.1 SECINFO should consume filehandle J. Bruce Fields
2010-12-17 19:01 ` [PATCH 2/3] nfsd4: move guts of nfsd4_lookupp into helper J. Bruce Fields
2010-12-17 19:01 ` [PATCH 3/3] nfsd4: implement secinfo_no_name J. Bruce Fields
2010-12-27  6:29   ` Mi Jinlong
2010-12-29 18:56     ` J. Bruce Fields
2010-12-30  4:13       ` Mi Jinlong
2011-01-05  1:05         ` J. Bruce Fields
2011-01-05 15:15           ` Fred Isaman
2011-01-05 15:37             ` J. Bruce Fields
2011-01-05 17:29               ` J. Bruce Fields
2011-01-06  3:54                 ` Mi Jinlong
2011-01-11 23:32                   ` J. Bruce Fields
2011-01-13  3:20                     ` Mi Jinlong
2011-01-18 22:59                       ` J. Bruce Fields [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110118225913.GG10903@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=bfields@redhat.com \
    --cc=iisaman@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mijinlong@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).