Bug 803621 - cli_canonicalize_path causing problem when brick paths contain symlinks
cli_canonicalize_path causing problem when brick paths contain symlinks
Product: GlusterFS
Classification: Community
Component: cli (Show other bugs)
Unspecified Unspecified
medium Severity unspecified
: ---
: ---
Assigned To: Kaushal
Depends On:
  Show dependency treegraph
Reported: 2012-03-15 05:42 EDT by Kaushal
Modified: 2012-06-12 05:17 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-06-12 05:17:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Kaushal 2012-03-15 05:42:54 EDT
Description of problem:
cli_canonicalize_path overwrites the next word in the words[] array when it expands symlinks if the real path is longer than given path. This causes cli to fail verification of next brick.

I have a cluster with 3 peers, with all the bricks on the /export of the respective peer. On one of the peers the /export directory is a symlink to another directory on a larger partition. The volume is setup as given below.

Version-Release number of selected component (if applicable):

How reproducible:
Always on the peer with symlink export directory, and cluster setup as given.

Steps to Reproduce:
Issue a command like create volume, add-brick, remove-brick, replace-brick etc. which can take multiple bricks as arguments.
 gluster volume remove-brick test start

Actual results:
The commands will fail with "wrong brick type" message.
For the above eg:
wrong brick type: export/test, use <HOSTNAME>:<export-dir-abs-path>
Usage: volume remove-brick <VOLNAME> [replica <COUNT>] <BRICK> ... {start|pause|abort|status|commit|force}

cli_canonicalize_path, modifies the path of the 1st brick (, even though the brick isn't on the peer issuing the command) to its real path (here /export/Media/export/test). This modification increases the length of the path, which causes the next member in the words[] array (brick to be overwritten. This overwriting causes the validation of the next brick to fail and the gluster command as a result.

Expected results:
The commands should succeed.

cli should perform only the minimum checks necessary to make sure that the given bricks are in proper format for glusterd to interpret. cli shouldn't be canonicalizing brick paths, as bricks may be (and most often will be) on different peers. The checking and canonicalizing of paths should be left to glusterd.

Additional info:

#volume info

Volume Name: test
Type: Distributed-Replicate
Volume ID: 265b064d-148d-465b-b291-1ec17f8dfe17
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Brick4: is the peer with symlinked /export (to /media/Extra/export)
Comment 1 Kaushal 2012-06-12 05:17:28 EDT
Changes introduced in patch http://review.gluster.com/#change,3315 (core: canonicalize paths) remove resolution of symlinks using realpath(). Thus, this problem shouldn't occur anymore.

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