btrfs-util: expose SIGINT behaviour in snapshot copy fallback, too
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Jul 2019 08:58:49 +0000 (10:58 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 17 Jul 2019 09:14:11 +0000 (11:14 +0200)
src/basic/btrfs-util.c
src/basic/btrfs-util.h

index 1ee0110..540a199 100644 (file)
@@ -1624,7 +1624,7 @@ int btrfs_subvol_snapshot_fd_full(
                 } else if (r < 0)
                         return r;
 
-                r = copy_directory_fd_full(old_fd, new_path, COPY_MERGE|COPY_REFLINK|COPY_SAME_MOUNT, progress_path, progress_bytes, userdata);
+                r = copy_directory_fd_full(old_fd, new_path, COPY_MERGE|COPY_REFLINK|COPY_SAME_MOUNT|(FLAGS_SET(flags, BTRFS_SNAPSHOT_SIGINT) ? COPY_SIGINT : 0), progress_path, progress_bytes, userdata);
                 if (r < 0)
                         goto fallback_fail;
 
index 7d848a7..b15667b 100644 (file)
@@ -34,6 +34,7 @@ typedef enum BtrfsSnapshotFlags {
         BTRFS_SNAPSHOT_QUOTA              = 1 << 3,
         BTRFS_SNAPSHOT_FALLBACK_DIRECTORY = 1 << 4, /* If the destination doesn't support subvolumes, reflink/copy instead */
         BTRFS_SNAPSHOT_FALLBACK_IMMUTABLE = 1 << 5, /* When we can't create a subvolume, use the FS_IMMUTABLE attribute for indicating read-only */
+        BTRFS_SNAPSHOT_SIGINT             = 1 << 6, /* Check for SIGINT regularly, and return EINTR if seen */
 } BtrfsSnapshotFlags;
 
 typedef enum BtrfsRemoveFlags {