All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, fdmanana@kernel.org,
	andrey.zhadchenko@virtuozzo.com, brauner@kernel.org,
	david@fromorbit.com, hch@lst.de
Subject: [PATCHSET 0/2] xfs: use setattr_copy to set VFS file attributes
Date: Wed, 09 Mar 2022 11:22:06 -0800	[thread overview]
Message-ID: <164685372611.495833.8601145506549093582.stgit@magnolia> (raw)

Hi all,

A few weeks ago, Filipe Manana reported[1] that the new generic/673 test
fails on btrfs because btrfs is more aggressive about dropping the
setgid bit when reflinking into a file.  After some more digging, we
discovered that btrfs calls the VFS helpers to handle updating VFS
inode attributes, whereas XFS has open-coded logic dating from ~1997
that have not been kept up to date.

A few days later, Andrey Zhadchenko reported[2] that XFS can mistakenly
clear S_ISUID and S_ISGID on idmapped mounts.  After further discussion,
it was pointed out that the VFS already handles all these fiddly file
mode changes, and that it was the XFS implementation that is out of
date.

Both of these reports resolve to the same cause, which is that XFS needs
to call setattr_copy to update i_mode instead of doing it directly.
This series replaces all of our bespoke code with VFS calls to fix the
problem and reduce the size of the codebase by ~70 lines.

[1] https://lore.kernel.org/linux-xfs/CAL3q7H47iNQ=Wmk83WcGB-KBJVOEtR9+qGczzCeXJ9Y2KCV25Q@mail.gmail.com/
[2] https://lore.kernel.org/linux-xfs/20220221182218.748084-1-andrey.zhadchenko@virtuozzo.com/

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=setattr-copy-5.18
---
 fs/xfs/xfs_iops.c |  116 +++++++++++------------------------------------------
 fs/xfs/xfs_pnfs.c |    3 +
 2 files changed, 25 insertions(+), 94 deletions(-)


             reply	other threads:[~2022-03-09 19:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09 19:22 Darrick J. Wong [this message]
2022-03-09 19:22 ` [PATCH 1/2] xfs: use setattr_copy to set vfs inode attributes Darrick J. Wong
2022-03-09 21:22   ` Dave Chinner
2022-03-10  8:07   ` Christoph Hellwig
2022-03-10 10:11   ` Christian Brauner
2022-03-10 17:34     ` Darrick J. Wong
2022-03-11  7:54       ` Christian Brauner
2022-03-09 19:22 ` [PATCH 2/2] xfs: refactor user/group quota chown in xfs_setattr_nonsize Darrick J. Wong
2022-03-09 21:25   ` Dave Chinner
2022-03-10  8:10   ` Christoph Hellwig
2022-03-10  9:59   ` Christian Brauner
2022-03-09 23:01 ` [PATCHSET 0/2] xfs: use setattr_copy to set VFS file attributes Andrey Zhadchenko

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=164685372611.495833.8601145506549093582.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=brauner@kernel.org \
    --cc=david@fromorbit.com \
    --cc=fdmanana@kernel.org \
    --cc=hch@lst.de \
    --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.