bdev/uring: try without O_DIRECT flag if non-disk file first open fails

Signed-off-by: Yao Liu <yotta.liu@ucloud.cn>
Change-Id: I74b5b146c23e5395d26f80ca4f950631bd4721cb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473373
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Yao Liu 2019-11-06 11:20:39 +08:00 committed by Jim Harris
parent adf19fe6a3
commit 6f3ca0804e

View File

@ -105,10 +105,14 @@ bdev_uring_open(struct bdev_uring *bdev)
fd = open(bdev->filename, O_RDWR | O_DIRECT | O_NOATIME);
if (fd < 0) {
SPDK_ERRLOG("open() failed (file:%s), errno %d: %s\n",
bdev->filename, errno, spdk_strerror(errno));
bdev->fd = -1;
return -1;
/* Try without O_DIRECT for non-disk files */
fd = open(bdev->filename, O_RDWR | O_NOATIME);
if (fd < 0) {
SPDK_ERRLOG("open() failed (file:%s), errno %d: %s\n",
bdev->filename, errno, spdk_strerror(errno));
bdev->fd = -1;
return -1;
}
}
bdev->fd = fd;