All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] cifs: setfattr -x test for cifs
@ 2019-02-11  5:19 Ronnie Sahlberg
  2019-02-11  5:19 ` [PATCH] cifs: add test that setfattr -x fails non-existing EAs Ronnie Sahlberg
  0 siblings, 1 reply; 5+ messages in thread
From: Ronnie Sahlberg @ 2019-02-11  5:19 UTC (permalink / raw)
  To: linux-fsdevel

List,

Please find a small test for cifs that tests that setfattr -x for a non existing attribute will fail correctly.
This is for a bug we recently fixed in cifs.ko where we used to return successr, since that is what the SMB2 response 
from the server would be.

Xfstests already have testing for setfattr -x for nonexisting attributes in generic/097 but we can not use that test in cifs since we
can only allow the use of the user namespace. (No way to lock down access to read/write EA subspaces such as 'system.' prefixes and such.)

Since tests only tests a small subset of generic/097 it made more sense to me to add this as a cifs specific
test instead of adding a new, redundant, generic/* test.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] cifs: add test that setfattr -x fails non-existing EAs
  2019-02-11  5:19 [PATCH 0/1] cifs: setfattr -x test for cifs Ronnie Sahlberg
@ 2019-02-11  5:19 ` Ronnie Sahlberg
  2019-02-11  7:15   ` Amir Goldstein
  2019-02-11 21:51   ` Dave Chinner
  0 siblings, 2 replies; 5+ messages in thread
From: Ronnie Sahlberg @ 2019-02-11  5:19 UTC (permalink / raw)
  To: linux-fsdevel

We just fixed a bug in cifs.ko where it would incorrectly return success
for setfattr -x user.does-not-exist.

This patch adds a test case for this.

Xfstests already have tests for setfattr -x in generic/097
but we can not yet use that test for cifs since we can only support
the user namespace.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 tests/cifs/002     | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/cifs/002.out |  6 ++++++
 tests/cifs/group   |  1 +
 3 files changed, 60 insertions(+)
 create mode 100755 tests/cifs/002
 create mode 100644 tests/cifs/002.out

diff --git a/tests/cifs/002 b/tests/cifs/002
new file mode 100755
index 00000000..80baa66a
--- /dev/null
+++ b/tests/cifs/002
@@ -0,0 +1,53 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2017 Google, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 002. Modified from generic/097
+#
+# simple attr test for deleting a non-existing EA:
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+file=$TEST_DIR/foo
+
+_cleanup()
+{
+	rm -f $tmp.* $file
+}
+
+setfattr()
+{
+    echo $SETFATTR_PROG "$@" >>/tmp/foo
+	$SETFATTR_PROG "$@" |& _filter_test_dir
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/attr
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_test
+_require_attrs
+
+echo -e "\ncreate file foo"
+rm -f $file
+touch $file
+
+echo -e "\nunset EA <does-not-exist>:"
+setfattr -x user.does-not-exist $file
+
+# success, all done
+status=0
+exit
diff --git a/tests/cifs/002.out b/tests/cifs/002.out
new file mode 100644
index 00000000..163eb48a
--- /dev/null
+++ b/tests/cifs/002.out
@@ -0,0 +1,6 @@
+QA output created by 002
+
+create file foo
+
+unset EA <does-not-exist>:
+setfattr: TEST_DIR/foo: No such attribute
diff --git a/tests/cifs/group b/tests/cifs/group
index 6d07b1c4..191e6a67 100644
--- a/tests/cifs/group
+++ b/tests/cifs/group
@@ -4,3 +4,4 @@
 # - comment line before each group is "new" description
 #
 001 auto quick
+002 auto quick
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cifs: add test that setfattr -x fails non-existing EAs
  2019-02-11  5:19 ` [PATCH] cifs: add test that setfattr -x fails non-existing EAs Ronnie Sahlberg
@ 2019-02-11  7:15   ` Amir Goldstein
  2019-02-14  5:50     ` Eryu Guan
  2019-02-11 21:51   ` Dave Chinner
  1 sibling, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2019-02-11  7:15 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: fstests

Hi Ronnie,

CC the correct list <fstests@vger.kernel.org>

On Mon, Feb 11, 2019 at 7:21 AM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> We just fixed a bug in cifs.ko where it would incorrectly return success
> for setfattr -x user.does-not-exist.
>
> This patch adds a test case for this.
>
> Xfstests already have tests for setfattr -x in generic/097
> but we can not yet use that test for cifs since we can only support
> the user namespace.

Mmm... that's not a reason to write a cifs specific test.
1. Your test is not cifs specific so should be generic
2. There is a lot of other test coverage cifs is missing from generic/097

What I suggest is:
- implement _require_trusted_attrs
- replace _require_attrs with  _require_trusted_attrs in the few
  generic tests that use trusted xattrs
- I counted 5 generic tests and there is also generic/079 that
  sets trusted xattr via t_immutable and doesn't currently _require_attrs
  at all. Frankly, it looks like most of those test could use user.* xattrs,
  but whatever.
- Anyway, please stay away from the overlay trusted xattr tests.
- clone generic/097 to a new test that only _require_attrs
  leaving out the trusted xattrs

After that change, cifs will not fail on the trusted xattr tests
and instead those tests will be properly skipped for cifs.

Thanks,
Amir.

>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  tests/cifs/002     | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/cifs/002.out |  6 ++++++
>  tests/cifs/group   |  1 +
>  3 files changed, 60 insertions(+)
>  create mode 100755 tests/cifs/002
>  create mode 100644 tests/cifs/002.out
>
> diff --git a/tests/cifs/002 b/tests/cifs/002
> new file mode 100755
> index 00000000..80baa66a
> --- /dev/null
> +++ b/tests/cifs/002
> @@ -0,0 +1,53 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
> +# Copyright (c) 2017 Google, Inc.  All Rights Reserved.
> +#
> +# FS QA Test No. 002. Modified from generic/097
> +#
> +# simple attr test for deleting a non-existing EA:
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1       # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +file=$TEST_DIR/foo
> +
> +_cleanup()
> +{
> +       rm -f $tmp.* $file
> +}
> +
> +setfattr()
> +{
> +    echo $SETFATTR_PROG "$@" >>/tmp/foo
> +       $SETFATTR_PROG "$@" |& _filter_test_dir
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/attr
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_test
> +_require_attrs
> +
> +echo -e "\ncreate file foo"
> +rm -f $file
> +touch $file
> +
> +echo -e "\nunset EA <does-not-exist>:"
> +setfattr -x user.does-not-exist $file
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/cifs/002.out b/tests/cifs/002.out
> new file mode 100644
> index 00000000..163eb48a
> --- /dev/null
> +++ b/tests/cifs/002.out
> @@ -0,0 +1,6 @@
> +QA output created by 002
> +
> +create file foo
> +
> +unset EA <does-not-exist>:
> +setfattr: TEST_DIR/foo: No such attribute
> diff --git a/tests/cifs/group b/tests/cifs/group
> index 6d07b1c4..191e6a67 100644
> --- a/tests/cifs/group
> +++ b/tests/cifs/group
> @@ -4,3 +4,4 @@
>  # - comment line before each group is "new" description
>  #
>  001 auto quick
> +002 auto quick
> --
> 2.13.6
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cifs: add test that setfattr -x fails non-existing EAs
  2019-02-11  5:19 ` [PATCH] cifs: add test that setfattr -x fails non-existing EAs Ronnie Sahlberg
  2019-02-11  7:15   ` Amir Goldstein
@ 2019-02-11 21:51   ` Dave Chinner
  1 sibling, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2019-02-11 21:51 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: fstests, linux-fsdevel

[cc fstests@vger.kernel.org]

Hi Ronnie,

Probably better to send this (and any followups) to the fstests
list... :)

On Mon, Feb 11, 2019 at 03:19:32PM +1000, Ronnie Sahlberg wrote:
> We just fixed a bug in cifs.ko where it would incorrectly return success
> for setfattr -x user.does-not-exist.
> 
> This patch adds a test case for this.
> 
> Xfstests already have tests for setfattr -x in generic/097
> but we can not yet use that test for cifs since we can only support
> the user namespace.

'the "user." xattr namespace.'

"user namespace" is an overloaded term.

> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  tests/cifs/002     | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/cifs/002.out |  6 ++++++
>  tests/cifs/group   |  1 +
>  3 files changed, 60 insertions(+)
>  create mode 100755 tests/cifs/002
>  create mode 100644 tests/cifs/002.out
> 
> diff --git a/tests/cifs/002 b/tests/cifs/002
> new file mode 100755
> index 00000000..80baa66a
> --- /dev/null
> +++ b/tests/cifs/002
> @@ -0,0 +1,53 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
> +# Copyright (c) 2017 Google, Inc.  All Rights Reserved.
> +#
> +# FS QA Test No. 002. Modified from generic/097
> +#
> +# simple attr test for deleting a non-existing EA:
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +file=$TEST_DIR/foo
> +
> +_cleanup()
> +{
> +	rm -f $tmp.* $file
> +}
> +
> +setfattr()
> +{
> +    echo $SETFATTR_PROG "$@" >>/tmp/foo

Why? And it doesn't get cleaned up on test exit, either.

> +	$SETFATTR_PROG "$@" |& _filter_test_dir
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/attr
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_test
> +_require_attrs
> +
> +echo -e "\ncreate file foo"
> +rm -f $file
> +touch $file
> +
> +echo -e "\nunset EA <does-not-exist>:"
> +setfattr -x user.does-not-exist $file
> +
> +# success, all done
> +status=0
> +exit

I don't see anything cifs specific in this test.

And why just test this one specific thing you found a bug in? Why
not just copy all of generic/097 and chop out all the non-"user."
xattr namespace bits so you exercise all the different xattr
operations?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cifs: add test that setfattr -x fails non-existing EAs
  2019-02-11  7:15   ` Amir Goldstein
@ 2019-02-14  5:50     ` Eryu Guan
  0 siblings, 0 replies; 5+ messages in thread
From: Eryu Guan @ 2019-02-14  5:50 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Ronnie Sahlberg, fstests

On Mon, Feb 11, 2019 at 09:15:28AM +0200, Amir Goldstein wrote:
> Hi Ronnie,
> 
> CC the correct list <fstests@vger.kernel.org>
> 
> On Mon, Feb 11, 2019 at 7:21 AM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
> >
> > We just fixed a bug in cifs.ko where it would incorrectly return success
> > for setfattr -x user.does-not-exist.
> >
> > This patch adds a test case for this.
> >
> > Xfstests already have tests for setfattr -x in generic/097
> > but we can not yet use that test for cifs since we can only support
> > the user namespace.
> 
> Mmm... that's not a reason to write a cifs specific test.
> 1. Your test is not cifs specific so should be generic
> 2. There is a lot of other test coverage cifs is missing from generic/097
> 
> What I suggest is:
> - implement _require_trusted_attrs
> - replace _require_attrs with  _require_trusted_attrs in the few
>   generic tests that use trusted xattrs
> - I counted 5 generic tests and there is also generic/079 that
>   sets trusted xattr via t_immutable and doesn't currently _require_attrs
>   at all. Frankly, it looks like most of those test could use user.* xattrs,
>   but whatever.
> - Anyway, please stay away from the overlay trusted xattr tests.
> - clone generic/097 to a new test that only _require_attrs
>   leaving out the trusted xattrs

Yeah, these suggestions all look good to me,

> 
> After that change, cifs will not fail on the trusted xattr tests
> and instead those tests will be properly skipped for cifs.

and this would be the ideal situation for cifs :)

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-14  6:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-11  5:19 [PATCH 0/1] cifs: setfattr -x test for cifs Ronnie Sahlberg
2019-02-11  5:19 ` [PATCH] cifs: add test that setfattr -x fails non-existing EAs Ronnie Sahlberg
2019-02-11  7:15   ` Amir Goldstein
2019-02-14  5:50     ` Eryu Guan
2019-02-11 21:51   ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.