diff mbox

"Btrfs: device_list_add() should not update list when mounted" breaks subvol mount

Message ID 5416DC7A.1070608@oracle.com (mailing list archive)
State Accepted
Headers show

Commit Message

Anand Jain Sept. 15, 2014, 12:32 p.m. UTC
Hi Johannes,

  Can I have you this tested.. ? Thanks.


-------
-------

Anand



On 09/14/2014 05:23 AM, Johannes Hirte wrote:
> On Sat, 13 Sep 2014 19:55:25 +0200
> Johannes Hirte <johannes.hirte@datenkhaos.de> wrote:
>
>> On Sat, 13 Sep 2014 13:36:37 +0800
>> Anand Jain <Anand.Jain@oracle.com> wrote:
>>
>>> Xavier, Johannes,
>>>
>>>       The quickest workaround for you will be to try to match
>>>    the device path as in the btrfs fi show -m </mnt> output to
>>>    your probably fstab/mnttab entry.
>>
>> Doesn't work here. I don't even get a path with the affected kernels.
>> I'll get:
>>
>> Label: none  uuid: 02edbd6b-f044-4800-b21e-ca8982c2c2e5
>>          Total devices 1 FS bytes used 270.10GiB
>>          *** Some devices missing
>>
>> Btrfs v3.16
>>
>> with a working kernel:
>>
>> Label: none  uuid: 02edbd6b-f044-4800-b21e-ca8982c2c2e5
>>          Total devices 1 FS bytes used 270.10GiB
>>          devid    1 size 293.89GiB used 289.06GiB path /dev/sda1
>>
>> Btrfs v3.16
>>
>> Filesystem layout is:
>>
>> subvolid 0 contains only the different subvolumes
>>
>> ID 257 gen 414674 top level 5 path rootfs
>> ID 269 gen 414615 top level 5 path home-USER1
>> ID 317 gen 411498 top level 5 path home-USER2
>> ID 363 gen 410939 top level 5 path home-USER3
>> ID 382 gen 315844 top level 5 path home-USER4
>> ID 933 gen 410514 top level 5 path home-USER5
>> ID 995 gen 315756 top level 5 path homefs-USER6
>>
>> subvol rootfs (ID 257) is set to the default subvolume, mounted at
>> start. Grub commandline is like following:
>>
>> root=/dev/sda1 ro rootflags=subvol=rootfs,inode_cache,autodefrag
>>
>> It doesn't matter, if the subvol parameter is set. I've tried with,
>> without and with subvolid=0 parameter. Everytime the same result.
>>
>>
>> And now I was able to reproduce on a second machine. The main
>> difference between the affected and the unaffected systems is
>> initramfs. On the affected systems, I don't use one. On the working
>> systems, the rootfs is mounted via initramfs before. I'll test, if an
>> initramfs will solve the issue. Seems likely, cause if I put the disk
>> of an affected system into a working system and mount it there,
>> everything works.
>
> Of course, with the initramfs it works. Content of the init-script:
>
> #!/bin/sh
>
> mount -t devtmpfs devtmpfs /dev
> mount -t proc proc /proc
> mount -t sysfs sysfs /sys
> mount -t tmpfs tmpfs /run
> sleep 3  # wait for kernel msgs to quiet
>
> echo "loading initrd"
>
> btrfs dev scan
> sleep 5
>
> mount -o ro,subvol=rootfs,inode_cache,autodefrag /dev/sda1 /newroot
>
> if [[ -x /newroot/sbin/init ]]; then
>          umount /sys /proc
>          exec switch_root /newroot /sbin/init
> fi
>
> #rescue shell
> exec sh
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Johannes Hirte Sept. 15, 2014, 5:14 p.m. UTC | #1
On Mon, 15 Sep 2014 20:32:58 +0800
Anand Jain <Anand.Jain@oracle.com> wrote:

> 
> 
> Hi Johannes,
> 
>   Can I have you this tested.. ? Thanks.
> 
> 
> -------
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index e9676a4..1224b61 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -533,7 +533,7 @@ static noinline int device_list_add(const char
> *path,
>                   * the btrfs dev scan cli, after FS has been mounted.
>                   */
>                  if (fs_devices->opened) {
> -                       return -EBUSY;
> +                       goto out;
>                  } else {
>                          /*
>                           * That is if the FS is _not_ mounted and if
> you @@ -566,6 +566,7 @@ static noinline int device_list_add(const
> char *path, if (!fs_devices->opened)
>                  device->generation = found_transid;
> 
> +out:
>          *fs_devices_ret = fs_devices;
> 
>          return ret;
> -------

With this change, it works again without initramfs.

regards,
  Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anand Jain Sept. 15, 2014, 5:39 p.m. UTC | #2
On 16/09/2014 01:14, Johannes Hirte wrote:
> On Mon, 15 Sep 2014 20:32:58 +0800
> Anand Jain <Anand.Jain@oracle.com> wrote:
>
>>
>>
>> Hi Johannes,
>>
>>    Can I have you this tested.. ? Thanks.
>>
>>
>> -------
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index e9676a4..1224b61 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -533,7 +533,7 @@ static noinline int device_list_add(const char
>> *path,
>>                    * the btrfs dev scan cli, after FS has been mounted.
>>                    */
>>                   if (fs_devices->opened) {
>> -                       return -EBUSY;
>> +                       goto out;
>>                   } else {
>>                           /*
>>                            * That is if the FS is _not_ mounted and if
>> you @@ -566,6 +566,7 @@ static noinline int device_list_add(const
>> char *path, if (!fs_devices->opened)
>>                   device->generation = found_transid;
>>
>> +out:
>>           *fs_devices_ret = fs_devices;
>>
>>           return ret;
>> -------
>
> With this change, it works again without initramfs.

  Thanks. I am bit confused, is there any configuration that is
  still not working, even with the above changes.

Anand


> regards,
>    Johannes
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Hirte Sept. 15, 2014, 10:17 p.m. UTC | #3
On Tue, 16 Sep 2014 01:39:49 +0800
Anand Jain <Anand.Jain@oracle.com> wrote:

> 
> 
> On 16/09/2014 01:14, Johannes Hirte wrote:
> > On Mon, 15 Sep 2014 20:32:58 +0800
> > Anand Jain <Anand.Jain@oracle.com> wrote:
> >
> >>
> >>
> >> Hi Johannes,
> >>
> >>    Can I have you this tested.. ? Thanks.
> >>
> >>
> >> -------
> >> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> >> index e9676a4..1224b61 100644
> >> --- a/fs/btrfs/volumes.c
> >> +++ b/fs/btrfs/volumes.c
> >> @@ -533,7 +533,7 @@ static noinline int device_list_add(const char
> >> *path,
> >>                    * the btrfs dev scan cli, after FS has been
> >> mounted. */
> >>                   if (fs_devices->opened) {
> >> -                       return -EBUSY;
> >> +                       goto out;
> >>                   } else {
> >>                           /*
> >>                            * That is if the FS is _not_ mounted
> >> and if you @@ -566,6 +566,7 @@ static noinline int
> >> device_list_add(const char *path, if (!fs_devices->opened)
> >>                   device->generation = found_transid;
> >>
> >> +out:
> >>           *fs_devices_ret = fs_devices;
> >>
> >>           return ret;
> >> -------
> >
> > With this change, it works again without initramfs.
> 
>   Thanks. I am bit confused, is there any configuration that is
>   still not working, even with the above changes.
> 
> Anand

At moment, I'm not aware of any. But I will test the remaining systems
I have.

regards,
  Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anand Jain Sept. 16, 2014, 9:55 p.m. UTC | #4
Johannes, Xavier,

  Can you pls send the output for ..

    cat /etc/fstab  | egrep btrfs
    cat /proc/self/mounts | egrep btrfs
    mount | egrep btrfs

Thanks, Anand


On 16/09/2014 06:17, Johannes Hirte wrote:
> On Tue, 16 Sep 2014 01:39:49 +0800
> Anand Jain <Anand.Jain@oracle.com> wrote:
>
>>
>>
>> On 16/09/2014 01:14, Johannes Hirte wrote:
>>> On Mon, 15 Sep 2014 20:32:58 +0800
>>> Anand Jain <Anand.Jain@oracle.com> wrote:
>>>
>>>>
>>>>
>>>> Hi Johannes,
>>>>
>>>>     Can I have you this tested.. ? Thanks.
>>>>
>>>>
>>>> -------
>>>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>>>> index e9676a4..1224b61 100644
>>>> --- a/fs/btrfs/volumes.c
>>>> +++ b/fs/btrfs/volumes.c
>>>> @@ -533,7 +533,7 @@ static noinline int device_list_add(const char
>>>> *path,
>>>>                     * the btrfs dev scan cli, after FS has been
>>>> mounted. */
>>>>                    if (fs_devices->opened) {
>>>> -                       return -EBUSY;
>>>> +                       goto out;
>>>>                    } else {
>>>>                            /*
>>>>                             * That is if the FS is _not_ mounted
>>>> and if you @@ -566,6 +566,7 @@ static noinline int
>>>> device_list_add(const char *path, if (!fs_devices->opened)
>>>>                    device->generation = found_transid;
>>>>
>>>> +out:
>>>>            *fs_devices_ret = fs_devices;
>>>>
>>>>            return ret;
>>>> -------
>>>
>>> With this change, it works again without initramfs.
>>
>>    Thanks. I am bit confused, is there any configuration that is
>>    still not working, even with the above changes.
>>
>> Anand
>
> At moment, I'm not aware of any. But I will test the remaining systems
> I have.
>
> regards,
>    Johannes
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index e9676a4..1224b61 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -533,7 +533,7 @@  static noinline int device_list_add(const char *path,
                  * the btrfs dev scan cli, after FS has been mounted.
                  */
                 if (fs_devices->opened) {
-                       return -EBUSY;
+                       goto out;
                 } else {
                         /*
                          * That is if the FS is _not_ mounted and if you
@@ -566,6 +566,7 @@  static noinline int device_list_add(const char *path,
         if (!fs_devices->opened)
                 device->generation = found_transid;

+out:
         *fs_devices_ret = fs_devices;

         return ret;