All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION
@ 2013-05-08 23:49 Gabriel de Perthuis
  2013-05-10  3:30 ` Aneesh Kumar K.V
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel de Perthuis @ 2013-05-08 23:49 UTC (permalink / raw)
  To: Aneesh Kumar K.V, qemu-devel; +Cc: qemu-stable

The current implementation checked for supported filesystems at mount
time, but actual support depends on the path.  Don't error out when
finding unversioned paths.

This fix allows booting a linux kernel with the same / filesystem as the
host; otherwise the boot fails when mounting devtmpfs.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
---
 hw/9pfs/cofile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index 2efebf3..194c130 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -36,10 +36,14 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
                     err = -errno;
                 }
             });
         v9fs_path_unlock(s);
     }
+    /* The ioctl may not be supported depending on the path */
+    if (err == -ENOTTY) {
+        err = 0;
+    }
     return err;
 }
 
 int v9fs_co_lstat(V9fsPDU *pdu, V9fsPath *path, struct stat *stbuf)
 {
-- 
1.8.2.1.419.ga0b97c6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION
  2013-05-08 23:49 [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION Gabriel de Perthuis
@ 2013-05-10  3:30 ` Aneesh Kumar K.V
  2013-05-10  6:42   ` Gabriel de Perthuis
  0 siblings, 1 reply; 6+ messages in thread
From: Aneesh Kumar K.V @ 2013-05-10  3:30 UTC (permalink / raw)
  To: Gabriel de Perthuis, qemu-devel; +Cc: qemu-stable

Gabriel de Perthuis <g2p.code@gmail.com> writes:

> The current implementation checked for supported filesystems at mount
> time, but actual support depends on the path.  Don't error out when
> finding unversioned paths.

Can you elaborate this a bit ?

>
> This fix allows booting a linux kernel with the same / filesystem as the
> host; otherwise the boot fails when mounting devtmpfs.
>
> Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
> ---
>  hw/9pfs/cofile.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
> index 2efebf3..194c130 100644
> --- a/hw/9pfs/cofile.c
> +++ b/hw/9pfs/cofile.c
> @@ -36,10 +36,14 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
>                      err = -errno;
>                  }
>              });
>          v9fs_path_unlock(s);
>      }
> +    /* The ioctl may not be supported depending on the path */
> +    if (err == -ENOTTY) {
> +        err = 0;
> +    }

So you don't want to consider -ENOTTY as an error ? why ?

>      return err;
>  }
>
>  int v9fs_co_lstat(V9fsPDU *pdu, V9fsPath *path, struct stat *stbuf)
>  {
> -- 

-aneesh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION
  2013-05-10  3:30 ` Aneesh Kumar K.V
@ 2013-05-10  6:42   ` Gabriel de Perthuis
  2013-05-10 10:38     ` Aneesh Kumar K.V
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel de Perthuis @ 2013-05-10  6:42 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: qemu-devel, qemu-stable

Le 10/05/2013 05:30, Aneesh Kumar K.V a écrit :
> Gabriel de Perthuis <g2p.code@gmail.com> writes:
> 
>> The current implementation checked for supported filesystems at mount
>> time, but actual support depends on the path.  Don't error out when
>> finding unversioned paths.
> 
> Can you elaborate this a bit ?

ioctl support generally depends on the mount point.

You have a check that verifies the filesystem at the root of the source side
is ext4 or something else whitelisted to have generation support, but that's
not sufficient, the source may contain other mountpoints that don't support
the getversion ioctl.  When a path gives you ENOTTY, that means the ioctl
is not supported.

>> This fix allows booting a linux kernel with the same / filesystem as the
>> host; otherwise the boot fails when mounting devtmpfs.
>>
>> Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
>> ---
>>  hw/9pfs/cofile.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
>> index 2efebf3..194c130 100644
>> --- a/hw/9pfs/cofile.c
>> +++ b/hw/9pfs/cofile.c
>> @@ -36,10 +36,14 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
>>                      err = -errno;
>>                  }
>>              });
>>          v9fs_path_unlock(s);
>>      }
>> +    /* The ioctl may not be supported depending on the path */
>> +    if (err == -ENOTTY) {
>> +        err = 0;
>> +    }
> 
> So you don't want to consider -ENOTTY as an error ? why ?

ENOTTY means the ioctl is not supported.
That should be handled the same as if the source-side root didn't have a
whitelisted filesystem.  That means we need to return 0 in both cases.

>>      return err;
>>  }
>>
>>  int v9fs_co_lstat(V9fsPDU *pdu, V9fsPath *path, struct stat *stbuf)
>>  {
>> -- 
> 
> -aneesh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION
  2013-05-10  6:42   ` Gabriel de Perthuis
@ 2013-05-10 10:38     ` Aneesh Kumar K.V
  0 siblings, 0 replies; 6+ messages in thread
From: Aneesh Kumar K.V @ 2013-05-10 10:38 UTC (permalink / raw)
  To: Gabriel de Perthuis; +Cc: qemu-devel, qemu-stable

Gabriel de Perthuis <g2p.code@gmail.com> writes:

> Le 10/05/2013 05:30, Aneesh Kumar K.V a écrit :
>> Gabriel de Perthuis <g2p.code@gmail.com> writes:
>> 
>>> The current implementation checked for supported filesystems at mount
>>> time, but actual support depends on the path.  Don't error out when
>>> finding unversioned paths.
>> 
>> Can you elaborate this a bit ?
>
> ioctl support generally depends on the mount point.
>
> You have a check that verifies the filesystem at the root of the source side
> is ext4 or something else whitelisted to have generation support, but that's
> not sufficient, the source may contain other mountpoints that don't support
> the getversion ioctl.  When a path gives you ENOTTY, that means the ioctl
> is not supported.

May be we can update the commit message to be more clear. ie, currently
the st_gen support is decided based on whether export file system
support ioc_getversion ioctl. But we could have other file system mounted further down
in the exported path that doesn't support ioc_getversion. So instead of
failing stat request, we do the same we did for the export path. If we
find the ioctl not supported we silently ignore the error. This results in us
returning st_gen value 0 which should be ok 

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

>
>>> This fix allows booting a linux kernel with the same / filesystem as the
>>> host; otherwise the boot fails when mounting devtmpfs.
>>>
>>> Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
>>> ---
>>>  hw/9pfs/cofile.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
>>> index 2efebf3..194c130 100644
>>> --- a/hw/9pfs/cofile.c
>>> +++ b/hw/9pfs/cofile.c
>>> @@ -36,10 +36,14 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
>>>                      err = -errno;
>>>                  }
>>>              });
>>>          v9fs_path_unlock(s);
>>>      }
>>> +    /* The ioctl may not be supported depending on the path */
>>> +    if (err == -ENOTTY) {
>>> +        err = 0;
>>> +    }
>> 
>> So you don't want to consider -ENOTTY as an error ? why ?
>
> ENOTTY means the ioctl is not supported.
> That should be handled the same as if the source-side root didn't have a
> whitelisted filesystem.  That means we need to return 0 in both cases.
>
>>>      return err;
>>>  }
>>>
>>>  int v9fs_co_lstat(V9fsPDU *pdu, V9fsPath *path, struct stat *stbuf)
>>>  {
>>> -- 
>> 
>> -aneesh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION
@ 2013-05-10 17:53 Gabriel de Perthuis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel de Perthuis @ 2013-05-10 17:53 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: qemu-devel, qemu-stable

9P optionally uses the FS_IOC_GETVERSION ioctl to get information about
a file's version (sometimes called generation number).

The code checks for supported filesystems at mount time, but some paths
may come from other mounted filesystems.

Change it to treat unsupported paths the same as unsupported
filesystems, returning 0 in both cases.

Note: ENOTTY is the error code for an unsupported ioctl.

This fix allows booting a linux kernel with the same / filesystem as the
host; otherwise the boot fails when mounting devtmpfs.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---

Here it is with an expanded commit message.

 hw/9pfs/cofile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index 2efebf3..194c130 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -36,10 +36,14 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
                     err = -errno;
                 }
             });
         v9fs_path_unlock(s);
     }
+    /* The ioctl may not be supported depending on the path */
+    if (err == -ENOTTY) {
+        err = 0;
+    }
     return err;
 }
 
 int v9fs_co_lstat(V9fsPDU *pdu, V9fsPath *path, struct stat *stbuf)
 {
-- 
1.8.2.1.419.ga0b97c6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION
@ 2013-05-08 23:33 Gabriel de Perthuis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel de Perthuis @ 2013-05-08 23:33 UTC (permalink / raw)
  To: Aneesh Kumar K.V, qemu-devel; +Cc: qemu-stable

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

The current implementation checked for supported filesystems at mount
time, but actual support depends on the path.  Don't error out when
finding unversioned paths.

This fix allows booting a linux kernel with the same / filesystem as the
host; otherwise the boot fails when mounting devtmpfs.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
---
 hw/9pfs/cofile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index 2efebf3..194c130 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -36,10 +36,14 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
                     err = -errno;
                 }
             });
         v9fs_path_unlock(s);
     }
+    /* The ioctl may not be supported depending on the path */
+    if (err == -ENOTTY) {
+        err = 0;
+    }
     return err;
 }
 
 int v9fs_co_lstat(V9fsPDU *pdu, V9fsPath *path, struct stat *stbuf)
 {
-- 
1.8.2.1.419.ga0b97c6


[-- Attachment #2: Portion de message joint --]
[-- Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-10 17:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-08 23:49 [Qemu-devel] [PATCH] 9p: Be robust against paths without FS_IOC_GETVERSION Gabriel de Perthuis
2013-05-10  3:30 ` Aneesh Kumar K.V
2013-05-10  6:42   ` Gabriel de Perthuis
2013-05-10 10:38     ` Aneesh Kumar K.V
  -- strict thread matches above, loose matches on Subject: below --
2013-05-10 17:53 Gabriel de Perthuis
2013-05-08 23:33 Gabriel de Perthuis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.