Patch "virtiofs: Fail dax mount if device does not support it" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    virtiofs: Fail dax mount if device does not support it

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     virtiofs-fail-dax-mount-if-device-does-not-support-i.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a8ec9a2d41c9bd42bb974a57f01c199f2f7be174
Author: Vivek Goyal <vgoyal@xxxxxxxxxx>
Date:   Tue Feb 9 17:47:54 2021 -0500

    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@xxxxxxxxxx>
    Reviewed-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
    Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 8868ac31a3c0..4ee6f734ba83 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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux