Fix subvol del --commit-after to work properly:
 - SYNC ioctl will be issued even when last delete is failed
 - SYNC ioctl will be issued on each file system only once in the end

To achieve this, each deleted subvol's (parent's) fsid is checked each
time. If the fsid is seen for the first time, its fd will be kept in order
to issue SYNC ioctl in the end.

There already exists get_fsid() in cmds-property.c and seen_fsid which
keeps fsid in hush function in cmds-filesystem.c. This patch utilizes
them.

First patch is the independent but critical. Current code is reversed in
--commit-after and --commit-each operation. i.e. --commit-after means
--commit-each actually. The patch fix this.

2rd to 4th patches make functions stated above to common and last one is
the main part.

Thanks Qu for reviewing whole patches.

change to v2:
        split the cleanup part of 4th patch and make it the independent patch
        (1st patch in new series).

Tomohiro Misono (5):
  btrfs-progs: subvol: exchange subvol del --commit-after and --commit-each
  btrfs-progs: move get_fsid() to util.c
  btrfs-progs: move seen_fsid to util.c
  btrfs-progs: change seen_fsid to hold fd and DIR*
  btrfs-progs: subvol: fix subvol del --commit-after

 cmds-filesystem.c |  88 +++------------------------------------------
 cmds-property.c   |  30 ----------------
 cmds-subvolume.c  |  72 +++++++++++++++++++++++++++----------
 utils.c           | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 utils.h           |  15 ++++++++
 5 files changed, 179 insertions(+), 131 deletions(-)

-- 
2.9.5

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

Reply via email to