diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-08-17 14:21:07 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-20 00:16:01 -0700 |
commit | 2f2e3bfb5ef89b5ba266a3df7496f95b11fb93e1 (patch) | |
tree | cf4b12316f6fd241858614690dcdc35b284ea7f9 | |
parent | 99f0daf2f46d56b78adfe1a3df1195e1388feaab (diff) |
syncop: handle 'dataonly' flag in syncop_fsync()
* and also in syncop_readv(), don't look at _cbk args if op_ret
is < 0.
Change-Id: I3ab2982bc6d186e75b6adb74c8981e4ff7058bbe
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 839950
Reviewed-on: http://review.gluster.org/3828
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | api/src/glfs-fops.c | 6 | ||||
-rw-r--r-- | api/src/glfs.c | 2 | ||||
-rw-r--r-- | libglusterfs/src/syncop.c | 11 | ||||
-rw-r--r-- | libglusterfs/src/syncop.h | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 2 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 2 |
6 files changed, 13 insertions, 12 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index f3fba84e4e7..6ae0426ac8f 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -699,8 +699,7 @@ glfs_fsync (struct glfs_fd *glfd) goto out; } - ret = syncop_fsync (subvol, glfd->fd); -// ret = syncop_fsync (subvol, glfd->fd, 0); + ret = syncop_fsync (subvol, glfd->fd, 0); out: return ret; } @@ -761,8 +760,7 @@ glfs_fdatasync (struct glfs_fd *glfd) goto out; } - ret = syncop_fsync (subvol, glfd->fd); -// ret = syncop_fsync (subvol, glfd->fd, 1); + ret = syncop_fsync (subvol, glfd->fd, 1); out: return ret; } diff --git a/api/src/glfs.c b/api/src/glfs.c index 6b3c2113d53..f0bdc86f0c6 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -16,14 +16,12 @@ reach it via THIS. - fd migration on graph switch. - update syncop functions to accept/return xdata. ??? - - syncop_readv to not touch params if args.op_ret < 0. - protocol/client to reconnect immediately after portmap disconnect. - handle SEEK_END failure in _lseek() - handle umask (per filesystem?) - implement glfs_set_xlator_option(), like --xlator-option - make itables LRU based - implement glfs_fini() - - modify syncop_fsync() to accept 'dataonly' flag - 0-copy for readv/writev - reconcile the open/creat mess */ diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index cbd20251500..2f80f5d8009 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -989,9 +989,13 @@ syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off, SYNCOP (subvol, (&args), syncop_readv_cbk, subvol->fops->readv, fd, size, off, flags, NULL); + if (args.op_ret < 0) + goto out; + if (vector) *vector = args.vector; - else GF_FREE (args.vector); + else + GF_FREE (args.vector); if (count) *count = args.count; @@ -1002,6 +1006,7 @@ syncop_readv (xlator_t *subvol, fd_t *fd, size_t size, off_t off, else if (args.iobref) iobref_unref (args.iobref); +out: errno = args.op_errno; return args.op_ret; @@ -1220,12 +1225,12 @@ syncop_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } int -syncop_fsync (xlator_t *subvol, fd_t *fd) +syncop_fsync (xlator_t *subvol, fd_t *fd, int dataonly) { struct syncargs args = {0, }; SYNCOP (subvol, (&args), syncop_fsync_cbk, subvol->fops->fsync, - fd, 0, NULL); + fd, dataonly, NULL); errno = args.op_errno; return args.op_ret; diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 9f87673d427..619fe7119b9 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -246,7 +246,7 @@ int syncop_truncate (xlator_t *subvol, loc_t *loc, off_t offset); int syncop_unlink (xlator_t *subvol, loc_t *loc); -int syncop_fsync (xlator_t *subvol, fd_t *fd); +int syncop_fsync (xlator_t *subvol, fd_t *fd, int dataonly); int syncop_flush (xlator_t *subvol, fd_t *fd); int syncop_fstat (xlator_t *subvol, fd_t *fd, struct iatt *stbuf); int syncop_stat (xlator_t *subvol, loc_t *loc, struct iatt *stbuf); diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 8f2f0adb2fb..dace9cd851d 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -736,7 +736,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, /* TODO: Sync the locks */ - ret = syncop_fsync (to, dst_fd); + ret = syncop_fsync (to, dst_fd, 0); if (ret) gf_log (this->name, GF_LOG_WARNING, "%s: failed to fsync on %s (%s)", diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 837980efcec..af6de8cd07c 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3717,7 +3717,7 @@ fuse_migrate_fd (xlator_t *this, fd_t *fd, xlator_t *old_subvol, } while (create_in_progress); if (fd->inode->table->xl == old_subvol) { - ret = syncop_fsync (old_subvol, fd); + ret = syncop_fsync (old_subvol, fd, 0); if (ret < 0) { gf_log ("glusterfs-fuse", GF_LOG_WARNING, "syncop_fsync failed (%s)", strerror (errno)); |