]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
libxcmd: fix counting of xfs entries in fs_table_insert
authorEryu Guan <eguan@redhat.com>
Sun, 2 Oct 2016 23:36:14 +0000 (10:36 +1100)
committerDave Chinner <david@fromorbit.com>
Sun, 2 Oct 2016 23:36:14 +0000 (10:36 +1100)
commit753a71d46f0ff5899169edde517feb3825171ad2
treead92f15e5375c70f9c44035ae0c93b9f058298d1
parentc1a14cc70114ef6c13e375d3117784ad9d17faa9
libxcmd: fix counting of xfs entries in fs_table_insert

Commit bb80e3d6cd04 ("libxcmd: populate fs table with xfs entries
first, foreign entries last") adds a new counter "xfs_fs_count" and
increases the counter when inserting an XFS entry.

But it missed a counter when fs_count is zero (inserting the first
path) and the entry has no FS_FOREIGN bit set, i.e. the first XFS
entry doesn't increase xfs_fs_count.

This results in args_command() mess and infinite loop in xfs/244
when testing v4 XFS (xfs/244 notrun on v5 XFS, but this bug still
reproduces on v5 XFS). e.g.

  mkfs -t xfs -f /dev/sda5
  mount -o pquota /dev/sda5 /mnt/xfs
  mkdir /mnt/xfs/project
  touch /mnt/xfs/project/testfile
  xfs_quota -x -c "project -s -p /mnt/xfs/project/testfile 1" /dev/sda5

Fix it by increasing xfs_fs_count when flags has no FS_FOREIGN bit.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxcmd/paths.c