Re: [PATCH v3 3/3] fs: retire now stale MAY_WRITE predicts in inode_permission()

Jan Kara
2025-11-10T10:15:19Z

On Fri 07-11-25 15:21:49, Mateusz Guzik wrote:
> The primary non-MAY_WRITE consumer now uses lookup_inode_permission_may_exec().
>
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>

Makes sense. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

Honza

> ---
> fs/namei.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 6b2a5a5478e7..2a112b2c0951 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -546,7 +546,7 @@ static inline int do_inode_permission(struct mnt_idmap *idmap,
> */
> static int sb_permission(struct super_block *sb, struct inode *inode, int mask)
> {
> - if (unlikely(mask & MAY_WRITE)) {
> + if (mask & MAY_WRITE) {
> umode_t mode = inode->i_mode;
>
> /* Nobody gets write access to a read-only fs. */
> @@ -577,7 +577,7 @@ int inode_permission(struct mnt_idmap *idmap,
> if (unlikely(retval))
> return retval;
>
> - if (unlikely(mask & MAY_WRITE)) {
> + if (mask & MAY_WRITE) {
> /*
> * Nobody gets write access to an immutable file.
> */
> --
> 2.48.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR