Commit edc5610f authored by Cunyin Chang's avatar Cunyin Chang Committed by Jim Harris
Browse files

blobfs: release the lock before send the flush request when try to write file.



This makes spdk_file_write consistent with _file_sync.
The lock should not be held across calls to send_request.

Change-Id: I2a2987bbfe2688b520901267aa5a197bd55565a8
Signed-off-by: default avatarCunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/393599


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent a862d1cd
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2075,20 +2075,19 @@ spdk_file_write(struct spdk_file *file, struct spdk_io_channel *_channel,
		}
	}

	if (cache_buffers_filled == 0) {
	pthread_spin_unlock(&file->lock);

	if (cache_buffers_filled == 0) {
		return 0;
	}

	args = calloc(1, sizeof(*args));
	if (args == NULL) {
		pthread_spin_unlock(&file->lock);
		return -ENOMEM;
	}

	args->file = file;
	file->fs->send_request(__file_flush, args);
	pthread_spin_unlock(&file->lock);
	return 0;
}