Bug 1038924 - glfs_fini in libgfapi closes stderr if stderr is used as logfile
Summary: glfs_fini in libgfapi closes stderr if stderr is used as logfile
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: libgfapi
Version: mainline
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Poornima G
QA Contact: Sudhir D
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-06 07:16 UTC by Bharata B Rao
Modified: 2014-04-17 11:52 UTC (History)
2 users (show)

Fixed In Version: glusterfs-3.5.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-17 11:52:04 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Bharata B Rao 2013-12-06 07:16:33 UTC
Description of problem:

As part of glfs_fini(), stderr is closed by libgfapi. This is problematic for applications that are linked to libfapi but are using stderr for their own error logging purpose.

The solution is to explicitly check if stderr is being used as logfile and not close it.

Comment 1 Anand Avati 2013-12-06 07:17:50 UTC
REVIEW: http://review.gluster.org/6452 (gfapi: Don't close stderr logfile) posted (#1) for review on master by Bharata B Rao (bharata.rao)

Comment 2 Anand Avati 2013-12-10 03:25:44 UTC
REVIEW: http://review.gluster.org/6452 (libglusterfs: Explicitly open /dev/stderr logfile) posted (#2) for review on master by Bharata B Rao (bharata.rao)

Comment 3 Anand Avati 2013-12-10 17:18:08 UTC
COMMIT: http://review.gluster.org/6452 committed in master by Anand Avati (avati) 
------
commit 00b159840added72099f61f45b38133e856d23bf
Author: Bharata B Rao <bharata.ibm.com>
Date:   Mon Dec 9 11:15:02 2013 +0530

    libglusterfs: Explicitly open /dev/stderr logfile
    
    Currently if stderr is specified as logfile, /dev/stderr isn't opened but
    stderr is directly used. However libgfapi closes the logfile (and hence
    stderr) from glfs_fini() which results in stderr becoming unavailable for
    the application that links to libgfapi. Prevent this unexpected behaviour
    for the application by explicitly opening /dev/stderr like it is done for
    any other logfile.
    
    Change-Id: I76b754598a2acf40b91ff0461726c5918e278c84
    BUG: 1038924
    Signed-off-by: Bharata B Rao <bharata.ibm.com>
    Reviewed-on: http://review.gluster.org/6452
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Anand Avati <avati>

Comment 4 Vijay Bellur 2013-12-11 06:19:57 UTC
Bharata, can you please send a backport to release-3.5 as well?

Comment 5 Anand Avati 2013-12-11 06:37:35 UTC
REVIEW: http://review.gluster.org/6477 (libglusterfs: Explicitly open /dev/stderr logfile) posted (#1) for review on release-3.5 by Bharata B Rao (bharata.rao)

Comment 6 Anand Avati 2013-12-11 08:42:05 UTC
COMMIT: http://review.gluster.org/6477 committed in release-3.5 by Vijay Bellur (vbellur) 
------
commit e29080425a762232a90229c380c1ac52593dd0cc
Author: Bharata B Rao <bharata.ibm.com>
Date:   Wed Dec 11 12:03:59 2013 +0530

    libglusterfs: Explicitly open /dev/stderr logfile
    
    From: Bharata B Rao <bharata.ibm.com>
    
    Currently if stderr is specified as logfile, /dev/stderr isn't opened but
    stderr is directly used. However libgfapi closes the logfile (and hence
    stderr) from glfs_fini() which results in stderr becoming unavailable for
    the application that links to libgfapi. Prevent this unexpected behaviour
    for the application by explicitly opening /dev/stderr like it is done for
    any other logfile.
    
    Change-Id: I76b754598a2acf40b91ff0461726c5918e278c84
    BUG: 1038924
    Signed-off-by: Bharata B Rao <bharata.ibm.com>
    Reviewed-on: http://review.gluster.org/6477
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Vijay Bellur <vbellur>

Comment 7 Niels de Vos 2014-04-17 11:52:04 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-3.5.0, please reopen this bug report.

glusterfs-3.5.0 has been announced on the Gluster Developers mailinglist [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] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/6137
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user


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