Re: How to identify if a partition containing a btrfs volume is mounted and where

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

 



On 25 February 2014 10:28, Mike Fleetwood <mike.fleetwood@xxxxxxxxxxxxxx> wrote:
> On 25 February 2014 03:01, Anand Jain <Anand.Jain@xxxxxxxxxx> wrote:
>>
>>> # mkfs.btrfs /dev/sdb2 /dev/sdb3 /dev/sdb4
>>> # mount /dev/sdb2 /mnt/1
>>> # btrfs device delete /dev/sdb2 /mnt/1
>>>
>>> So /dev/sdb2 is no longer part of the file system, but it's still
>>> mounted using it.
>>>
>>> # grep btrfs /proc/mounts
>>> /dev/sdb2 /mnt/1 btrfs rw,seclabel,relatime,ssd,space_cache 0 0
>>
>>
>>  This bug isn't there is the current btrfs-next. I couldn't
>>  reproduce.
>
> I've tested this again.  With linux 3.12.10 on Fedora 20 it is still
> reproducible, but after upgrading to linux 3.13.3 /proc/mounts
> automatically changes to show another device when the initial mounting
> one is removed from the btrfs.

Hi Anand,

I've done some more testing and stracing and would appreciate you
confirming the following understanding is correct:

1) btrfs-tools >= 3.12 (possibly earlier) will always display correct
results from btrfs fs show because it uses ioctls to get information
from the kernel for each mounted btrfs, and reads the disks for
non-mounted ones.

2) Old btrfs tools (tested with 0.20-rc1) only reads the disk and so
may get out of date information for mounted file systems, sometimes
showing *** Some devices missing.

3) Using btrfs fs sync /mnt makes the cached changes to device
membership get flushed to disk, thus avoiding seeing stale data in
(2).

So as such I plan to use /proc/mounts to determine FS busy status and
btrfs fs show to determine btrfs device membership.  As per my
previous and the above details this will be correct for linux >= 3.13
and current btrfs-tools, but for older kernel using /proc/mounts will
be wrong if the original mounting device has been removed from the
btrfs.

Thanks,
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux