summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/bugs/bug-808400-dist.t5
-rwxr-xr-xtests/bugs/bug-808400-repl.t5
-rwxr-xr-xtests/bugs/bug-808400-stripe.t5
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c40
4 files changed, 31 insertions, 24 deletions
diff --git a/tests/bugs/bug-808400-dist.t b/tests/bugs/bug-808400-dist.t
index 7bbca18daef..a404cdba971 100755
--- a/tests/bugs/bug-808400-dist.t
+++ b/tests/bugs/bug-808400-dist.t
@@ -22,9 +22,7 @@ EXPECT 'Created' volinfo_field $V0 'Status';
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
-#mount on a random dir
-TEST MOUNTDIR="/tmp/$RANDOM"
-TEST mkdir $MOUNTDIR
+MOUNTDIR=$M0;
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 --volfile-server=$H0 --volfile-id=$V0 $MOUNTDIR;
function cleanup_tester ()
@@ -52,6 +50,5 @@ TEST rm -rf $MOUNTDIR/*
TEST rm -rf $(dirname $0)/bug-808400-flock $(dirname $0)/bug-808400-fcntl $(dirname $0)/glusterfs.log
TEST umount $MOUNTDIR -l
-TEST rm -rf $MOUNTDIR
cleanup; \ No newline at end of file
diff --git a/tests/bugs/bug-808400-repl.t b/tests/bugs/bug-808400-repl.t
index f7c368405b9..d11bd250487 100755
--- a/tests/bugs/bug-808400-repl.t
+++ b/tests/bugs/bug-808400-repl.t
@@ -22,9 +22,7 @@ EXPECT 'Created' volinfo_field $V0 'Status';
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
-#mount on a random dir
-TEST MOUNTDIR="/tmp/$RANDOM"
-TEST mkdir $MOUNTDIR
+MOUNTDIR=$M0;
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 --volfile-server=$H0 --volfile-id=$V0 $MOUNTDIR;
function cleanup_tester ()
@@ -52,6 +50,5 @@ TEST rm -rf $MOUNTDIR/*
TEST rm -rf $(dirname $0)/bug-808400-flock $(dirname $0)/bug-808400-fcntl $(dirname $0)/glusterfs.log
TEST umount $MOUNTDIR -l
-TEST rm -rf $MOUNTDIR
cleanup; \ No newline at end of file
diff --git a/tests/bugs/bug-808400-stripe.t b/tests/bugs/bug-808400-stripe.t
index 3870ef76703..3edf7a1f9d6 100755
--- a/tests/bugs/bug-808400-stripe.t
+++ b/tests/bugs/bug-808400-stripe.t
@@ -22,9 +22,7 @@ EXPECT 'Created' volinfo_field $V0 'Status';
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
-#mount on a random dir
-TEST MOUNTDIR="/tmp/$RANDOM"
-TEST mkdir $MOUNTDIR
+MOUNTDIR=$M0;
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 --volfile-server=$H0 --volfile-id=$V0 $MOUNTDIR;
function cleanup_tester ()
@@ -52,6 +50,5 @@ TEST rm -rf $MOUNTDIR/*
TEST rm -rf $(dirname $0)/bug-808400-flock $(dirname $0)/bug-808400-fcntl $(dirname $0)/glusterfs.log
TEST umount $MOUNTDIR -l
-TEST rm -rf $MOUNTDIR
cleanup; \ No newline at end of file
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 65df671305b..25545b7830d 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3710,8 +3710,7 @@ out:
int
fuse_migrate_fd_open (xlator_t *this, fd_t *basefd, fd_t *oldfd,
- xlator_t *old_subvol, xlator_t *new_subvol,
- fd_t **newfdptr)
+ xlator_t *old_subvol, xlator_t *new_subvol)
{
loc_t loc = {0, };
fd_t *newfd = NULL, *old_activefd = NULL;
@@ -3765,6 +3764,9 @@ fuse_migrate_fd_open (xlator_t *this, fd_t *basefd, fd_t *oldfd,
goto out;
}
+ if (newfd->lk_ctx)
+ fd_lk_ctx_unref (newfd->lk_ctx);
+
newfd->lk_ctx = fd_lk_ctx_ref (oldfd->lk_ctx);
newfd_ctx = fuse_fd_ctx_check_n_create (this, newfd);
@@ -3810,10 +3812,6 @@ fuse_migrate_fd_open (xlator_t *this, fd_t *basefd, fd_t *oldfd,
old_subvol->name, old_subvol->graph->id,
new_subvol->name, new_subvol->graph->id);
- if (newfdptr != NULL) {
- *newfdptr = newfd;
- }
-
ret = 0;
out:
@@ -3823,12 +3821,27 @@ out:
}
int
-fuse_migrate_locks (xlator_t *this, fd_t *oldfd, fd_t *newfd,
+fuse_migrate_locks (xlator_t *this, fd_t *basefd, fd_t *oldfd,
xlator_t *old_subvol, xlator_t *new_subvol)
{
int ret = -1;
dict_t *lockinfo = NULL;
void *ptr = NULL;
+ fd_t *newfd = NULL;
+ fuse_fd_ctx_t *basefd_ctx = NULL;
+
+
+ if (!oldfd->lk_ctx || fd_lk_ctx_empty (oldfd->lk_ctx))
+ return 0;
+
+ basefd_ctx = fuse_fd_ctx_get (this, basefd);
+ GF_VALIDATE_OR_GOTO ("glusterfs-fuse", basefd_ctx, out);
+
+ LOCK (&basefd->lock);
+ {
+ newfd = fd_ref (basefd_ctx->activefd);
+ }
+ UNLOCK (&basefd->lock);
ret = syncop_fgetxattr (old_subvol, oldfd, &lockinfo,
GF_XATTR_LOCKINFO_KEY);
@@ -3869,6 +3882,9 @@ fuse_migrate_locks (xlator_t *this, fd_t *oldfd, fd_t *newfd,
}
out:
+ if (newfd)
+ fd_unref (newfd);
+
if (lockinfo != NULL) {
dict_unref (lockinfo);
}
@@ -3884,7 +3900,7 @@ fuse_migrate_fd (xlator_t *this, fd_t *basefd, xlator_t *old_subvol,
int ret = -1;
char create_in_progress = 0;
fuse_fd_ctx_t *basefd_ctx = NULL;
- fd_t *oldfd = NULL, *newfdptr = NULL;
+ fd_t *oldfd = NULL;
basefd_ctx = fuse_fd_ctx_get (this, basefd);
GF_VALIDATE_OR_GOTO ("glusterfs-fuse", basefd_ctx, out);
@@ -3945,7 +3961,7 @@ fuse_migrate_fd (xlator_t *this, fd_t *basefd, xlator_t *old_subvol,
}
ret = fuse_migrate_fd_open (this, basefd, oldfd, old_subvol,
- new_subvol, &newfdptr);
+ new_subvol);
if (ret < 0) {
gf_log (this->name, GF_LOG_WARNING, "open corresponding to "
"basefd (ptr:%p inode-gfid:%s) in new graph failed "
@@ -3956,15 +3972,15 @@ fuse_migrate_fd (xlator_t *this, fd_t *basefd, xlator_t *old_subvol,
goto out;
}
- ret = fuse_migrate_locks (this, oldfd, newfdptr, old_subvol,
+ ret = fuse_migrate_locks (this, basefd, oldfd, old_subvol,
new_subvol);
if (ret < 0) {
gf_log (this->name, GF_LOG_WARNING,
"migrating locks from old-subvolume (%s-%d) to "
"new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p "
- "newfd:%p)", old_subvol->name, old_subvol->graph->id,
+ "basefd:%p)", old_subvol->name, old_subvol->graph->id,
new_subvol->name, new_subvol->graph->id,
- uuid_utoa (basefd->inode->gfid), oldfd, newfdptr);
+ uuid_utoa (basefd->inode->gfid), oldfd, basefd);
}
out: