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: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/393599
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Cunyin Chang 2018-01-04 15:50:20 +08:00 committed by Jim Harris
parent a862d1cdd6
commit edc5610fbc

View File

@ -2075,20 +2075,19 @@ spdk_file_write(struct spdk_file *file, struct spdk_io_channel *_channel,
}
}
pthread_spin_unlock(&file->lock);
if (cache_buffers_filled == 0) {
pthread_spin_unlock(&file->lock);
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;
}