"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xlators/mount/fuse/src/fuse-bridge.c" between
glusterfs-7.5.tar.gz and glusterfs-7.6.tar.gz

About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 7.x (latest version).

fuse-bridge.c  (glusterfs-7.5):fuse-bridge.c  (glusterfs-7.6)
skipping to change at line 208 skipping to change at line 208
memcpy(fsig->sig, glustersig, 8); memcpy(fsig->sig, glustersig, 8);
iovs[0] = (struct iovec){dir, sizeof(*dir)}; iovs[0] = (struct iovec){dir, sizeof(*dir)};
iovs[1] = (struct iovec){fusedump_item_count, sizeof(*fusedump_item_count)}; iovs[1] = (struct iovec){fusedump_item_count, sizeof(*fusedump_item_count)};
iovs[2] = (struct iovec){fts, fts->len}; iovs[2] = (struct iovec){fts, fts->len};
iovs[3] = (struct iovec){fsig, fsig->len}; iovs[3] = (struct iovec){fsig, fsig->len};
} }
static int static int
check_and_dump_fuse_W(fuse_private_t *priv, struct iovec *iov_out, int count, check_and_dump_fuse_W(fuse_private_t *priv, struct iovec *iov_out, int count,
ssize_t res) ssize_t res, errnomask_t errnomask)
{ {
char w = 'W'; char w = 'W';
struct iovec diov[4] = { struct iovec diov[4] = {
{ {
0, 0,
}, },
}; };
uint32_t fusedump_item_count = 3; uint32_t fusedump_item_count = 3;
struct fusedump_timespec fts = { struct fusedump_timespec fts = {
0, 0,
}; };
struct fusedump_signature fsig = { struct fusedump_signature fsig = {
0, 0,
}; };
struct fuse_out_header *fouh = NULL; struct fuse_out_header *fouh = NULL;
if (res == -1) { if (res == -1) {
gf_log_callingfn("glusterfs-fuse", GF_LOG_ERROR, const char *errdesc = NULL;
"writing to fuse device failed: %s", strerror(errno)); gf_loglevel_t loglevel = GF_LOG_ERROR;
/* If caller masked the errno, then it
* does not indicate an error at the application
* level, so we degrade the log severity to DEBUG.
*/
if (errnomask && errno < ERRNOMASK_MAX &&
GET_ERRNO_MASK(errnomask, errno))
loglevel = GF_LOG_DEBUG;
switch (errno) {
/* The listed errnos are FUSE status indicators,
* not legit values according to POSIX (see write(3p)),
* so resolving them according to the standard
* POSIX interpretation would be misleading.
*/
case ENOENT:
errdesc = "ENOENT";
break;
case ENOTDIR:
errdesc = "ENOTDIR";
break;
case ENODEV:
errdesc = "ENODEV";
break;
case EPERM:
errdesc = "EPERM";
break;
case ENOMEM:
errdesc = "ENOMEM";
break;
case ENOTCONN:
errdesc = "ENOTCONN";
break;
case ECONNREFUSED:
errdesc = "ECONNREFUSED";
break;
case EOVERFLOW:
errdesc = "EOVERFLOW";
break;
case EBUSY:
errdesc = "EBUSY";
break;
case ENOTEMPTY:
errdesc = "ENOTEMPTY";
break;
default:
errdesc = strerror(errno);
}
gf_log_callingfn("glusterfs-fuse", loglevel,
"writing to fuse device failed: %s", errdesc);
return errno; return errno;
} }
fouh = iov_out[0].iov_base; fouh = iov_out[0].iov_base;
if (res != fouh->len) { if (res != fouh->len) {
gf_log("glusterfs-fuse", GF_LOG_ERROR, gf_log("glusterfs-fuse", GF_LOG_ERROR,
"inconsistent write to fuse device: " "inconsistent write to fuse device: "
"written %zd, expectd %d", "written %zd, expectd %d",
res, fouh->len); res, fouh->len);
return EINVAL; return EINVAL;
skipping to change at line 292 skipping to change at line 343
iov_out[0].iov_len = sizeof(*fouh); iov_out[0].iov_len = sizeof(*fouh);
fouh->len = 0; fouh->len = 0;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
fouh->len += iov_out[i].iov_len; fouh->len += iov_out[i].iov_len;
fouh->unique = finh->unique; fouh->unique = finh->unique;
res = sys_writev(priv->fd, iov_out, count); res = sys_writev(priv->fd, iov_out, count);
gf_log("glusterfs-fuse", GF_LOG_TRACE, "writev() result %d/%d %s", res, gf_log("glusterfs-fuse", GF_LOG_TRACE, "writev() result %d/%d %s", res,
fouh->len, res == -1 ? strerror(errno) : ""); fouh->len, res == -1 ? strerror(errno) : "");
return check_and_dump_fuse_W(priv, iov_out, count, res); return check_and_dump_fuse_W(priv, iov_out, count, res, NULL);
} }
static int static int
send_fuse_data(xlator_t *this, fuse_in_header_t *finh, void *data, size_t size) send_fuse_data(xlator_t *this, fuse_in_header_t *finh, void *data, size_t size)
{ {
struct fuse_out_header fouh = { struct fuse_out_header fouh = {
0, 0,
}; };
struct iovec iov_out[2]; struct iovec iov_out[2];
int ret = 0; int ret = 0;
skipping to change at line 358 skipping to change at line 409
break; break;
INIT_LIST_HEAD(&node->next); INIT_LIST_HEAD(&node->next);
fouh = (struct fuse_out_header *)node->inval_buf; fouh = (struct fuse_out_header *)node->inval_buf;
fnieo = (struct fuse_notify_inval_entry_out *)(fouh + 1); fnieo = (struct fuse_notify_inval_entry_out *)(fouh + 1);
fouh->unique = 0; fouh->unique = 0;
fouh->error = FUSE_NOTIFY_INVAL_ENTRY; fouh->error = FUSE_NOTIFY_INVAL_ENTRY;
if (ENOENT < ERRNOMASK_MAX)
MASK_ERRNO(node->errnomask, ENOENT);
if (ENOTDIR < ERRNOMASK_MAX)
MASK_ERRNO(node->errnomask, ENOTDIR);
if (EBUSY < ERRNOMASK_MAX)
MASK_ERRNO(node->errnomask, EBUSY);
if (ENOTEMPTY < ERRNOMASK_MAX)
MASK_ERRNO(node->errnomask, ENOTEMPTY);
if (dentry->name) { if (dentry->name) {
nlen = strlen(dentry->name); nlen = strlen(dentry->name);
fouh->len = sizeof(*fouh) + sizeof(*fnieo) + nlen + 1; fouh->len = sizeof(*fouh) + sizeof(*fnieo) + nlen + 1;
fnieo->parent = inode_to_fuse_nodeid(dentry->parent); fnieo->parent = inode_to_fuse_nodeid(dentry->parent);
fnieo->namelen = nlen; fnieo->namelen = nlen;
strcpy((node->inval_buf + sizeof(*fouh) + sizeof(*fnieo)), strcpy((node->inval_buf + sizeof(*fouh) + sizeof(*fnieo)),
dentry->name); dentry->name);
} }
skipping to change at line 436 skipping to change at line 496
fouh->unique = 0; fouh->unique = 0;
fouh->error = FUSE_NOTIFY_INVAL_INODE; fouh->error = FUSE_NOTIFY_INVAL_INODE;
fouh->len = sizeof(struct fuse_out_header) + fouh->len = sizeof(struct fuse_out_header) +
sizeof(struct fuse_notify_inval_inode_out); sizeof(struct fuse_notify_inval_inode_out);
/* inval the entire mapping until we learn how to be more granular */ /* inval the entire mapping until we learn how to be more granular */
fniio->ino = fuse_ino; fniio->ino = fuse_ino;
fniio->off = 0; fniio->off = 0;
fniio->len = -1; fniio->len = -1;
if (ENOENT < ERRNOMASK_MAX)
MASK_ERRNO(node->errnomask, ENOENT);
fuse_log_eh(this, "Invalidated inode %" PRIu64 " (gfid: %s)", fuse_ino, fuse_log_eh(this, "Invalidated inode %" PRIu64 " (gfid: %s)", fuse_ino,
uuid_utoa(inode->gfid)); uuid_utoa(inode->gfid));
gf_log("glusterfs-fuse", GF_LOG_TRACE, gf_log("glusterfs-fuse", GF_LOG_TRACE,
"INVALIDATE inode: %" PRIu64 "(gfid:%s)", fuse_ino, "INVALIDATE inode: %" PRIu64 "(gfid:%s)", fuse_ino,
uuid_utoa(inode->gfid)); uuid_utoa(inode->gfid));
pthread_mutex_lock(&priv->invalidate_mutex); pthread_mutex_lock(&priv->invalidate_mutex);
{ {
list_add_tail(&node->next, &priv->invalidate_list); list_add_tail(&node->next, &priv->invalidate_list);
pthread_cond_signal(&priv->invalidate_cond); pthread_cond_signal(&priv->invalidate_cond);
skipping to change at line 479 skipping to change at line 542
fuse_timed_message_t *dmsg = NULL; fuse_timed_message_t *dmsg = NULL;
dmsg = GF_MALLOC(sizeof(*dmsg), gf_fuse_mt_timed_message_t); dmsg = GF_MALLOC(sizeof(*dmsg), gf_fuse_mt_timed_message_t);
if (!dmsg) { if (!dmsg) {
return NULL; return NULL;
} }
/* should be NULL if not set */ /* should be NULL if not set */
dmsg->fuse_message_body = NULL; dmsg->fuse_message_body = NULL;
INIT_LIST_HEAD(&dmsg->next); INIT_LIST_HEAD(&dmsg->next);
memset(dmsg->errnomask, 0, sizeof(dmsg->errnomask));
return dmsg; return dmsg;
} }
static void static void
fuse_timed_message_free(fuse_timed_message_t *dmsg) fuse_timed_message_free(fuse_timed_message_t *dmsg)
{ {
GF_FREE(dmsg->fuse_message_body); GF_FREE(dmsg->fuse_message_body);
GF_FREE(dmsg); GF_FREE(dmsg);
} }
skipping to change at line 677 skipping to change at line 741
":" ":"
" failed to allocate timed message", " failed to allocate timed message",
finh->unique, fii->unique); finh->unique, fii->unique);
goto out; goto out;
} }
dmsg->fuse_out_header.unique = finh->unique; dmsg->fuse_out_header.unique = finh->unique;
dmsg->fuse_out_header.len = sizeof(dmsg->fuse_out_header); dmsg->fuse_out_header.len = sizeof(dmsg->fuse_out_header);
dmsg->fuse_out_header.error = -EAGAIN; dmsg->fuse_out_header.error = -EAGAIN;
if (ENOENT < ERRNOMASK_MAX)
MASK_ERRNO(dmsg->errnomask, ENOENT);
timespec_now(&dmsg->scheduled_ts); timespec_now(&dmsg->scheduled_ts);
timespec_adjust_delta(&dmsg->scheduled_ts, timespec_adjust_delta(&dmsg->scheduled_ts,
(struct timespec){0, 10000000}); (struct timespec){0, 10000000});
send_fuse_timed(this, dmsg); send_fuse_timed(this, dmsg);
} }
out: out:
GF_FREE(finh); GF_FREE(finh);
} }
skipping to change at line 4855 skipping to change at line 4921
* even stalling the insn pipeline. * even stalling the insn pipeline.
* Other architectures will not be so forgiving. If * Other architectures will not be so forgiving. If
* we're lucky the memcpy will be inlined by the * we're lucky the memcpy will be inlined by the
* compiler, and might be as fast or faster without * compiler, and might be as fast or faster without
* the risk of stalling the insn pipeline. * the risk of stalling the insn pipeline.
*/ */
iov_out.iov_base = node->inval_buf; iov_out.iov_base = node->inval_buf;
iov_out.iov_len = len; iov_out.iov_len = len;
rv = sys_writev(priv->fd, &iov_out, 1); rv = sys_writev(priv->fd, &iov_out, 1);
check_and_dump_fuse_W(priv, &iov_out, 1, rv); check_and_dump_fuse_W(priv, &iov_out, 1, rv, node->errnomask);
GF_FREE(node); GF_FREE(node);
if (rv == -1 && errno == EBADF) if (rv == -1 && errno == EBADF)
break; break;
if (rv != len && !(rv == -1 && errno == ENOENT)) { if (rv != len && !(rv == -1 && errno == ENOENT)) {
gf_log("glusterfs-fuse", GF_LOG_INFO, "len: %u, rv: %zd, errno: %d", gf_log("glusterfs-fuse", GF_LOG_INFO, "len: %u, rv: %zd, errno: %d",
len, rv, errno); len, rv, errno);
} }
skipping to change at line 4946 skipping to change at line 5012
"sending timed " "sending timed "
"message of unique %" PRIu64, "message of unique %" PRIu64,
dmsg->fuse_out_header.unique); dmsg->fuse_out_header.unique);
len = dmsg->fuse_out_header.len; len = dmsg->fuse_out_header.len;
iovs[0] = (struct iovec){&dmsg->fuse_out_header, iovs[0] = (struct iovec){&dmsg->fuse_out_header,
sizeof(struct fuse_out_header)}; sizeof(struct fuse_out_header)};
iovs[1] = (struct iovec){dmsg->fuse_message_body, iovs[1] = (struct iovec){dmsg->fuse_message_body,
len - sizeof(struct fuse_out_header)}; len - sizeof(struct fuse_out_header)};
rv = sys_writev(priv->fd, iovs, 2); rv = sys_writev(priv->fd, iovs, 2);
check_and_dump_fuse_W(priv, iovs, 2, rv); check_and_dump_fuse_W(priv, iovs, 2, rv, dmsg->errnomask);
fuse_timed_message_free(dmsg); fuse_timed_message_free(dmsg);
if (rv == -1 && errno == EBADF) { if (rv == -1 && errno == EBADF) {
break; break;
} }
if (rv != len && !(rv == -1 && errno == ENOENT)) { if (rv != len && !(rv == -1 && errno == ENOENT)) {
gf_log("glusterfs-fuse", GF_LOG_INFO, gf_log("glusterfs-fuse", GF_LOG_INFO,
"len: %zu, rv: %zd, errno: %d", len, rv, errno); "len: %zu, rv: %zd, errno: %d", len, rv, errno);
 End of changes. 9 change blocks. 
6 lines changed or deleted 72 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)