Bug 1595190 - rmdir is leaking softlinks to directories in .glusterfs
Summary: rmdir is leaking softlinks to directories in .glusterfs
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: posix
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1595524 1595528
TreeView+ depends on / blocked
 
Reported: 2018-06-26 10:34 UTC by Pranith Kumar K
Modified: 2018-10-23 15:12 UTC (History)
2 users (show)

Fixed In Version: glusterfs-5.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1595524 (view as bug list)
Environment:
Last Closed: 2018-10-23 15:12:07 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Pranith Kumar K 2018-06-26 10:34:36 UTC
Description of problem:
storage/posix: Fix posix_symlinks_match()

1) snprintf into linkname_expected should happen with PATH_MAX
2) comparison should happen with linkname_actual with string linkname_expected

114	posix_symlinks_match (xlator_t *this, loc_t *loc, uuid_t gfid)
115	{
116	        struct posix_private *priv = NULL;
117	        char linkname_actual[PATH_MAX] = {0,};
118	        char linkname_expected[PATH_MAX] = {0};
119	        char *dir_handle = NULL;
(gdb) 
120	        size_t len = 0;
121	        size_t handle_size = 0;
122	        gf_boolean_t ret = _gf_false;
123	
124	        priv = this->private;
125	        handle_size = POSIX_GFID_HANDLE_SIZE(priv->base_path_length);
126	        dir_handle = alloca0 (handle_size);
127	
128	        snprintf (linkname_expected, handle_size, "../../%02x/%02x/%s/%s",

<<<<<<<<< s/handle_size/PATH_MAX

129	                  loc->pargfid[0], loc->pargfid[1], uuid_utoa (loc->pargfid),
(gdb) 
130	                  loc->name);
131	
132	        MAKE_HANDLE_GFID_PATH (dir_handle, this, gfid, NULL);
133	        len = sys_readlink (dir_handle, linkname_actual, PATH_MAX);
134	        if (len < 0)
135	                goto out;
136	        linkname_actual[len] = '\0';
137	
138	        if (!strncmp (linkname_actual, linkname_expected, handle_size))
139	                ret = _gf_true;
(gdb) p handle_size
$12 = 77
(gdb) q
A debugging session is active.

(gdb) p linkname_actual 
$9 = "../../78/2f/782f8b99-a965-4b32-95ff-b698fdb0a08e/_gqac023.sbu.lab.eng.bos.redhat.com_00_1_.d", '\000' <repeats 4003 times>
(gdb) p linkname_expected 
$10 = "../../78/2f/782f8b99-a965-4b32-95ff-b698fdb0a08e/_gqac023.sbu.lab.eng.bos.re", '\000' <repeats 4019 times>


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Worker Ant 2018-06-26 12:20:45 UTC
REVIEW: https://review.gluster.org/20392 (storage/posix: Fix posix_symlinks_match()) posted (#1) for review on master by Pranith Kumar Karampuri

Comment 2 Worker Ant 2018-06-27 03:21:51 UTC
COMMIT: https://review.gluster.org/20392 committed in master by "Pranith Kumar Karampuri" <pkarampu> with a commit message- storage/posix: Fix posix_symlinks_match()

1) snprintf into linkname_expected should happen with PATH_MAX
2) comparison should happen with linkname_actual with complete
   string linkname_expected

fixes bz#1595190
Change-Id: Ic3b3c362dc6c69c046b9a13e031989be47ecff14
Signed-off-by: Pranith Kumar K <pkarampu>

Comment 3 Shyamsundar 2018-10-23 15:12:07 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-5.0, please open a new bug report.

glusterfs-5.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://lists.gluster.org/pipermail/announce/2018-October/000115.html
[2] https://www.gluster.org/pipermail/gluster-users/


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