Skip to content

Commit

Permalink
virtiofs: Fail dax mount if device does not support it
Browse files Browse the repository at this point in the history
[ Upstream commit 3f9b9ef ]

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: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rhvgoyal authored and gregkh committed Apr 7, 2021
1 parent e21d2b9 commit 1bfb046
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fs/fuse/virtio_fs.c
Expand Up @@ -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 */
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;
}
err = fuse_fill_super_common(sb, ctx);
if (err < 0)
goto err_free_fuse_devs;
Expand Down

0 comments on commit 1bfb046

Please sign in to comment.