Bug 815040 - [glusterfs-3.2.6qa1]: possible deadlock in io-cache reconfigure
[glusterfs-3.2.6qa1]: possible deadlock in io-cache reconfigure
Status: CLOSED UPSTREAM
Product: Red Hat Gluster Storage
Classification: Red Hat
Component: glusterfs (Show other bugs)
1.0
Unspecified Unspecified
urgent Severity high
: ---
: ---
Assigned To: Raghavendra G
:
Depends On: 782286
Blocks: 811632
  Show dependency treegraph
 
Reported: 2012-04-22 03:20 EDT by Scott Haines
Modified: 2015-01-22 10:30 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 782286
Environment:
Last Closed: 2012-04-26 21:26:38 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 Scott Haines 2012-04-22 03:20:52 EDT
+++ This bug was initially created as a clone of Bug #782286 +++

Description of problem:

There is a possibility of deadlock in reconfigure of io-cache xlator.

In reconfigure function we do this.

int
reconfigure (xlator_t *this, dict_t *options)
{
	ioc_table_t *table             = NULL;
	int32_t      cache_timeout     = 0;
	int64_t      min_file_size     = 0;
	int64_t      max_file_size     = 0;
	char        *tmp               = NULL;
	uint64_t     cache_size        = 0;
        char        *cache_size_string = NULL;
	int          ret               = 0;

        if (!this || !this->private)
                goto out;

        table = this->private;

	ioc_table_lock (table);
        {
                if (dict_get (options, "cache-timeout")) {
			cache_timeout =
		                data_to_uint32 (dict_get (options,
                	                                  "cache-timeout"));
		        if (cache_timeout < 0){

i.e. we take the lock in ioc_table_t, then we go on looking for any io-cache options i the dict. Suppose some options are given wrong or dict_get from the dictionary fails, then we do this (i.e. goto out)

if (cache_timeout < 0){
                                gf_log (this->name, GF_LOG_WARNING,
                                        "cache-timeout %d seconds invalid,"
                                        " has to be  >=0", cache_timeout);
                                goto out;
                        }


But in the "out" we directly return instead of unlocking the table, thus leading to the deadlock and application hang.

	ioc_table_unlock (table);
out:
        return ret;

}

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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

--- Additional comment from aavati@redhat.com on 2012-01-20 01:30:00 EST ---

CHANGE: http://review.gluster.com/2649 (performance/io-cache: if the reconfigure option given is wrong, then unlock and return) merged in release-3.2 by Vijay Bellur (vijay@gluster.com)

--- Additional comment from rabhat@redhat.com on 2012-02-20 00:56:42 EST ---

Tested with glusterfs-3.2.6qa3. Now there is no deadlock in io-cache reconfigure since for every case we are unlocking before returning.

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