CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix()
Subsystems (2)
PATCH 1/1 CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix()
Commit 2211d5ba5c6c ("posix_acl: xattr representation cleanups") removes the typedefs and the zero-length a_entries array in struct posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header and struct posix_acl_xattr_entry directly.
But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g.
[root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
--- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800
+++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@
QA output created by 105
-rw-r--r-- root
+setfacl: subdir: Invalid argument
-rw-r--r-- root
Fix it by introducing a new "ace" var, like what cifs_copy_posix_acl() does, and iterating posix acl xattr entries over it in the for loop.
--- fs/cifs/cifssmb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifssmb.c +2 -2
@@ -3453,8 +3453,8 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,return 0 ; }for (i =0 ; i < count; i++) { - rc =convert_ace_to_cifs_ace (&cifs_acl->ace_array[i], - (struct posix_acl_xattr_entry *)(local_acl +1 )); +struct posix_acl_xattr_entry *ace = (void *)(local_acl +1 ); + rc =convert_ace_to_cifs_ace (&cifs_acl->ace_array[i], &ace[i]);if (rc !=0 ) {/* ACE not converted */ break ;
Signature · 1 line
2.7.4
A message that is not in the archive (sent off-list or not yet received): 1477124080-27230-1-git-send-email-guaneryu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 33 lines · Eryu Guan
Commit
2211d5ba5c6c("posix_acl: xattr representation cleanups") removes the typedefs and the zero-lengtha_entriesarray in structposix_acl_xattr_header, and uses bare structposix_acl_xattr_headerand structposix_acl_xattr_entrydirectly.But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g.
[root@localhost xfstests]# diff -u tests/generic/105.out
/root/xfstests/results//generic/105.out.bad
--- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800
+++/root/xfstests/results//generic/105.out.bad2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@
QA output created by 105
-rw-r--r-- root
+setfacl: subdir: Invalid argument
-rw-r--r-- rootFix it by introducing a new "ace" var, like what
cifs_copy_posix_acl()does, and iterating posix acl xattr entries over it in the for loop.Signed-off-by Eryu Guan <[email protected]>--- fs/cifs/cifssmb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/cifs/cifssmb.c +0
-0
fs/cifs/cifssmb.c static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, · line 3456
Quoted 6 lines
fs/cifs/cifssmb.c +1
-2@@ -3453,8 +3453,8 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,return 0 ; }for (i =0 ; i < count; i++) { - rc =convert_ace_to_cifs_ace (&cifs_acl->ace_array[i], - (struct posix_acl_xattr_entry *)(local_acl +1 )); +struct posix_acl_xattr_entry *ace = (void *)(local_acl +1 );
Shouldn't ace better be defined outside the loop?
fs/cifs/cifssmb.c static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, · line 3460
Quoted 4 lines
fs/cifs/cifssmb.c +1
-0+ rc =convert_ace_to_cifs_ace (&cifs_acl->ace_array[i], &ace[i]);if (rc !=0 ) {/* ACE not converted */ break ;
Thanks,
Andreas
A message that is not in the archive (sent off-list or not yet received): CAHc6FU4p=30G9Tm5_F-z4s0EX-kQ_5DjjzVU+eR96huBKho-uQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 29 lines · Andreas Gruenbacher
Quoted 28 lines · Eryu Guan
Commit
2211d5ba5c6c("posix_acl: xattr representation cleanups") removes the typedefs and the zero-lengtha_entriesarray in structposix_acl_xattr_header, and uses bare structposix_acl_xattr_headerand structposix_acl_xattr_entrydirectly.But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g.
[root@localhost xfstests]# diff -u tests/generic/105.out
/root/xfstests/results//generic/105.out.bad
--- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800
+++/root/xfstests/results//generic/105.out.bad2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@
QA output created by 105
-rw-r--r-- root
+setfacl: subdir: Invalid argument
-rw-r--r-- rootFix it by introducing a new "ace" var, like what
cifs_copy_posix_acl()does, and iterating posix acl xattr entries over it in the for loop.Signed-off-by Eryu Guan <[email protected]>--- fs/cifs/cifssmb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines
fs/cifs/cifssmb.c static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, · line 3456
Quoted 11 lines
fs/cifs/cifssmb.c +1
-2@@ -3453,8 +3453,8 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,return 0 ; }for (i =0 ; i < count; i++) { - rc =convert_ace_to_cifs_ace (&cifs_acl->ace_array[i], - (struct posix_acl_xattr_entry *)(local_acl +1 )); +struct posix_acl_xattr_entry *ace = (void *)(local_acl +1 );Shouldn't ace better be defined outside the loop?
Agreed, that's much cleaner. Will fix in v2. Thanks for review!
Eryu
Quoted 8 lines
fs/cifs/cifssmb.c static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, · line 3460
Quoted 5 lines
fs/cifs/cifssmb.c +1
-0+ rc =convert_ace_to_cifs_ace (&cifs_acl->ace_array[i], &ace[i]);if (rc !=0 ) {/* ACE not converted */ break ;Thanks,
Andreas