SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix: enforce XATTR_REPLACE semantics in setxattr (#10059)
shiftraodd1e2412e50214
diff --git a/weed/mount/weedfs_xattr.go b/weed/mount/weedfs_xattr.goindex e85b9d8543..8ae6eb6d5e 100644--- a/weed/mount/weedfs_xattr.go+++ b/weed/mount/weedfs_xattr.go@@ -121,22 +121,23 @@ func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr stif entry.Extended == nil {entry.Extended = make(map[string][]byte)}- oldData, _ := entry.Extended[XATTR_PREFIX+attr]+ _, exists := entry.Extended[XATTR_PREFIX+attr]switch input.Flags {case sys.XATTR_CREATE:- if len(oldData) > 0 {- break+ if exists {+ return fuse.Status(syscall.EEXIST)}- fallthroughcase sys.XATTR_REPLACE:- fallthrough- default:- // data aliases the FUSE request's pooled input buffer, which is- // recycled once this handler returns. Copy before storing so a- // later request reusing the buffer cannot corrupt the value.- entry.Extended[XATTR_PREFIX+attr] = append([]byte(nil), data...)+ if !exists {+ return fuse.ENODATA+ }}+ // data aliases the FUSE request's pooled input buffer, which is+ // recycled once this handler returns. Copy before storing so a+ // later request reusing the buffer cannot corrupt the value.+ entry.Extended[XATTR_PREFIX+attr] = append([]byte(nil), data...)+if fh != nil {fh.dirtyMetadata = truereturn fuse.OK