c2ae918
From 5ba99e361671bc22bfc3ce45d866826f297e25b7 Mon Sep 17 00:00:00 2001
c2ae918
From: Gabriel de Perthuis <g2p.code@gmail.com>
c2ae918
Date: Fri, 10 May 2013 19:53:28 +0200
c2ae918
Subject: [PATCH] hw/9pfs: Be robust against paths without FS_IOC_GETVERSION
c2ae918
c2ae918
9P optionally uses the FS_IOC_GETVERSION ioctl to get information about
c2ae918
a file's version (sometimes called generation number).
c2ae918
c2ae918
The code checks for supported filesystems at mount time, but some paths
c2ae918
may come from other mounted filesystems.
c2ae918
c2ae918
Change it to treat unsupported paths the same as unsupported
c2ae918
filesystems, returning 0 in both cases.
c2ae918
c2ae918
Note: ENOTTY is the error code for an unsupported ioctl.
c2ae918
c2ae918
This fix allows booting a linux kernel with the same / filesystem as the
c2ae918
host; otherwise the boot fails when mounting devtmpfs.
c2ae918
c2ae918
Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
c2ae918
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
c2ae918
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
c2ae918
(cherry picked from commit db431f6adc881a0758512cd765b3108209013512)
c2ae918
---
c2ae918
 hw/9pfs/cofile.c | 4 ++++
c2ae918
 1 file changed, 4 insertions(+)
c2ae918
c2ae918
diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
c2ae918
index 2efebf3..194c130 100644
c2ae918
--- a/hw/9pfs/cofile.c
c2ae918
+++ b/hw/9pfs/cofile.c
c2ae918
@@ -38,6 +38,10 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
c2ae918
             });
c2ae918
         v9fs_path_unlock(s);
c2ae918
     }
c2ae918
+    /* The ioctl may not be supported depending on the path */
c2ae918
+    if (err == -ENOTTY) {
c2ae918
+        err = 0;
c2ae918
+    }
c2ae918
     return err;
c2ae918
 }
c2ae918