]> granicus.if.org Git - zfs/commitdiff
Use directory xattrs for symlinks
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 22 Aug 2013 20:06:33 +0000 (13:06 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 22 Aug 2013 20:30:44 +0000 (13:30 -0700)
There is currently a subtle bug in the SA implementation which
can crop up which prevents us from safely using multiple variable
length SAs in one object.

Fortunately, the only existing use case for this are symlinks with
SA based xattrs.  Therefore, until the root cause in the SA code
can be identified and fixed we prevent adding SA xattrs to symlinks.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1468

module/zfs/zpl_xattr.c

index dca1ad6688045cd2a28363c3ebc033183bac92bb..d79d35bce75b85ca76adcc5f931ad3d284de9d8f 100644 (file)
@@ -438,6 +438,10 @@ zpl_xattr_set_sa(struct inode *ip, const char *name, const void *value,
                if (error == -ENOENT)
                        error = zpl_xattr_set_dir(ip, name, NULL, 0, flags, cr);
        } else {
+               /* Do not allow SA xattrs in symlinks (issue #1648) */
+               if (S_ISLNK(ip->i_mode))
+                       return (-EMLINK);
+
                /* Limited to 32k to keep nvpair memory allocations small */
                if (size > DXATTR_MAX_ENTRY_SIZE)
                        return (-EFBIG);