I'm trying to prove a point to a colleague of mine over how we're going to set up our network but things aren't going too well. I need to use extended attributes over CIFS. I can list them and read them but writing is simply not working.
schwartz /SharedDocs # setfattr -n foooo -v baaaar blah
setfattr: blah: Operation not supported
schwartz /SharedDocs # attr -s foooo -V baaaar blah
attr_set: Invalid argument
Could not set "foooo" for blah
I first encountered this on 3.0.24. I saw "BUG 4599: Fix failure when setting attributes" in the fixes list for 3.0.25a so I tried that but it still doesn't work. I've tried mounting remotely and on the same machine. XFS is the filesystem for both machines. Writing attributes outside of Samba works just fine. I have definitely enabled EA support for CIFS in the kernel. The distribution is Gentoo. Here's my smb.conf.
server string = Samba Server %v
hosts allow = 192.168.1., 10.0.2., 127.
security = share
comment = Shared Documents
path = /SharedDocs
read only = no
guest only = yes
ea support = yes
Oops I just remembered you have to prepend "user." when using setfattr. The response from that is "Invalid argument" as well.
schwartz /SharedDocs # setfattr -n user.foooo -v baaaar blah
setfattr: blah: Invalid argument
I'm assuming you are using the Linux CIFS fs, correct?
Yeah sorry, do you maintain that as well? It didn't occur to me that the problem might be there. I mount it like this.
mount.cifs //rhapsody/SharedDocs /SharedDocs -o guest
Steve French maintains the CIFS fs code (kernel code and user space tools).
I'll reassign to him.
For Steve's information, the kernel version is 2.6.21.
Note that setting extended attributes over cifs (due to security restrictions on the server) is only supported for a few categories of xattrs.
xattrs are similar to cifs EAs (os/2 and windows extended attributes) and are supported by Samba (with the appropriate smb.conf and mount options) and Windows servers (over NTFS and various file systems) and various other servers.
The Linux client handles "user" category xattrs (xattrs beginning with "user." or synonym "os2.") which are by far the most common. The Linux cifs client also handles a few special purpose categories of "system." xattrs (e.g. for POSIX ACLs) and is thinking of extending that to include the xattrs for "systeme.dosattr" (for the old dos attributes) and nfsv4 ACL. Currently there is no server implementation in Samba for supporting other categories of xattrs, although jra and I have defined the network protocol mechanism for it.
What is the category of xattr that you are trying to set? Are you sure that you can't just do "user.foooo"
I am aware of the "user." prefix because that confused me when I first started using xattr. The setfattr command automatically adds it and the attr command adds it as long as you don't specify -R, I believe. I have tried adding it manually anyway and I also tried writing a test program in C. All have the same result. There is something else wrong here.
Oh sorry, I was going by what I said in the first comment and forgot about my second comment! I haven't worked with xattr since because we had to use an alternative solution. setfattr does NOT automatically add "user." but as I said, I did try that.
I think this is not Steve's bug. You can set EAs on a NTFS based share from XP using Linux cifs vfs without a problem. Really looks like a Samba bug.
this should work with 3.4.1. Just tested it myself.
*** This bug has been marked as a duplicate of bug 6506 ***