[Gluster-devel] NULL loc in posix_acl_truncate

Emmanuel Dreyfus manu at netbsd.org
Sat May 26 05:37:51 UTC 2012

here is a bug in release-3.3:

./xinstall -c -p -r -m 555 xinstall
xinstall: /pfs/manu/netbsd/usr/src/tooldir.NetBSD-6.99.4-i386/bin/inst.00033a:
chmod: Permission denied

Kernel trace, client side:
    33      1 xinstall CALL  open(0xbfbfd8e0,0xa02,0x180)
    33      1 xinstall NAMI
    33      1 xinstall RET   open 3
    33      1 xinstall CALL  open(0x
    33      1 xinstall CALL  fchmod(3,0x16d)
    33      1 xinstall RET   fchmod -1 errno 13 Permission denied

I tracked this down to posix_acl_truncate() on the server, where loc->inode
and loc->pah are NULL. This code goes red and raise EACCESS:

        if (acl_permits (frame, loc->inode, POSIX_ACL_WRITE))
                goto green;
                goto red;

Here is the relevant baccktrace:

#9  0xb99d1ca6 in posix_acl_truncate (frame=0xbb77f780, this=0xb9d20000, 
    loc=0xb9d41020, off=48933, xdata=0x0) at posix-acl.c:898
#10 0xb99ba4f8 in truncate_stat_cbk (frame=0xbb77f400, cookie=0xbb77f6a0, 
    this=0xb9d22000, op_ret=0, op_errno=0, buf=0xb89ffac4, xdata=0x0)
    at posix.c:204
#11 0xbbb87933 in default_stat_cbk (frame=0xbb77f6a0, cookie=0xbb77f710, 
    this=0xb9d20000, op_ret=0, op_errno=0, buf=0xb89ffac4, xdata=0x0)
    at defaults.c:47
#12 0xb99e1751 in posix_stat (frame=0xbb77f710, this=0xb9d1f000, 
    loc=0xba60091c, xdata=0x0) at posix.c:231

In frame 12, loc->inode is not NULL, and loc->path makes sense:

In frame 10, loc->path and loc->inode are NULL.

In note that xlators/features/locks/src/posix.c:pl_ftruncate() sets
truncate_stat_cbk() as the callback, and not ftruncate_stat_cbk(). That later
function does not even exist. f-style functions not calling f-style callbacks
have been the root of various bugs so far, is it one more of them?

Emmanuel Dreyfus
manu at netbsd.org

More information about the Gluster-devel mailing list