[Gluster-devel] WORM-Xlator: How to get filepath in worm_create_cbk?

David Spisla spisla80 at gmail.com
Wed Feb 5 10:45:35 UTC 2020


Hello Amar,
I do the following in worm_create_cbk:

char *filepath = NULL;
inode_path(inode, NULL, &filepath);
if (!filepath) {
    gf_log(this->name, GF_LOG_ERROR, "Can't get filepath!");
}

Unfortunately I got this in the brick log:
[2020-02-05 10:09:41.880522] E [inode.c:1498:__inode_path]
(-->/usr/lib64/glusterfs/5.11/xlator/features/worm.so(+0xb129)
[0x7f4657df7129] -->/usr/lib64/libglusterfs.so.0(inode_path+0x31)
[0x7f4664e44961] -->/us
r/lib64/libglusterfs.so.0(__inode_path+0x38b) [0x7f4664e448bb] ) 0-:
Assertion failed: 0
[2020-02-05 10:09:41.880580] W [inode.c:1500:__inode_path]
(-->/usr/lib64/glusterfs/5.11/xlator/features/worm.so(+0xb129)
[0x7f4657df7129] -->/usr/lib64/libglusterfs.so.0(inode_path+0x31)
[0x7f4664e44961] -->/us
r/lib64/libglusterfs.so.0(__inode_path+0x3d3) [0x7f4664e44903] )
0-repo2-worm: invalid inode [Invalid argument]
[2020-02-05 10:09:41.880594] E [worm.c:488:worm_create_cbk] 0-repo2-worm:
Can't get filepath!

The inode I use seems to be not valid because inode_path() returns with
error. The same with fd->inode. Is there a way to validate the inode before
passing it to the function?

Regards
David



Am Di., 4. Feb. 2020 um 17:57 Uhr schrieb Amar Tumballi <amar at kadalu.io>:

>
>
> On Tue, Feb 4, 2020 at 7:16 PM David Spisla <spisla80 at gmail.com> wrote:
>
>> Dear Gluster Community,
>> in worm_create_cbk a file gets the xattr "trusted.worm_file" and
>> "trusted.start_time" if worm-file-level is enabled. Now I want to exclude
>> some files in a special folder from the WORM function. Therefore I want to
>> check in worm_create_cbk if the file is in this folder or not. But I don't
>> find a parameter where the filepath is stored. So my alternative solution
>> was, to check it in worm_create (via loc->path) and store a boolean value
>> in frame->local. This boolean value will be used in worm_create_cbk later.
>> But its not my favourite solution.
>>
>>
> Do you know how to get the filepath in the cbk function?
>>
>>
> As per FS guidelines, inside the filesystem, we need to handle inodes or
> parent-inode + basename. If you are looking at building a 'path' info in
> create_cbk, then i recommend using 'inode_path()' to build the path as per
> the latest inode table information.
>
> -Amar
>
>
> --
> https://kadalu.io
> Container Storage made easy!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20200205/a37d8025/attachment-0001.html>


More information about the Gluster-devel mailing list