Btrfs-progs: Update mtab if necessary when device was deleted in btrfs
Subsystems (2)
PATCH 1/1 Btrfs-progs: Update mtab if necessary when device was deleted in btrfs
Now if we remove the device that is specified when mounting, btrfs will update the mount information in /proc, such as the information in /proc/mounts. So in order to guarantee the consistency between /etc/mtab and the mount information in /proc, we must update /etc/mtab. This patch does it.
This patch need libmount and libmount-devel(version >= 2.19) packages to compile.
--- Makefile | 2 +- cmds-device.c | 404 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- utils.h | 1 + 3 files changed, 399 insertions(+), 8 deletions(-)
Makefile +1 -1
@@ -15,7 +15,7 @@ DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ INSTALL = install prefix ?= /usr/local bindir = $(prefix)/bin -LIBS=-luuid +LIBS=-luuid -lmount RESTORE_LIBS=-lz progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \
cmds-device.c +397 -7
490 lines not on this page · raw message
utils.h +1 -0
@@ -39,6 +39,7 @@ int btrfs_scan_one_dir(char *dirname, int run_ioctl);int check_mounted (const char *devicename);int check_mounted_where (int fd,const char *file,char *where,int size,struct btrfs_fs_devices **fs_devices_mnt); +int blk_file_in_dev_list (struct btrfs_fs_devices *fs_devices,const char *file);int btrfs_device_already_in_root (struct btrfs_root *root,int fd,int super_offset);char *pretty_sizes (u64 size);
Signature · 1 line
1.7.6.5
Quoted 8 lines · Miao Xie
Now if we remove the device that is specified when mounting, btrfs will update the mount information in /proc, such as the information in
/proc/mounts. So in order to guarantee the consistency between/etc/mtaband the mount information in /proc, we must update/etc/mtab. This patch does it.This patch need libmount and libmount-devel(version >= 2.19) packages to compile.
Does this work well with say Fedora where /etc/mtab is just a symlink to /proc/mounts? Thanks,
Josef
Quoted 6 lines · Josef Bacik
Quoted 5 lines · Miao Xie
Now if we remove the device that is specified when mounting, btrfs will update the mount information in /proc, such as the information in
/proc/mounts. So in order to guarantee the consistency between/etc/mtaband the mount information in /proc, we must update/etc/mtab. This patch does it.
Quoted 6 lines
Quoted 3 lines
This patch need libmount and libmount-devel(version >= 2.19) packages to compile.
Does this work well with say Fedora where
/etc/mtabis just a symlink to/proc/mounts? Thanks,
Yes, if /etc/mtab is not a regular file, we will skip the update. And I have do some test for it and all of them passed.
This patch can not work well on your machine?
Thanks
Miao
Quoted 11 lines · Miao Xie
Quoted 10 lines · Josef Bacik
Quoted 8 lines · Miao Xie
Now if we remove the device that is specified when mounting, btrfs will update the mount information in /proc, such as the information in
/proc/mounts. So in order to guarantee the consistency between/etc/mtaband the mount information in /proc, we must update/etc/mtab. This patch does it.This patch need libmount and libmount-devel(version >= 2.19) packages to compile.
Quoted 8 lines
Quoted 2 lines
Does this work well with say Fedora where
/etc/mtabis just a symlink to/proc/mounts? Thanks,Yes, if
/etc/mtabis not a regular file, we will skip the update. And I have do some test for it and all of them passed.This patch can not work well on your machine?
It didn't but I think I screwed something up so ignore me. Thanks,
Josef