Bug 803621 - cli_canonicalize_path causing problem when brick paths contain symlinks
cli_canonicalize_path causing problem when brick paths contain symlinks
Status: CLOSED NOTABUG
Product: GlusterFS
Classification: Community
Component: cli (Show other bugs)
mainline
Unspecified Unspecified
medium Severity unspecified
: ---
: ---
Assigned To: Kaushal
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2012-06-12 05:17:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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):
mainline

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.
Eg:
 gluster volume remove-brick test 192.168.56.101:/export/test 192.168.56.101:/export/test-rep 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 (192.168.56.101:/export/test, 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 192.168.56.101:/export/test-rep) 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
Bricks:
Brick1: 192.168.56.1:/export/test
Brick2: 192.168.56.1:/export/test-rep
Brick3: 192.168.56.101:/export/test
Brick4: 192.168.56.101:/export/test-rep

192.168.56.1 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.