diff options
| -rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 54 | 
1 files changed, 35 insertions, 19 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 9a2d60b9b4c..0b9ee176588 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -3666,32 +3666,48 @@ fuse_handle_opened_fds (xlator_t *this, xlator_t *old_subvol,          if (fdentries != NULL) {                  for (i = 0; i < count; i++) {                          fd = fdentries[i].fd; -                        if (fd != NULL) { -                                ret = fuse_migrate_fd (this, fd, old_subvol, +                        if (fd == NULL) +                                continue; + +                        ret = fuse_migrate_fd (this, fd, old_subvol,                                                         new_subvol); -                                if (ret < 0) { -                                        if (ret == -1) { -                                                fdctx = fuse_fd_ctx_check_n_create (fd, this); -                                                if (fdctx != NULL) { -                                                        fdctx->migration_failed = 1; -                                                } -                                        } else { -                                                /* nameless lookup has failed, -                                                 * it can be identified using -                                                 * fd->inode->table->xl -                                                 * != active_subvol. so, do -                                                 * nothing -                                                 */ -                                        } -                                } else { -                                        fdctx = fuse_fd_ctx_get (this, fd); +                        if (ret < 0) { +                                if (ret == -1) { +                                        fdctx = fuse_fd_ctx_check_n_create (fd, +                                                                         this);                                          if (fdctx != NULL) { -                                                fdctx->migration_failed = 0; +                                                fdctx->migration_failed = 1; +                                                gf_log_callingfn ("glusterfs-" +                                                                  "fuse", +                                                                  GF_LOG_ERROR, +                                                                  "fd migration" +                                                                  " for the fd " +                                                                  "(%p), with" +                                                                  "context (%p)" +                                                                  " failed", fd, +                                                                  fdctx);                                          } +                                } else { +                                        /* nameless lookup has failed, +                                         * it can be identified using +                                         * fd->inode->table->xl +                                         * != active_subvol. so, do +                                         * nothing +                                         */ +                                } +                        } else { +                                fdctx = fuse_fd_ctx_get (this, fd); +                                if (fdctx != NULL) { +                                        fdctx->migration_failed = 0;                                  }                          }                  } +                for (i = 0; i < count ; i++) { +                        fd = fdentries[i].fd; +                        if (fd) +                                fd_unref (fd); +                }                  GF_FREE (fdentries);          }  | 
