Failback with pre-migrated file on old primary and no changes from acting primary

This use case describes failing back with pre-migrated file on old primary.

Fileset: primary
State of the file in latest RPO at primary: resident
Action on the file from primary after latest RPO: Recall
Primary disaster, failover to secondary, old primary came back up, run failback start
State of the file in the old primary after failback start: P with old blocks
Current state of the file on acting primary: R with no mtime change
State of the file in the old primary after applyUpdates: P with old blocks

#create a new file from primary, flush to secondary

(05:12:08) hs21n30:~ # dd if=/dev/urandom of=/gpfs/fs2/HSMprimary/file4 bs=1M count=1

1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.139259 s, 7.5 MB/s

(05:12:35) hs21n30:~ # mmafmctl fs2 getstate -j HSMprimary

Fileset Name Fileset Target Cache State Gateway Node Queue Length Queue numExec
------------ -------------- ------------- ------------ ------------ -------------
HSMprimary nfs://c41bn3/gpfs/fs2/HSMsecondary Active hs22n25 0 15

#create new RPO from primary

(05:13:00) hs21n30:~ # mmpsnap fs2 create -j HSMprimary --rpo

Flushing dirty data for snapshot HSMprimary:psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-13-17...
Quiescing all file system operations.
Snapshot HSMprimary:psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-13-17 created with id 10046.
mmpsnap: The peer snapshot psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-13-17 is created successfully.

(05:17:12) hs21n30:~ # dsmls /gpfs/fs2/HSMprimary/file4 | grep file4

1048576 1048576 1024 r file4

#Migrate and then recall

(05:17:28) hs21n30:~ # dsmmigrate /gpfs/fs2/HSMprimary/file4

Tivoli Storage Manager
Command Line Space Management Client Interface
Client Version 7, Release 1, Level 3.0
Client date/time: 02/08/16 05:17:48
(c) Copyright by IBM Corporation and other(s) 1990, 2016. All Rights Reserved.

(05:17:49) hs21n30:~ # dsmls /gpfs/fs2/HSMprimary/file4 | grep file4

1048576 0 0 m file4

(05:17:51) hs21n30:~ # dsmrecall /gpfs/fs2/HSMprimary/file4

Tivoli Storage Manager
Command Line Space Management Client Interface
Client Version 7, Release 1, Level 3.0
Client date/time: 02/08/16 05:18:00
(c) Copyright by IBM Corporation and other(s) 1990, 2016. All Rights Reserved.

(05:18:00) hs21n30:~ # dsmls /gpfs/fs2/HSMprimary/file4 | grep file4

1048576 1048576 1024 p file4
(05:19:11) c41bn3:~ # dsmls /gpfs/fs2/HSMsecondary/file4 | grep file4

1048576 1048576 1024 r file4

#Run failoverToSecondary at secondary

(05:19:16) c41bn3:~ # mmafmctl fs2 failoverToSecondary -j HSMsecondary --restore

mmafmctl: failoverToSecondary restoring from psnap psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-13-17
[2016-02-08 05:19:40] Restoring fileset "HSMsecondary" from snapshot "psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-13-17" of filesystem "/dev/fs2"

[2016-02-08 05:19:42] Scanning inodes, phase 1 ...
[2016-02-08 05:19:43] 2770438144 inodes have been scanned, 100% of total.
[2016-02-08 05:19:43] There's no data changes since the restoring snapshot, skipping restore.
[2016-02-08 05:19:43] Restore completed successfully.
[2016-02-08 05:19:43] Clean up.
Primary Id (afmPrimaryID) 5492471941218300346-C0A82917531DFD53-645
Fileset HSMsecondary changed.
Promoted fileset HSMsecondary to Primary

# Start failbackToPrimary at old primary

(05:18:03) hs21n30:~ # mmafmctl fs2 failbackToPrimary -j HSMprimary --start

Fileset HSMprimary changed.
mmafmctl: failbackToPrimary restoring from psnap psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-13-17
[2016-02-08 05:21:31] Restoring fileset "HSMprimary" from snapshot "psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-13-17" of filesystem "/dev/fs2"

[2016-02-08 05:21:33] Scanning inodes, phase 1 ...
[2016-02-08 05:21:49] 71403200 inodes have been scanned, 100% of total.
[2016-02-08 05:21:49] There's no data changes since the restoring snapshot, skipping restore.
[2016-02-08 05:21:49] Restore completed successfully.
[2016-02-08 05:21:49] Clean up.

#ApplyUpdates on old primary

(05:21:49) hs21n30:~ # mmafmctl fs2 applyUpdates -j HSMprimary

[2016-02-08 05:22:02] Getting the list of updates from the acting Primary...
No changes, nothing to apply.
mmafmctl: Creating the failback psnap locally. failback-psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-21-57
Flushing dirty data for snapshot HSMprimary:failback-psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-21-57...
Quiescing all file system operations.
Snapshot HSMprimary:failback-psnap-rpo-C0A8741A5587A9AB-143-16-02-08-05-21-57 created with id 10048.

(05:22:07) hs21n30:~ # mmafmctl fs2 getstate -j HSMprimary

Fileset Name Fileset Target Cache State Gateway Node Queue Length Queue numExec
------------ -------------- ------------- ------------ ------------ -------------
HSMprimary nfs://c41bn3/gpfs/fs2/HSMsecondary FailbackInProg hs22n25 0 16

#State of the file in the old primary after failback start

(05:22:24) hs21n30:~ # dsmls /gpfs/fs2/HSMprimary/file4 | grep file4

1048576 1048576 1024 p file4