summaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2021-02-09 17:47:54 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-07 15:00:03 +0200
commit1bfb046d29e364efb56fdbbf4a9dcd7dec1d4019 (patch)
tree03192970b93dcc930589637db8f648e3f67aa979 /fs/fuse
parente21d2b92354b3cd25dd774ebb0f0e52ff04a7861 (diff)
downloadlinux-stable-1bfb046d29e364efb56fdbbf4a9dcd7dec1d4019.tar.gz
linux-stable-1bfb046d29e364efb56fdbbf4a9dcd7dec1d4019.tar.bz2
linux-stable-1bfb046d29e364efb56fdbbf4a9dcd7dec1d4019.zip
virtiofs: Fail dax mount if device does not support it
[ Upstream commit 3f9b9efd82a84f27e95d0414f852caf1fa839e83 ] 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>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/virtio_fs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index d2c0e58c6416..3d83c9e12848 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -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;