On Tue, Nov 12, 2024 at 08:25:51PM +0000, Al Viro wrote: > From: Stefan Berger <stefanb@xxxxxxxxxxxxx> > > Commit 8a924db2d7b5 ("fs: Pass AT_GETATTR_NOSEC flag to getattr interface > function")' introduced the AT_GETATTR_NOSEC flag to ensure that the > call paths only call vfs_getattr_nosec if it is set instead of vfs_getattr. > Now, simplify the getattr interface functions of filesystems where the flag > AT_GETATTR_NOSEC is checked. > > There is only a single caller of inode_operations getattr function and it > is located in fs/stat.c in vfs_getattr_nosec. The caller there is the only > one from which the AT_GETATTR_NOSEC flag is passed from. > > Two filesystems are checking this flag in .getattr and the flag is always > passed to them unconditionally from only vfs_getattr_nosec: > > - ecryptfs: Simplify by always calling vfs_getattr_nosec in > ecryptfs_getattr. From there the flag is passed to no other > function and this function is not called otherwise. > > - overlayfs: Simplify by always calling vfs_getattr_nosec in > ovl_getattr. From there the flag is passed to no other > function and this function is not called otherwise. > > The query_flags in vfs_getattr_nosec will mask-out AT_GETATTR_NOSEC from > any caller using AT_STATX_SYNC_TYPE as mask so that the flag is not > important inside this function. Also, since no filesystem is checking the > flag anymore, remove the flag entirely now, including the BUG_ON check that > never triggered. > > The net change of the changes here combined with the original commit is > that ecryptfs and overlayfs do not call vfs_getattr but only > vfs_getattr_nosec. > > Fixes: 8a924db2d7b5 ("fs: Pass AT_GETATTR_NOSEC flag to getattr interface function") > Reported-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx> > Closes: https://lore.kernel.org/linux-fsdevel/20241101011724.GN1350452@ZenIV/T/#u > Cc: Tyler Hicks <code@xxxxxxxxxxx> > Cc: ecryptfs@xxxxxxxxxxxxxxx > Cc: Miklos Szeredi <miklos@xxxxxxxxxx> > Cc: Amir Goldstein <amir73il@xxxxxxxxx> > Cc: linux-unionfs@xxxxxxxxxxxxxxx > Cc: Christian Brauner <brauner@xxxxxxxxxx> > Cc: linux-fsdevel@xxxxxxxxxxxxxxx > Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx> > Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx> > --- Reviewed-by: Christian Brauner <brauner@xxxxxxxxxx>