meta: implement fsync(dir)

Change-Id: I707c608a9803fe6ef86860ca5578d4d3f63fd2aa
BUG: 1225323
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/10929
Tested-by: NetBSD Build System
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
This commit is contained in:
Raghavendra G 2015-05-27 12:08:54 +05:30 committed by Pranith Kumar Karampuri
parent 628198deaf
commit d6fc353afc
3 changed files with 40 additions and 17 deletions

View File

@ -204,7 +204,6 @@ function is_bad_test ()
./tests/bugs/disperse/bug-1187474.t \
./tests/basic/afr/sparse-file-self-heal.t \
./tests/basic/mount-nfs-auth.t \
./tests/performance/open-behind.t \
./tests/basic/ec/ec-5-1.t \
./tests/basic/ec/ec.t \
; do

View File

@ -169,6 +169,24 @@ meta_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
return 0;
}
int32_t
meta_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
dict_t *xdata)
{
META_FOP (fd->inode, fsync, frame, this, fd, flags, xdata);
return 0;
}
int32_t
meta_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
dict_t *xdata)
{
META_FOP (fd->inode, fsyncdir, frame, this, fd, flags, xdata);
return 0;
}
int
meta_forget (xlator_t *this, inode_t *inode)
{
@ -235,19 +253,21 @@ fini (xlator_t *this)
struct xlator_fops fops = {
.lookup = meta_lookup,
.opendir = meta_opendir,
.open = meta_open,
.readv = meta_readv,
.flush = meta_flush,
.stat = meta_stat,
.fstat = meta_fstat,
.readdir = meta_readdir,
.readdirp = meta_readdirp,
.readlink = meta_readlink,
.writev = meta_writev,
.truncate = meta_truncate,
.ftruncate = meta_ftruncate
.lookup = meta_lookup,
.opendir = meta_opendir,
.open = meta_open,
.readv = meta_readv,
.flush = meta_flush,
.stat = meta_stat,
.fstat = meta_fstat,
.readdir = meta_readdir,
.readdirp = meta_readdirp,
.readlink = meta_readlink,
.writev = meta_writev,
.truncate = meta_truncate,
.ftruncate = meta_ftruncate,
.fsync = meta_fsync,
.fsyncdir = meta_fsyncdir
};

View File

@ -4420,17 +4420,21 @@ fuse_migrate_fd (xlator_t *this, fd_t *basefd, xlator_t *old_subvol,
}
if (oldfd->inode->table->xl == old_subvol) {
ret = syncop_fsync (old_subvol, oldfd, 0, NULL, NULL);
if (IA_ISDIR (oldfd->inode->ia_type))
ret = syncop_fsyncdir (old_subvol, oldfd, 0, NULL,
NULL);
else
ret = syncop_fsync (old_subvol, oldfd, 0, NULL, NULL);
if (ret < 0) {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,
"syncop_fsync failed (%s) on fd (%p)"
"syncop_fsync(dir) failed (%s) on fd (%p)"
"(basefd:%p basefd-inode.gfid:%s) "
"(old-subvolume:%s-%d new-subvolume:%s-%d)",
strerror (-ret), oldfd, basefd,
uuid_utoa (basefd->inode->gfid),
old_subvol->name, old_subvol->graph->id,
new_subvol->name, new_subvol->graph->id);
ret = -1;
}
} else {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,