Bug 1788806 - __server_getspec(), volume path limited to 255 chars
Summary: __server_getspec(), volume path limited to 255 chars
Alias: None
Product: GlusterFS
Classification: Community
Component: glusterd
Version: 6
Hardware: Unspecified
OS: Linux
Target Milestone: ---
Assignee: Sanju
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2020-01-08 07:14 UTC by sean
Modified: 2020-03-18 11:33 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-03-17 03:24:29 UTC
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:

Attachments (Terms of Use)

Description sean 2020-01-08 07:14:16 UTC
Description of problem:

Snapshot volumes with a path larger than 255 can be created, but not activated. The limit should be 4096 chars.

How reproducible:

snapshot create my-foo-volume-long-name-logs-volume-claim-tmp_684032fa-314d-11ea-9698-0050569b592b-snap-20200107-1456 my-foo-volume-long-name-logs-volume-claim-tmp_684032fa-314d-11ea-9698-0050569b592b no-timestamp : SUCCESS

sudo /usr/sbin/gluster snapshot activate my-foo-volume-long-name-logs-volume-claim-tmp_684032fa-314d-11ea-9698-0050569b592b-snap-20200107-1456'

glusterd.log:[2020-01-07 13:56:07.813431] E [MSGID: 106202] [glusterd-handshake.c:919:__server_getspec] 0-management: volume name too long (/snaps/my-foo-volume-long-name-logs-volume-claim-tmp_684032fa-314d-11ea-9698-0050569b592b-snap-20200107-1456/b7a7c659e3b146cb818bd86fe3edc97c/b7a7c659e3b146cb818bd86fe3edc97c. [Invalid argument]

Steps to Reproduce:
1. create volume with long name
2. create snapshot
3. activate the snapshot

Actual results:
"volume name too long"

Expected results:
Volume activated

Additional info:

The limitation is in https://github.com/gluster/glusterfs/blob/master/xlators/mgmt/glusterd/src/glusterd-handshake.c#L937

Seems like a bug ?

Comment 1 Sanju 2020-01-13 06:18:27 UTC

I see the below code in __server_getspec(). Can we have snapshot name whose length is more NAME_MAX? If so, how the checks are handled in other code paths? Are we using any other macro? 

libglusterfs/src/glusterfs/compat.h:324:#define NAME_MAX 255

    volume = args.key;

    if (strlen(volume) >= (NAME_MAX)) {
        op_errno = EINVAL;
        gf_msg(this->name, GF_LOG_ERROR, EINVAL, GD_MSG_NAME_TOO_LONG,
               "volume name too long (%s)", volume);
        goto fail;


Comment 2 Sunny Kumar 2020-01-13 08:55:02 UTC
Hi Sanju,

The patch[1] was added to prevent service denial attacks, which basically reason behind this failure.

Will check and update more.

[1]. https://review.gluster.org/#/c/glusterfs/+/21528/.


Comment 3 Sanju 2020-02-24 07:14:50 UTC
Any update on this, Sunny?

Comment 4 Worker Ant 2020-03-17 03:24:29 UTC
This bug is moved to https://github.com/gluster/glusterfs/issues/1107, and will be tracked there from now on. Visit GitHub issues URL for further details

Comment 5 Sunny Kumar 2020-03-18 11:33:20 UTC
removing needinfo as this bug has been moved to Github, please check issue-1107 for further update.

Note You need to log in before you can comment on or make changes to this bug.