All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: Dave Chinner <david@fromorbit.com>
Cc: <linux-xfs@vger.kernel.org>, <darrick.wong@oracle.com>,
	<ira.weiny@intel.com>
Subject: Re: [PATCH v3] xfs: Add check for unsupported xflags
Date: Fri, 4 Sep 2020 09:14:25 +0800	[thread overview]
Message-ID: <5F5194F1.8010607@cn.fujitsu.com> (raw)
In-Reply-To: <20200903074632.GD12131@dread.disaster.area>

On 2020/9/3 15:46, Dave Chinner wrote:
> On Thu, Sep 03, 2020 at 11:57:13AM +0800, Xiao Yang wrote:
>> Current ioctl(FSSETXATTR) ignores unsupported xflags silently
>> so it is not clear for user to know unsupported xflags.
>> For example, use ioctl(FSSETXATTR) to set dax flag on kernel
>> v4.4 which doesn't support dax flag:
>> --------------------------------
>> # xfs_io -f -c "chattr +x" testfile;echo $?
>> 0
>> # xfs_io -c "lsattr" testfile
>> ----------------X testfile
>> --------------------------------
>>
>> Add check to return -EOPNOTSUPP as ext4/f2fs/btrfs does.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> Reviewed-by: Darrick J. Wong<darrick.wong@oracle.com>
>> ---
>>   fs/xfs/xfs_ioctl.c | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
>> index 6f22a66777cd..59f9a86f29f7 100644
>> --- a/fs/xfs/xfs_ioctl.c
>> +++ b/fs/xfs/xfs_ioctl.c
>> @@ -1425,6 +1425,14 @@ xfs_ioctl_setattr_check_projid(
>>   	return 0;
>>   }
>>
>> +#define XFS_SUPPORTED_FS_XFLAGS \
>> +	(FS_XFLAG_REALTIME | FS_XFLAG_PREALLOC | FS_XFLAG_IMMUTABLE | \
>> +	 FS_XFLAG_APPEND | FS_XFLAG_SYNC | FS_XFLAG_NOATIME | FS_XFLAG_NODUMP | \
>> +	 FS_XFLAG_RTINHERIT | FS_XFLAG_PROJINHERIT | FS_XFLAG_NOSYMLINKS | \
>> +	 FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT | FS_XFLAG_NODEFRAG | \
>> +	 FS_XFLAG_FILESTREAM | FS_XFLAG_DAX | FS_XFLAG_COWEXTSIZE | \
>> +	 FS_XFLAG_HASATTR)
>> +
>>   STATIC int
>>   xfs_ioctl_setattr(
>>   	xfs_inode_t		*ip,
>> @@ -1439,6 +1447,10 @@ xfs_ioctl_setattr(
>>
>>   	trace_xfs_ioctl_setattr(ip);
>>
>> +	/* Check if fsx_xflags has unsupported xflags */
>> +	if (fa->fsx_xflags&  ~XFS_SUPPORTED_FS_XFLAGS)
>> +                return -EOPNOTSUPP;
> I don't think we can do this as it may break existing applications
> that have been working on XFS for many, many years that don't
> correctly initialise fsx_xflags....
Hi Dave,

It seems that the only way is to keep the current behavior. :-(

By the way, _require_xfs_io_command "chattr" in xfstests cannot check XFS's
unsupported xflags directly because of the behavior, so we may need to check
them by extra xfs_io -c "lsattr".

Best Regards,
Xiao Yang
> Cheers,
>
> Dave.




  reply	other threads:[~2020-09-04  1:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  3:57 [PATCH v3] xfs: Add check for unsupported xflags Xiao Yang
2020-09-03  7:46 ` Dave Chinner
2020-09-04  1:14   ` Xiao Yang [this message]
2020-09-06 23:01     ` Dave Chinner
2020-09-08  7:49       ` Xiao Yang

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=5F5194F1.8010607@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-xfs@vger.kernel.org \
    /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 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.