Author: asomers
Date: Fri Aug 16 05:06:54 2019
New Revision: 351113
URL: https://svnweb.freebsd.org/changeset/base/351113

Log:
  fusefs: don't send the namespace during listextattr
  
  The FUSE_LISTXATTR operation always returns the full list of a file's
  extended attributes, in all namespaces. There's no way to filter the list
  server-side. However, currently FreeBSD's fusefs driver sends a namespace
  string with the FUSE_LISTXATTR request. That behavior was probably copied
  from fuse_vnop_getextattr, which has an attribute name argument. It's
  been there ever since extended attribute support was added in r324620. This
  commit removes it.
  
  Reviewed by:  cem
  MFC after:    2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D21280

Modified:
  head/sys/fs/fuse/fuse_vnops.c
  head/tests/sys/fs/fusefs/mockfs.cc

Modified: head/sys/fs/fuse/fuse_vnops.c
==============================================================================
--- head/sys/fs/fuse/fuse_vnops.c       Fri Aug 16 04:54:38 2019        
(r351112)
+++ head/sys/fs/fuse/fuse_vnops.c       Fri Aug 16 05:06:54 2019        
(r351113)
@@ -2246,9 +2246,7 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap)
        struct mount *mp = vnode_mount(vp);
        struct thread *td = ap->a_td;
        struct ucred *cred = ap->a_cred;
-       size_t len;
        char *prefix;
-       char *attr_str;
        char *bsd_list = NULL;
        char *linux_list;
        int bsd_list_len;
@@ -2274,9 +2272,7 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap)
        else
                prefix = EXTATTR_NAMESPACE_USER_STRING;
 
-       len = strlen(prefix) + sizeof(extattr_namespace_separator) + 1;
-
-       fdisp_init(&fdi, sizeof(*list_xattr_in) + len);
+       fdisp_init(&fdi, sizeof(*list_xattr_in));
        fdisp_make_vp(&fdi, FUSE_LISTXATTR, vp, td, cred);
 
        /*
@@ -2284,8 +2280,6 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap)
         */
        list_xattr_in = fdi.indata;
        list_xattr_in->size = 0;
-       attr_str = (char *)fdi.indata + sizeof(*list_xattr_in);
-       snprintf(attr_str, len, "%s%c", prefix, extattr_namespace_separator);
 
        err = fdisp_wait_answ(&fdi);
        if (err != 0) {
@@ -2310,8 +2304,6 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap)
        fdisp_refresh_vp(&fdi, FUSE_LISTXATTR, vp, td, cred);
        list_xattr_in = fdi.indata;
        list_xattr_in->size = linux_list_len + sizeof(*list_xattr_out);
-       attr_str = (char *)fdi.indata + sizeof(*list_xattr_in);
-       snprintf(attr_str, len, "%s%c", prefix, extattr_namespace_separator);
 
        err = fdisp_wait_answ(&fdi);
        if (err != 0)

Modified: head/tests/sys/fs/fusefs/mockfs.cc
==============================================================================
--- head/tests/sys/fs/fusefs/mockfs.cc  Fri Aug 16 04:54:38 2019        
(r351112)
+++ head/tests/sys/fs/fusefs/mockfs.cc  Fri Aug 16 05:06:54 2019        
(r351113)
@@ -554,16 +554,13 @@ void MockFS::audit_request(const mockfs_buf_in &in) {
                        "Missing request attribute name";
                break;
        case FUSE_GETXATTR:
-               ASSERT_GE(inlen, fih + sizeof(in.body.setxattr)) <<
+               ASSERT_GE(inlen, fih + sizeof(in.body.getxattr)) <<
                        "Missing request body";
-               ASSERT_GT(inlen, fih + sizeof(in.body.setxattr)) <<
+               ASSERT_GT(inlen, fih + sizeof(in.body.getxattr)) <<
                        "Missing request attribute name";
                break;
        case FUSE_LISTXATTR:
-               ASSERT_GE(inlen, fih + sizeof(in.body.listxattr)) <<
-                       "Missing request body";
-               ASSERT_GT(inlen, fih + sizeof(in.body.listxattr)) <<
-                       "Missing namespace";
+               ASSERT_EQ(inlen, fih + sizeof(in.body.listxattr));
                break;
        case FUSE_REMOVEXATTR:
                ASSERT_GT(inlen, fih) << "Missing request attribute name";
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to