[Bugs] libgfapi: wrong return value from glfs_h_anonymous_write if the file is unlinked

Ivica Siladic ivica.siladic at mireo.hr
Sun Jan 17 14:58:42 UTC 2016


Hi all,

it seems that glfs_h_anonymous_write function does not correctly return result value if there wan an error during write operation. The problem is observed with 3.7.3 version.

Code to reproduce problem:

    glfs_object* fdev = glfs_h_creat(fs, root, “test-unlink", O_CREAT | O_RDWR, 0644, &sb);
    ssize_t rsz = glfs_h_anonymous_write(fs, fdev, data, 16, 0);
    glfs_h_unlink(fs, root, "test-move");
    rsz = glfs_h_anonymous_write(fs, fdev, data, 16, 0);
    fprintf(stderr, "Data written after unlink: %d, errno: %d\n", rsz, errno);

The second call to just deleted ‘test-unlink’ returns 16 which is incorrect (errno is set to 22 but that is different problem).

From the glustershd.log we see that underlying engine correctly recognized write attempt to non-existing file:

W [MSGID: 114031] [client-rpc-fops.c:2971:client3_3_lookup_cbk] 0-gv0-client-3: remote operation failed. Path: <gfid:6ee79fd2-da3f-4c9b-9dac-9c3892ee3b90> (6ee79fd2-da3f-4c9b-9dac-9c3892ee3b90) [No such file or directory]

Ivica SIladic
Mireo


More information about the Bugs mailing list