public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guan@eryu.me>
To: Xiao Yang <yangx.jy@cn.fujitsu.com>
Cc: fstests@vger.kernel.org, darrick.wong@oracle.com,
	david@fromorbit.com, ira.weiny@intel.com,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] common/rc: Check 'tPnE' flags on a directory instead of a regilar file
Date: Sun, 13 Sep 2020 23:34:51 +0800	[thread overview]
Message-ID: <20200913153451.GI3853@desktop> (raw)
In-Reply-To: <20200908131523.20899-1-yangx.jy@cn.fujitsu.com>

On Tue, Sep 08, 2020 at 09:15:22PM +0800, Xiao Yang wrote:
> 'tPnE' flags are only valid for a directory so check them on a directory.
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  common/rc | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index aa5a7409..cf31eebc 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2168,8 +2168,14 @@ _require_xfs_io_command()
>  		fi
>  		# Test xfs_io chattr support AND
>  		# filesystem FS_IOC_FSSETXATTR support
> -		testio=`$XFS_IO_PROG -F -f -c "chattr +$param" $testfile 2>&1`
> -		$XFS_IO_PROG -F -f -r -c "chattr -$param" $testfile 2>&1
> +		# 'tPnE' flags are only valid for a directory so check them on a directory.
> +		if echo "$param" | egrep -q 't|P|n|E'; then
> +			testio=`$XFS_IO_PROG -F -c "chattr +$param" $TEST_DIR 2>&1`
> +			$XFS_IO_PROG -F -r -c "chattr -$param" $TEST_DIR 2>&1

I don't think it's a good idea to try chattr on $TEST_DIR, it may change
the behavior of all sub-dirs and files in it and cause unexpected
failures. (I know we do "chattr -$param" right away, but it still looks
dangerous to me.) It's better to create a new $testdir like $testfile to
try on, and remove it after test.

Thanks,
Eryu

> +		else
> +			testio=`$XFS_IO_PROG -F -f -c "chattr +$param" $testfile 2>&1`
> +			$XFS_IO_PROG -F -r -c "chattr -$param" $testfile 2>&1
> +		fi
>  		param_checked="+$param"
>  		;;
>  	"chproj")
> -- 
> 2.21.0
> 
> 

      parent reply	other threads:[~2020-09-13 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 13:15 [PATCH 1/2] common/rc: Check 'tPnE' flags on a directory instead of a regilar file Xiao Yang
2020-09-08 13:15 ` [PATCH 2/2] common/rc: Add extra check for xfs_io -c "chattr" on XFS Xiao Yang
2020-09-13 15:34 ` Eryu Guan [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=20200913153451.GI3853@desktop \
    --to=guan@eryu.me \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=ira.weiny@intel.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=yangx.jy@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