ocfs2-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocfs2: enable ocfs2_listxattr for special files
@ 2024-03-12  4:29 Su Yue
  2024-03-12  6:23 ` Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Su Yue @ 2024-03-12  4:29 UTC (permalink / raw)
  To: ocfs2-devel; +Cc: joseph.qi, Su Yue

From: Su Yue <glass.su@suse.com>

For special files in S_IFBLK/S_IFCHR/S_IFIFO type, we already
have ocfs2_setattr and ocfs2_getattr enabled.
It's confusing for user space if it can use setattr/getattr to
control one attribute appointed but can not list attributes
using listxattr for above type files:

$ mknod /mnt/b b 0 0
$ setfattr -h -n trusted.name -v 0xbabe /mnt/b
$ getfattr -n trusted.name  /mnt/b
getfattr: Removing leading '/' from absolute path names
trusted.name=0sur4=

$ getfattr -m trusted  /mnt/b
$

Fix it by enabling ocfs2_listxattr for ocfs2_special_file_iops.
After the commit, fstests/generic/062 will pass.

Signed-off-by: Su Yue <glass.su@suse.com>
---
 fs/ocfs2/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 8b6d15010703..0da8e7bd3261 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2763,6 +2763,7 @@ const struct inode_operations ocfs2_file_iops = {
 const struct inode_operations ocfs2_special_file_iops = {
 	.setattr	= ocfs2_setattr,
 	.getattr	= ocfs2_getattr,
+	.listxattr	= ocfs2_listxattr,
 	.permission	= ocfs2_permission,
 	.get_inode_acl	= ocfs2_iop_get_acl,
 	.set_acl	= ocfs2_iop_set_acl,
-- 
2.44.0


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

* Re: [PATCH] ocfs2: enable ocfs2_listxattr for special files
  2024-03-12  4:29 [PATCH] ocfs2: enable ocfs2_listxattr for special files Su Yue
@ 2024-03-12  6:23 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2024-03-12  6:23 UTC (permalink / raw)
  To: Su Yue, ocfs2-devel, akpm



On 3/12/24 12:29 PM, Su Yue wrote:
> From: Su Yue <glass.su@suse.com>
> 
> For special files in S_IFBLK/S_IFCHR/S_IFIFO type, we already
> have ocfs2_setattr and ocfs2_getattr enabled.
> It's confusing for user space if it can use setattr/getattr to
> control one attribute appointed but can not list attributes
> using listxattr for above type files:
> 
> $ mknod /mnt/b b 0 0
> $ setfattr -h -n trusted.name -v 0xbabe /mnt/b
> $ getfattr -n trusted.name  /mnt/b
> getfattr: Removing leading '/' from absolute path names
> trusted.name=0sur4=
> 
> $ getfattr -m trusted  /mnt/b
> $
> 
> Fix it by enabling ocfs2_listxattr for ocfs2_special_file_iops.
> After the commit, fstests/generic/062 will pass.
> 
> Signed-off-by: Su Yue <glass.su@suse.com>

Acked-by: Joseph Qi \<joseph.qi@linux.alibaba.com\>

> ---
>  fs/ocfs2/file.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 8b6d15010703..0da8e7bd3261 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -2763,6 +2763,7 @@ const struct inode_operations ocfs2_file_iops = {
>  const struct inode_operations ocfs2_special_file_iops = {
>  	.setattr	= ocfs2_setattr,
>  	.getattr	= ocfs2_getattr,
> +	.listxattr	= ocfs2_listxattr,
>  	.permission	= ocfs2_permission,
>  	.get_inode_acl	= ocfs2_iop_get_acl,
>  	.set_acl	= ocfs2_iop_set_acl,

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

end of thread, other threads:[~2024-03-12  6:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12  4:29 [PATCH] ocfs2: enable ocfs2_listxattr for special files Su Yue
2024-03-12  6:23 ` Joseph Qi

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).