提交 236a3769 编写于 作者: V Vivek Goyal 提交者: Zheng Zengkai

virtiofs: Fail dax mount if device does not support it

stable inclusion
from stable-5.10.28
commit 1bfb046d29e364efb56fdbbf4a9dcd7dec1d4019
bugzilla: 51779

--------------------------------

[ Upstream commit 3f9b9efd ]

Right now "mount -t virtiofs -o dax myfs /mnt/virtiofs" succeeds even
if filesystem deivce does not have a cache window and hence DAX can't
be supported.

This gives a false sense to user that they are using DAX with virtiofs
but fact of the matter is that they are not.

Fix this by returning error if dax can't be supported and user has asked
for it.
Signed-off-by: NVivek Goyal <vgoyal@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 12886d64
...@@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc) ...@@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc)
/* virtiofs allocates and installs its own fuse devices */ /* virtiofs allocates and installs its own fuse devices */
ctx->fudptr = NULL; ctx->fudptr = NULL;
if (ctx->dax) if (ctx->dax) {
if (!fs->dax_dev) {
err = -EINVAL;
pr_err("virtio-fs: dax can't be enabled as filesystem"
" device does not support it.\n");
goto err_free_fuse_devs;
}
ctx->dax_dev = fs->dax_dev; ctx->dax_dev = fs->dax_dev;
}
err = fuse_fill_super_common(sb, ctx); err = fuse_fill_super_common(sb, ctx);
if (err < 0) if (err < 0)
goto err_free_fuse_devs; goto err_free_fuse_devs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册