Skip to content

Commit 3f9b9ef

Browse files
rhvgoyalMiklos Szeredi
authored andcommitted
virtiofs: Fail dax mount if device does not support it
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 <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 775c503 commit 3f9b9ef

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/fuse/virtio_fs.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc)
13241324

13251325
/* virtiofs allocates and installs its own fuse devices */
13261326
ctx->fudptr = NULL;
1327-
if (ctx->dax)
1327+
if (ctx->dax) {
1328+
if (!fs->dax_dev) {
1329+
err = -EINVAL;
1330+
pr_err("virtio-fs: dax can't be enabled as filesystem"
1331+
" device does not support it.\n");
1332+
goto err_free_fuse_devs;
1333+
}
13281334
ctx->dax_dev = fs->dax_dev;
1335+
}
13291336
err = fuse_fill_super_common(sb, ctx);
13301337
if (err < 0)
13311338
goto err_free_fuse_devs;

0 commit comments

Comments
 (0)