Bug 762557 (GLUSTER-825) - when create() races both return success
Summary: when create() races both return success
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: GLUSTER-825
Product: GlusterFS
Classification: Community
Component: posix
Version: mainline
Hardware: All
OS: Linux
high
medium
Target Milestone: ---
Assignee: Raghavendra Bhat
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-16 23:27 UTC by Krishna Srinivas
Modified: 2015-12-01 16:45 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Krishna Srinivas 2010-04-16 23:27:59 UTC
On client side:
[2010-04-16 11:54:19] W [fuse-bridge.c:1913:fuse_writev_cbk] glusterfs-fuse: 575442787: WRITE => -1 (Operation not permitted)
[2010-04-16 11:54:19] W [fuse-bridge.c:1174:fuse_err_cbk] glusterfs-fuse: 575442788: FLUSH() ERR => -1 (Operation not permitted)

On server side:
[2010-04-16 11:54:07] E [posix.c:2245:posix_create] brick-posix: open on /clients/csb-archive/NAS-backup/mnt/scippy_images/00018212/00029288/00090152/DICOMDI
R failed: File exists

Looking at posix.c:

        op_ret = posix_lstat_with_gen (this, real_path, &stbuf);
        if ((op_ret == -1) && (errno == ENOENT)) {
                was_present = 0;
        }

        if (priv->o_direct)
                _flags |= O_DIRECT;

        _fd = open (real_path, _flags, mode);

        if (_fd == -1) {
                op_errno = errno;
                gf_log (this->name, GF_LOG_ERROR,
                        "open on %s failed: %s", loc->path,
                        strerror (op_errno));
                goto out;
        }


When open() fails op_ret is still 0 because previous posix_lstat_with_gen() returns 0
Hence when STACK_UNWIND is done it returns op_ret as 0. Application thinks create succeeded but when it calls write, fd_ctx_get returns -1, This -(-1) = 1 is EPERM is returned as op_errno by posix_writev which is Operation not permitted which is the error seen in fuse-bridge log on the client side.

Comment 1 Anand Avati 2010-04-27 06:38:13 UTC
PATCH: http://patches.gluster.com/patch/3170 in master (Set op_ret to -1 when open fails in posix_create)

Comment 2 Anand Avati 2010-04-27 06:38:29 UTC
PATCH: http://patches.gluster.com/patch/3169 in release-3.0 (Set op_ret to -1 when open fails in posix create)


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