[dm-devel] lvm not updating reported device size until fs is unmounted (linux kernel 2.6.0-test3)

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

 



Sorry for the cross-post...wasn't sure where to put this one. Feel free to respond on whichever group is more appropriate...

I am experiencing a problem where xfs_growfs would fail to do anything unless the fs has been unmounted and remounted before the growfs command. This problem (with help from the xfs guys) has been tracked down to the device mapper not updating it's reported size until the umount takes place.

The code below tests this (aside: it would be nice to have this reported in proc), and this example illustrates the problem(lvm_size is what I compiled the below code as):
# ./lvm_size /dev/lvm_group_2/debmir
size = 11811160064 bytes, sector size = 512 bytes

# lvextend -L +100M /dev/lvm_group_2/debmir
Extending logical volume debmir to 11.10 GB
Logical volume debmir successfully resized

# ./lvm_size /dev/lvm_group_2/debmir
size = 11811160064 bytes, sector size = 512 bytes

# umount /data/debmir
# ./lvm_size /dev/lvm_group_2/debmir
size = 11916017664 bytes, sector size = 512 bytes

-Thanks
-Tupshin

#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>

#define BLKGETSIZE64   _IOR(0x12,114,sizeof(unsigned long long))
#define BLKSSZGET      _IO(0x12,104)

int main(int argc, char **argv)
{
	unsigned long long size;
	int ssize, fd, error;

	if (argc < 2) {
		fprintf(stderr, "insufficent arguments\n");
		exit(1);
	}
	if ((fd = open(argv[1], O_RDONLY)) < 0) {
		perror(argv[1]);
		exit(1);
	}
	if (ioctl(fd, BLKGETSIZE64, &size) < 0) {
		perror("BLKGETSIZE64");
		exit(1);
	}
	if (ioctl(fd, BLKSSZGET, &ssize) < 0) {
		perror("BLKSSZGET");
		exit(1);
	}
	close(fd);

	printf("size = %lld bytes, sector size = %d bytes\n", size, ssize);
}






[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux