summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-fops.c
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-01-21 13:49:08 +0000
committerJeff Darcy <jdarcy@redhat.com>2014-01-21 13:49:08 +0000
commit6bcbf03b5aa4448832645a29ec2bc4b2fc5f2eaf (patch)
tree750f73a40aa62c20d66a2532fef6fd158cebb9c4 /api/src/glfs-fops.c
parent0225d7bc712609232d592d48116ec771cd97c2cf (diff)
parent17c4fb2d04f84b5632983866e8bddfbd7d77a054 (diff)
Merge branch 'upstream'
Conflicts: api/src/glfs-fops.c api/src/glfs-handleops.c Change-Id: I6811674cc4ec4be6fa6e4cdebb4bc428194bebd8
Diffstat (limited to 'api/src/glfs-fops.c')
-rw-r--r--api/src/glfs-fops.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index e1fa697f9..aa359a992 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -124,6 +124,7 @@ retry:
}
ret = syncop_open (subvol, &loc, flags, glfd->fd);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
out:
@@ -169,6 +170,7 @@ glfs_close_with_xdata (struct glfs_fd *glfd, dict_t *dict)
}
ret = syncop_flush_with_xdata (subvol, fd, dict);
+ DECODE_SYNCOP_ERR (ret);
out:
fs = glfd->fs;
glfs_fd_destroy (glfd);
@@ -278,6 +280,7 @@ glfs_fstat_with_xdata (struct glfs_fd *glfd, struct stat *stat, dict_t *dict)
}
ret = syncop_fstat_with_xdata (subvol, fd, &iatt, dict);
+ DECODE_SYNCOP_ERR (ret);
if (ret == 0 && stat)
glfs_iatt_to_stat (glfd->fs, &iatt, stat);
@@ -393,9 +396,11 @@ retry:
if (ret == 0) {
ret = syncop_open (subvol, &loc, flags, glfd->fd);
+ DECODE_SYNCOP_ERR (ret);
} else {
ret = syncop_create (subvol, &loc, flags, mode, glfd->fd,
xattr_req, &iatt);
+ DECODE_SYNCOP_ERR (ret);
}
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -507,6 +512,7 @@ glfs_preadv_with_xdata (struct glfs_fd *glfd, const struct iovec *iovec, int iov
size = iov_length (iovec, iovcnt);
ret = syncop_readv_with_xdata (subvol, fd, size, offset, 0, &iov, &cnt, &iobref, dict);
+ DECODE_SYNCOP_ERR (ret);
if (ret <= 0)
goto out;
@@ -881,6 +887,7 @@ glfs_pwritev_with_xdata (struct glfs_fd *glfd, const struct iovec *iovec, int io
iov.iov_len = size;
ret = syncop_writev_with_xdata (subvol, fd, &iov, 1, offset, iobref, flags, dict);
+ DECODE_SYNCOP_ERR (ret);
iobuf_unref (iobuf);
iobref_unref (iobref);
@@ -1077,6 +1084,7 @@ glfs_fsync_with_xdata (struct glfs_fd *glfd, dict_t *dict)
}
ret = syncop_fsync_with_xdata (subvol, fd, 0, dict);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref (fd);
@@ -1156,6 +1164,7 @@ glfs_fdatasync (struct glfs_fd *glfd)
}
ret = syncop_fsync (subvol, fd, 1);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref (fd);
@@ -1197,6 +1206,7 @@ glfs_ftruncate_with_xdata (struct glfs_fd *glfd, off_t offset, dict_t *dict)
}
ret = syncop_ftruncate_with_xdata (subvol, fd, offset, dict);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref (fd);
@@ -1270,6 +1280,7 @@ retry:
goto out;
ret = syncop_access (subvol, &loc, mode);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
out:
@@ -1335,6 +1346,7 @@ retry:
}
ret = syncop_symlink (subvol, &loc, data, xattr_req, &iatt);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -1401,6 +1413,7 @@ retry:
}
ret = syncop_readlink (subvol, &loc, &linkval, bufsiz);
+ DECODE_SYNCOP_ERR (ret);
if (ret > 0) {
memcpy (buf, linkval, ret);
GF_FREE (linkval);
@@ -1471,6 +1484,7 @@ retry:
}
ret = syncop_mknod (subvol, &loc, mode, dev, xattr_req, &iatt);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -1558,6 +1572,7 @@ retry:
}
ret = syncop_mkdir (subvol, &loc, mode, xattr_req, &iatt);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -1623,6 +1638,7 @@ retry:
}
ret = syncop_unlink_with_xdata (subvol, &loc, dict);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -1674,6 +1690,7 @@ retry:
}
ret = syncop_rmdir_with_xdata (subvol, &loc, 0, dict);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -1742,6 +1759,7 @@ retrynew:
/* TODO: check if new or old is a prefix of the other, and fail EINVAL */
ret = syncop_rename_with_xdata (subvol, &oldloc, &newloc, dict);
+ DECODE_SYNCOP_ERR (ret);
if (ret == -1 && errno == ESTALE) {
if (reval < DEFAULT_REVAL_COUNT) {
@@ -1825,6 +1843,7 @@ retrynew:
newloc.inode = inode_ref (oldloc.inode);
ret = syncop_link_with_xdata (subvol, &oldloc, &newloc, dict);
+ DECODE_SYNCOP_ERR (ret);
if (ret == -1 && errno == ESTALE) {
loc_wipe (&oldloc);
@@ -1904,6 +1923,7 @@ retry:
}
ret = syncop_opendir (subvol, &loc, glfd->fd);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
out:
@@ -1912,7 +1932,7 @@ out:
if (ret && glfd) {
glfs_fd_destroy (glfd);
glfd = NULL;
- } else {
+ } else if (glfd) {
fd_bind (glfd->fd);
glfs_fd_bind (glfd);
}
@@ -2094,6 +2114,7 @@ glfd_entry_refresh (struct glfs_fd *glfd, int plus)
else
ret = syncop_readdir (subvol, fd, 131072, glfd->offset,
&entries);
+ DECODE_SYNCOP_ERR (ret);
if (ret >= 0) {
if (plus)
gf_link_inodes_from_dirent (THIS, fd->inode, &entries);
@@ -2272,6 +2293,7 @@ retry:
goto out;
ret = syncop_statfs (subvol, &loc, buf);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
out:
@@ -2313,6 +2335,7 @@ retry:
goto out;
ret = syncop_setattr_with_xdata (subvol, &loc, iatt, valid, 0, 0, dict);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
out:
@@ -2354,6 +2377,7 @@ glfs_fsetattr_with_xdata (struct glfs_fd *glfd, struct iatt *iatt, int valid, di
}
ret = syncop_fsetattr_with_xdata (subvol, fd, iatt, valid, 0, 0, dict);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref (fd);
@@ -2575,6 +2599,7 @@ retry:
goto out;
ret = syncop_getxattr (subvol, &loc, &xattr, name);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -2633,6 +2658,7 @@ glfs_fgetxattr_with_xdata (struct glfs_fd *glfd, const char *name, void *value,
}
ret = syncop_fgetxattr_with_xdata (subvol, fd, &xattr, name, dict);
+ DECODE_SYNCOP_ERR (ret);
if (ret)
goto out;
@@ -2709,6 +2735,7 @@ retry:
goto out;
ret = syncop_getxattr (subvol, &loc, &xattr, NULL);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -2764,6 +2791,7 @@ glfs_flistxattr_with_xdata (struct glfs_fd *glfd, void *value, size_t size,dict_
}
ret = syncop_fgetxattr_with_xdata (subvol, fd, &xattr, NULL, dict);
+ DECODE_SYNCOP_ERR (ret);
if (ret)
goto out;
@@ -2842,6 +2870,7 @@ retry:
}
ret = syncop_setxattr_with_xdata (subvol, &loc, xattr, flags, dict);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -2911,6 +2940,7 @@ glfs_fsetxattr_with_xdata (struct glfs_fd *glfd, const char *name, const void *v
}
ret = syncop_fsetxattr_with_xdata (subvol, fd, xattr, flags, dict);
+ DECODE_SYNCOP_ERR (ret);
out:
if (xattr)
dict_unref (xattr);
@@ -2960,6 +2990,7 @@ retry:
goto out;
ret = syncop_removexattr_with_xdata (subvol, &loc, name, dict);
+ DECODE_SYNCOP_ERR (ret);
ESTALE_RETRY (ret, errno, reval, &loc, retry);
@@ -3016,6 +3047,7 @@ glfs_fremovexattr_with_xdata (struct glfs_fd *glfd, const char *name, dict_t *di
}
ret = syncop_fremovexattr_with_xdata (subvol, fd, name, dict);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref (fd);
@@ -3055,6 +3087,7 @@ glfs_fallocate (struct glfs_fd *glfd, int keep_size, off_t offset, size_t len)
}
ret = syncop_fallocate (subvol, fd, keep_size, offset, len);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref(fd);
@@ -3089,6 +3122,7 @@ glfs_discard (struct glfs_fd *glfd, off_t offset, size_t len)
}
ret = syncop_discard (subvol, fd, offset, len);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref(fd);
@@ -3120,6 +3154,7 @@ glfs_zerofill (struct glfs_fd *glfd, off_t offset, off_t len)
}
ret = syncop_zerofill (subvol, fd, offset, len);
+ DECODE_SYNCOP_ERR (ret);
out:
if (fd)
fd_unref(fd);
@@ -3367,6 +3402,7 @@ glfs_posix_lock (struct glfs_fd *glfd, int cmd, struct flock *flock)
gf_flock_from_flock (&gf_flock, flock);
gf_flock_from_flock (&saved_flock, flock);
ret = syncop_lk (subvol, fd, cmd, &gf_flock);
+ DECODE_SYNCOP_ERR (ret);
gf_flock_to_flock (&gf_flock, flock);
if (ret == 0 && (cmd == F_SETLK || cmd == F_SETLKW))