gluster-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gluster-devel] [PATCH 3/3 v4] vfs_glusterfs: Samba VFS module for g


From: Anand Avati
Subject: Re: [Gluster-devel] [PATCH 3/3 v4] vfs_glusterfs: Samba VFS module for glusterfs
Date: Thu, 23 May 2013 22:38:12 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 5/23/13 9:31 PM, Andrew Bartlett wrote:
Sorry for not finding this before, but I just noticed this:

You couldn't because it was malloc() based in the previous patch. I changed it (wrongly) based on a review comment outside the mailing list. Thanks for catching! Will send out a v5 patch.

Avati

On Thu, 2013-05-23 at 22:30 -0400, Anand Avati wrote:
static char *vfs_gluster_getwd(struct vfs_handle_struct *handle)
+{
+       char *cwd;
+       char *ret;
+
+       cwd = TALLOC_ZERO(NULL, PATH_MAX+1);
+       if (!cwd)
+               return NULL;
+
+       ret = glfs_getcwd(handle->data, cwd, PATH_MAX);
+       if (!ret)
+               TALLOC_FREE(cwd);
+       return ret;
+}

While you would expect that getwd would return a talloc-based result, it
doesn't actually:

The other userspace filesystem ceph does:

static char *cephwrap_getwd(struct vfs_handle_struct *handle)
{
        const char *cwd = ceph_getcwd(handle->data);
        DEBUG(10, ("[CEPH] getwd(%p) = %s\n", handle, cwd));
        return SMB_STRDUP(cwd);
}

vfs_default does:

static char *vfswrap_getwd(vfs_handle_struct *handle)
{
        char *result;

        START_PROFILE(syscall_getwd);
        result = sys_getwd();
        END_PROFILE(syscall_getwd);
        return result;
}

(and sys_getwd() in system.c is malloc based).

The best fix would be to convert the callers and VFS API to use talloc
(and pass in a talloc context).  There are only two, in
source3/smbd/vfs.c:vfs_GetWd(), and
source3/torture/cmd_vfs.c:cmd_getwd().  The former really wants a talloc
result anyway!

Andrew Bartlett





reply via email to

[Prev in Thread] Current Thread [Next in Thread]