[Tux3] Patch: Basic SMP locking for xcache

Daniel Phillips phillips at phunq.net
Sat Dec 27 02:20:23 PST 2008


Tnanks a lot for the great review!

Logic was rewritten in a few places and not tested other than our unit 
tests.  I would really appreciate if one of our volunteers would test 
the tux3 and tux3fuse xattr functionality, and compare to the man pages 
here:

   http://linux.die.net/man/2/getxattr
   http://linux.die.net/man/2/setxattr

The patch got bigger than expected as I was drawn into various issues 
that needed fixing:

   http://hg.tux3.org/tux3/rev/54627761e335

The big thing is, my original interface for get_xattr returned a pointer 
to the xattr in the xattr cache, which is nice for the caller, but will 
not work properly with multitasking because the xattr may disappear 
before the caller gets it.  So now the xattr is copied to a buffer 
under the lock.  This maps fine to the internal kernel api, but bloated 
up tux3.c and tux3fuse.c, which now have to make one call to find out 
how big a buffer to malloc and another to retrieve the xattr.  (Hmm, I 
didn't have to do that for fuse, only for tux3... will fix.)  

A cast to const char in tux3fuse motivated me to add const char to 
get_xattr, which propagated all over the place in the evil way that 
const char does.

Rewriting the fuse code made me notice that Posix requires getxattr to 
return the attribute size in response to a zero sized buffer, so I 
added that.  Some of the logic in the fuse code could then be removed.

Regards,

Daniel

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list