static struct glfs_preopened {
char *volume;
+ char *connectpath;
glfs_t *fs;
int ref;
struct glfs_preopened *next, *prev;
} *glfs_preopened;
-static int glfs_set_preopened(const char *volume, glfs_t *fs)
+static int glfs_set_preopened(const char *volume, const char *connectpath, glfs_t *fs)
{
struct glfs_preopened *entry = NULL;
return -1;
}
+ entry->connectpath = talloc_strdup(entry, connectpath);
+ if (entry->connectpath == NULL) {
+ talloc_free(entry);
+ errno = ENOMEM;
+ return -1;
+ }
+
entry->fs = fs;
entry->ref = 1;
return 0;
}
-static glfs_t *glfs_find_preopened(const char *volume)
+static glfs_t *glfs_find_preopened(const char *volume, const char *connectpath)
{
struct glfs_preopened *entry = NULL;
for (entry = glfs_preopened; entry; entry = entry->next) {
- if (strcmp(entry->volume, volume) == 0) {
+ if (strcmp(entry->volume, volume) == 0 &&
+ strcmp(entry->connectpath, connectpath) == 0)
+ {
entry->ref++;
return entry->fs;
}
volume = service;
}
- fs = glfs_find_preopened(volume);
+ fs = glfs_find_preopened(volume, handle->conn->connectpath);
if (fs) {
goto done;
}
goto done;
}
- ret = glfs_set_preopened(volume, fs);
+ ret = glfs_set_preopened(volume, handle->conn->connectpath, fs);
if (ret < 0) {
DEBUG(0, ("%s: Failed to register volume (%s)\n",
volume, strerror(errno)));