diff --git a/swift/obj/diskfile.py b/swift/obj/diskfile.py index 39eff67bde..3920315551 100644 --- a/swift/obj/diskfile.py +++ b/swift/obj/diskfile.py @@ -1786,8 +1786,8 @@ class ECDiskFileWriter(DiskFileWriter): def _finalize_durable(self, durable_file_path): exc = msg = None try: - with open(durable_file_path, 'w') as _fd: - fsync(_fd) + with open(durable_file_path, 'w') as _fp: + fsync(_fp.fileno()) try: self.manager.hash_cleanup_listdir(self._datadir) except OSError: diff --git a/test/unit/obj/test_diskfile.py b/test/unit/obj/test_diskfile.py index 2ccf3b1364..a84cafc8b4 100644 --- a/test/unit/obj/test_diskfile.py +++ b/test/unit/obj/test_diskfile.py @@ -2650,8 +2650,7 @@ class DiskFileMixin(BaseDiskFileTestMixin): }[policy.policy_type] self.assertEqual(expected, mock_fsync.call_count) if policy.policy_type == EC_POLICY: - durable_file = '%s.durable' % timestamp.internal - self.assertTrue(durable_file in str(mock_fsync.call_args[0])) + self.assertTrue(isinstance(mock_fsync.call_args[0][0], int)) def test_commit_ignores_hash_cleanup_listdir_error(self): for policy in POLICIES: