linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support
@ 2024-05-10 11:47 David Howells
  2024-05-12  7:38 ` Jan Kara
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Howells @ 2024-05-10 11:47 UTC (permalink / raw)
  To: Max Kellermann, Jan Kara
  Cc: dhowells, Miklos Szeredi, Christian Brauner, linux-ext4,
	linux-fsdevel, linux-kernel

    
If CONFIG_EXT4_FS_POSIX_ACL=n then the fallback version of ext4_init_acl()
will mask off the umask bits from the new inode's i_mode.  This should not
be done if the inode is a symlink.  If CONFIG_EXT4_FS_POSIX_ACL=y, then we
go through posix_acl_create() instead which does the right thing with
symlinks.

However, this is actually unnecessary now as vfs_prepare_mode() has already
done this where appropriate, so fix this by making the fallback version of
ext4_init_acl() do nothing.

Fixes: 484fd6c1de13 ("ext4: apply umask if ACL support is disabled")
Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Max Kellermann <max.kellermann@ionos.com>
cc: Jan Kara <jack@suse.com>
cc: Christian Brauner <brauner@kernel.org>
cc: linux-ext4@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
---
 fs/ext4/acl.h |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/fs/ext4/acl.h b/fs/ext4/acl.h
index ef4c19e5f570..0c5a79c3b5d4 100644
--- a/fs/ext4/acl.h
+++ b/fs/ext4/acl.h
@@ -68,11 +68,6 @@ extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
 static inline int
 ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
 {
-	/* usually, the umask is applied by posix_acl_create(), but if
-	   ext4 ACL support is disabled at compile time, we need to do
-	   it here, because posix_acl_create() will never be called */
-	inode->i_mode &= ~current_umask();
-
 	return 0;
 }
 #endif  /* CONFIG_EXT4_FS_POSIX_ACL */


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support
  2024-05-10 11:47 [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support David Howells
@ 2024-05-12  7:38 ` Jan Kara
  2024-05-15 16:49 ` Christian Brauner
  2024-05-17 15:10 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2024-05-12  7:38 UTC (permalink / raw)
  To: David Howells
  Cc: Max Kellermann, Jan Kara, Miklos Szeredi, Christian Brauner,
	linux-ext4, linux-fsdevel, linux-kernel

On Fri 10-05-24 12:47:21, David Howells wrote:
>     
> If CONFIG_EXT4_FS_POSIX_ACL=n then the fallback version of ext4_init_acl()
> will mask off the umask bits from the new inode's i_mode.  This should not
> be done if the inode is a symlink.  If CONFIG_EXT4_FS_POSIX_ACL=y, then we
> go through posix_acl_create() instead which does the right thing with
> symlinks.
> 
> However, this is actually unnecessary now as vfs_prepare_mode() has already
> done this where appropriate, so fix this by making the fallback version of
> ext4_init_acl() do nothing.
> 
> Fixes: 484fd6c1de13 ("ext4: apply umask if ACL support is disabled")
> Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Max Kellermann <max.kellermann@ionos.com>
> cc: Jan Kara <jack@suse.com>
> cc: Christian Brauner <brauner@kernel.org>
> cc: linux-ext4@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org

Looks good. Feel free to add:

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

								Honza

> ---
>  fs/ext4/acl.h |    5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/fs/ext4/acl.h b/fs/ext4/acl.h
> index ef4c19e5f570..0c5a79c3b5d4 100644
> --- a/fs/ext4/acl.h
> +++ b/fs/ext4/acl.h
> @@ -68,11 +68,6 @@ extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
>  static inline int
>  ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
>  {
> -	/* usually, the umask is applied by posix_acl_create(), but if
> -	   ext4 ACL support is disabled at compile time, we need to do
> -	   it here, because posix_acl_create() will never be called */
> -	inode->i_mode &= ~current_umask();
> -
>  	return 0;
>  }
>  #endif  /* CONFIG_EXT4_FS_POSIX_ACL */
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support
  2024-05-10 11:47 [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support David Howells
  2024-05-12  7:38 ` Jan Kara
@ 2024-05-15 16:49 ` Christian Brauner
  2024-05-17 15:10 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2024-05-15 16:49 UTC (permalink / raw)
  To: David Howells
  Cc: Max Kellermann, Jan Kara, Miklos Szeredi, linux-ext4,
	linux-fsdevel, linux-kernel

On Fri, May 10, 2024 at 12:47:21PM +0100, David Howells wrote:
>     
> If CONFIG_EXT4_FS_POSIX_ACL=n then the fallback version of ext4_init_acl()
> will mask off the umask bits from the new inode's i_mode.  This should not
> be done if the inode is a symlink.  If CONFIG_EXT4_FS_POSIX_ACL=y, then we
> go through posix_acl_create() instead which does the right thing with
> symlinks.
> 
> However, this is actually unnecessary now as vfs_prepare_mode() has already
> done this where appropriate, so fix this by making the fallback version of
> ext4_init_acl() do nothing.
> 
> Fixes: 484fd6c1de13 ("ext4: apply umask if ACL support is disabled")
> Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Max Kellermann <max.kellermann@ionos.com>
> cc: Jan Kara <jack@suse.com>
> cc: Christian Brauner <brauner@kernel.org>
> cc: linux-ext4@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org
> ---

Reviewed-by: Christian Brauner <brauner@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support
  2024-05-10 11:47 [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support David Howells
  2024-05-12  7:38 ` Jan Kara
  2024-05-15 16:49 ` Christian Brauner
@ 2024-05-17 15:10 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2024-05-17 15:10 UTC (permalink / raw)
  To: David Howells
  Cc: Max Kellermann, Jan Kara, Miklos Szeredi, Christian Brauner,
	linux-ext4, linux-fsdevel, linux-kernel

On Fri, May 10, 2024 at 12:47:21PM +0100, David Howells wrote:
>     
> If CONFIG_EXT4_FS_POSIX_ACL=n then the fallback version of ext4_init_acl()
> will mask off the umask bits from the new inode's i_mode.  This should not
> be done if the inode is a symlink.  If CONFIG_EXT4_FS_POSIX_ACL=y, then we
> go through posix_acl_create() instead which does the right thing with
> symlinks.
> 
> However, this is actually unnecessary now as vfs_prepare_mode() has already
> done this where appropriate, so fix this by making the fallback version of
> ext4_init_acl() do nothing.

Thanks for this patch; however, as I had mentioned in the discussion
of the v1 version the patch, this change is already in the ext4 tree
and linux-next in commit c77194965dd0 ('Revert "ext4: apply umask if
ACL support is disabled"').

						- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-17 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-10 11:47 [PATCH v3] ext4: Don't reduce symlink i_mode by umask if no ACL support David Howells
2024-05-12  7:38 ` Jan Kara
2024-05-15 16:49 ` Christian Brauner
2024-05-17 15:10 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).